Replacing a custom AST matcher with some builtin AST matchers; NFC, and existing tests should provide sufficient coverage.
llvm-svn: 245492
This commit is contained in:
parent
814b705984
commit
f7c25368b7
|
@ -45,19 +45,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();
|
||||
}
|
||||
|
||||
static TypeMatcher constRefType() {
|
||||
return lValueReferenceType(pointee(isConstQualified()));
|
||||
}
|
||||
|
@ -158,7 +145,7 @@ void PassByValueCheck::registerMatchers(MatchFinder *Finder) {
|
|||
anyOf(constRefType(), nonConstValueType()))))
|
||||
.bind("Param")))),
|
||||
hasDeclaration(constructorDecl(
|
||||
isNonDeletedCopyConstructor(),
|
||||
isCopyConstructor(), unless(isDeleted()),
|
||||
hasDeclContext(recordDecl(isMoveConstructible())))))))
|
||||
.bind("Initializer")))
|
||||
.bind("Ctor"),
|
||||
|
|
Loading…
Reference in New Issue