diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp index 815c02a15492d..7a9d04bfa8ba1 100644 --- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp @@ -75,9 +75,9 @@ static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor, /// the /// given constructor. bool hasExactlyOneUsageIn(const CXXConstructorDecl *Ctor) { - Count = 0; + Count = 0U; TraverseDecl(const_cast(Ctor)); - return Count == 1; + return Count == 1U; } private: @@ -88,7 +88,7 @@ static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor, if (const ParmVarDecl *To = dyn_cast(D->getDecl())) { if (To == ParamDecl) { ++Count; - if (Count > 1) { + if (Count > 1U) { // No need to look further, used more than once. return false; } @@ -98,7 +98,7 @@ static bool paramReferredExactlyOnce(const CXXConstructorDecl *Ctor, } const ParmVarDecl *ParamDecl; - unsigned Count; + unsigned Count = 0U; }; return ExactlyOneUsageVisitor(ParamDecl).hasExactlyOneUsageIn(Ctor);