[clang-tools-extra] r245484 - Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 12:29:23 PDT 2015


Author: aaronballman
Date: Wed Aug 19 14:29:23 2015
New Revision: 245484

URL: http://llvm.org/viewvc/llvm-project?rev=245484&view=rev
Log:
Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.

Modified:
    clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp

Modified: clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp?rev=245484&r1=245483&r2=245484&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/PassByValue/PassByValueMatchers.cpp Wed Aug 19 14:29:23 2015
@@ -44,19 +44,6 @@ AST_MATCHER(CXXRecordDecl, isMoveConstru
   }
   return false;
 }
-
-/// \brief Matches non-deleted copy constructors.
-///
-/// Given
-/// \code
-///   struct Foo { Foo(const Foo &) = default; };
-///   struct Bar { Bar(const Bar &) = deleted; };
-/// \endcode
-/// constructorDecl(isNonDeletedCopyConstructor())
-///   matches "Foo(const Foo &)".
-AST_MATCHER(CXXConstructorDecl, isNonDeletedCopyConstructor) {
-  return Node.isCopyConstructor() && !Node.isDeleted();
-}
 } // namespace ast_matchers
 } // namespace clang
 
@@ -87,7 +74,7 @@ DeclarationMatcher makePassByValueCtorPa
                                   anyOf(constRefType(), nonConstValueType()))))
                       .bind(PassByValueParamId)))),
               hasDeclaration(constructorDecl(
-                  isNonDeletedCopyConstructor(),
+                  isCopyConstructor(), unless(isDeleted()),
                   hasDeclContext(recordDecl(isMoveConstructible())))))))
                                         .bind(PassByValueInitializerId)))
       .bind(PassByValueCtorId);




More information about the cfe-commits mailing list