summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-08-19 19:29:23 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-08-19 19:29:23 +0000
commit5cedc8fbfaf87d1afe0cb1e378d882dce77cb127 (patch)
treeb2b06b2b33e36ced8b3ffb0cfcaa7cb604549100 /clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp
parentfeb6b4395bc25b7a1bfbdd3c20a146ecd425334f (diff)
downloadbcm5719-llvm-5cedc8fbfaf87d1afe0cb1e378d882dce77cb127.tar.gz
bcm5719-llvm-5cedc8fbfaf87d1afe0cb1e378d882dce77cb127.zip
Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.
llvm-svn: 245484
Diffstat (limited to 'clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp')
-rw-r--r--clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp b/clang-tools-extra/clang-modernize/PassByValue/PassByValueMatchers.cpp
index 1a0cbcf5ef9..c6ee6a8067f 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);
OpenPOWER on IntegriCloud