From 5cedc8fbfaf87d1afe0cb1e378d882dce77cb127 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Wed, 19 Aug 2015 19:29:23 +0000 Subject: [PATCH] Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage. llvm-svn: 245484 --- .../PassByValue/PassByValueMatchers.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp b/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp index 1a0cbcf5ef97..c6ee6a8067f8 100644 --- a/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp +++ b/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp @@ -44,19 +44,6 @@ AST_MATCHER(CXXRecordDecl, isMoveConstructible) { } 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 makePassByValueCtorParamMatcher() { anyOf(constRefType(), nonConstValueType())))) .bind(PassByValueParamId)))), hasDeclaration(constructorDecl( - isNonDeletedCopyConstructor(), + isCopyConstructor(), unless(isDeleted()), hasDeclContext(recordDecl(isMoveConstructible()))))))) .bind(PassByValueInitializerId))) .bind(PassByValueCtorId);