diff --git a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp index e1e798ddccff..3a3ae82e6a97 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidyModule.cpp @@ -18,7 +18,7 @@ namespace tidy { void ClangTidyCheckFactories::registerCheckFactory(StringRef Name, CheckFactory Factory) { - Factories[Name] = Factory; + Factories[Name] = std::move(Factory); } void ClangTidyCheckFactories::createChecks( diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp index e3095fe536e2..0714516edf59 100644 --- a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp @@ -29,7 +29,8 @@ void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { // Looks for the token matching the predicate and returns the range of the found // token including trailing whitespace. -static SourceRange FindToken(const SourceManager &Sources, LangOptions LangOpts, +static SourceRange FindToken(const SourceManager &Sources, + const LangOptions &LangOpts, SourceLocation StartLoc, SourceLocation EndLoc, bool (*Pred)(const Token &)) { if (StartLoc.isMacroID() || EndLoc.isMacroID()) diff --git a/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp b/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp index ed2527e42cf6..97d23e0e0cfb 100644 --- a/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp @@ -21,14 +21,14 @@ namespace misc { namespace { ast_matchers::internal::BindableMatcher -handleFrom(ast_matchers::internal::Matcher IsAHandle, - ast_matchers::internal::Matcher Arg) { +handleFrom(const ast_matchers::internal::Matcher &IsAHandle, + const ast_matchers::internal::Matcher &Arg) { return cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))), hasArgument(0, Arg)); } ast_matchers::internal::Matcher handleFromTemporaryValue( - ast_matchers::internal::Matcher IsAHandle) { + const ast_matchers::internal::Matcher &IsAHandle) { // If a ternary operator returns a temporary value, then both branches hold a // temporary value. If one of them is not a temporary then it must be copied // into one to satisfy the type of the operator. @@ -54,8 +54,8 @@ ast_matchers::internal::Matcher isAMap() { "::std::unordered_multimap"); } -ast_matchers::internal::BindableMatcher -makeContainerMatcher(ast_matchers::internal::Matcher IsAHandle) { +ast_matchers::internal::BindableMatcher makeContainerMatcher( + const ast_matchers::internal::Matcher &IsAHandle) { // This matcher could be expanded to detect: // - Constructors: eg. vector(3, string("A")); // - emplace*(): This requires a different logic to determine that diff --git a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp index 78438cb20477..e3e82d717d51 100644 --- a/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp @@ -186,7 +186,7 @@ getParameterSourceDeclaration(const FunctionDecl *OriginalDeclaration) { std::string joinParameterNames( const DifferingParamsContainer &DifferingParams, - std::function ChooseParamName) { + llvm::function_ref ChooseParamName) { llvm::SmallVector Buffer; llvm::raw_svector_ostream Str(Buffer); bool First = true; diff --git a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp index e3686359fa00..f36ed8219f45 100644 --- a/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp @@ -18,7 +18,7 @@ namespace tidy { namespace readability { namespace { -internal::Matcher callToGet(internal::Matcher OnClass) { +internal::Matcher callToGet(const internal::Matcher &OnClass) { return cxxMemberCallExpr( on(expr(anyOf(hasType(OnClass), hasType(qualType( diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index 2662241024ac..d2959175629d 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -338,7 +338,7 @@ static int clangTidyMain(int argc, const char **argv) { return 1; } llvm::outs() << "Enabled checks:"; - for (auto CheckName : EnabledChecks) + for (const auto &CheckName : EnabledChecks) llvm::outs() << "\n " << CheckName; llvm::outs() << "\n\n"; return 0;