[clang-tools-extra] r272795 - Apply performance-unnecessary-value-param to clang-tidy.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 08:46:10 PDT 2016


Author: d0k
Date: Wed Jun 15 10:46:10 2016
New Revision: 272795

URL: http://llvm.org/viewvc/llvm-project?rev=272795&view=rev
Log:
Apply performance-unnecessary-value-param to clang-tidy.

With minor manual tweaks. No functionality change intended.

Modified:
    clang-tools-extra/trunk/clang-tidy/ClangTidyModule.cpp
    clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
    clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
    clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
    clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
    clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyModule.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyModule.cpp?rev=272795&r1=272794&r2=272795&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyModule.cpp Wed Jun 15 10:46:10 2016
@@ -18,7 +18,7 @@ namespace tidy {
 
 void ClangTidyCheckFactories::registerCheckFactory(StringRef Name,
                                                    CheckFactory Factory) {
-  Factories[Name] = Factory;
+  Factories[Name] = std::move(Factory);
 }
 
 void ClangTidyCheckFactories::createChecks(

Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=272795&r1=272794&r2=272795&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Wed Jun 15 10:46:10 2016
@@ -29,7 +29,8 @@ void ExplicitConstructorCheck::registerM
 
 // 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())

Modified: clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp?rev=272795&r1=272794&r2=272795&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp Wed Jun 15 10:46:10 2016
@@ -21,14 +21,14 @@ namespace misc {
 namespace {
 
 ast_matchers::internal::BindableMatcher<Stmt>
-handleFrom(ast_matchers::internal::Matcher<RecordDecl> IsAHandle,
-           ast_matchers::internal::Matcher<Expr> Arg) {
+handleFrom(const ast_matchers::internal::Matcher<RecordDecl> &IsAHandle,
+           const ast_matchers::internal::Matcher<Expr> &Arg) {
   return cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))),
                           hasArgument(0, Arg));
 }
 
 ast_matchers::internal::Matcher<Stmt> handleFromTemporaryValue(
-    ast_matchers::internal::Matcher<RecordDecl> IsAHandle) {
+    const ast_matchers::internal::Matcher<RecordDecl> &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<RecordDe
                     "::std::unordered_multimap");
 }
 
-ast_matchers::internal::BindableMatcher<Stmt>
-makeContainerMatcher(ast_matchers::internal::Matcher<RecordDecl> IsAHandle) {
+ast_matchers::internal::BindableMatcher<Stmt> makeContainerMatcher(
+    const ast_matchers::internal::Matcher<RecordDecl> &IsAHandle) {
   // This matcher could be expanded to detect:
   //  - Constructors: eg. vector<string_view>(3, string("A"));
   //  - emplace*(): This requires a different logic to determine that

Modified: clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp?rev=272795&r1=272794&r2=272795&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp Wed Jun 15 10:46:10 2016
@@ -186,7 +186,7 @@ getParameterSourceDeclaration(const Func
 
 std::string joinParameterNames(
     const DifferingParamsContainer &DifferingParams,
-    std::function<StringRef(const DifferingParamInfo &)> ChooseParamName) {
+    llvm::function_ref<StringRef(const DifferingParamInfo &)> ChooseParamName) {
   llvm::SmallVector<char, 40> Buffer;
   llvm::raw_svector_ostream Str(Buffer);
   bool First = true;

Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp?rev=272795&r1=272794&r2=272795&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp Wed Jun 15 10:46:10 2016
@@ -18,7 +18,7 @@ namespace tidy {
 namespace readability {
 
 namespace {
-internal::Matcher<Expr> callToGet(internal::Matcher<Decl> OnClass) {
+internal::Matcher<Expr> callToGet(const internal::Matcher<Decl> &OnClass) {
   return cxxMemberCallExpr(
              on(expr(anyOf(hasType(OnClass),
                            hasType(qualType(

Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=272795&r1=272794&r2=272795&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Wed Jun 15 10:46:10 2016
@@ -338,7 +338,7 @@ static int clangTidyMain(int argc, const
       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;




More information about the cfe-commits mailing list