[clang-tools-extra] r245492 - 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 13:26:22 PDT 2015


Author: aaronballman
Date: Wed Aug 19 15:26:22 2015
New Revision: 245492

URL: http://llvm.org/viewvc/llvm-project?rev=245492&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-tidy/modernize/PassByValueCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp?rev=245492&r1=245491&r2=245492&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp Wed Aug 19 15:26:22 2015
@@ -45,19 +45,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();
-}
-
 static TypeMatcher constRefType() {
   return lValueReferenceType(pointee(isConstQualified()));
 }
@@ -158,7 +145,7 @@ void PassByValueCheck::registerMatchers(
                                   anyOf(constRefType(), nonConstValueType()))))
                               .bind("Param")))),
                       hasDeclaration(constructorDecl(
-                          isNonDeletedCopyConstructor(),
+                          isCopyConstructor(), unless(isDeleted()),
                           hasDeclContext(recordDecl(isMoveConstructible())))))))
                   .bind("Initializer")))
           .bind("Ctor"),




More information about the cfe-commits mailing list