forked from OSchip/llvm-project
[clang-tidy] Simplify special member functions check
Differential Revision: https://reviews.llvm.org/D97152
This commit is contained in:
parent
a5feefa3c7
commit
b672870886
|
@ -40,18 +40,13 @@ void SpecialMemberFunctionsCheck::storeOptions(
|
|||
void SpecialMemberFunctionsCheck::registerMatchers(MatchFinder *Finder) {
|
||||
Finder->addMatcher(
|
||||
cxxRecordDecl(
|
||||
eachOf(
|
||||
has(cxxDestructorDecl(unless(isImplicit())).bind("dtor")),
|
||||
has(cxxConstructorDecl(isCopyConstructor(), unless(isImplicit()))
|
||||
.bind("copy-ctor")),
|
||||
has(cxxMethodDecl(isCopyAssignmentOperator(),
|
||||
unless(isImplicit()))
|
||||
.bind("copy-assign")),
|
||||
has(cxxConstructorDecl(isMoveConstructor(), unless(isImplicit()))
|
||||
.bind("move-ctor")),
|
||||
has(cxxMethodDecl(isMoveAssignmentOperator(),
|
||||
unless(isImplicit()))
|
||||
.bind("move-assign"))))
|
||||
eachOf(has(cxxDestructorDecl().bind("dtor")),
|
||||
has(cxxConstructorDecl(isCopyConstructor()).bind("copy-ctor")),
|
||||
has(cxxMethodDecl(isCopyAssignmentOperator())
|
||||
.bind("copy-assign")),
|
||||
has(cxxConstructorDecl(isMoveConstructor()).bind("move-ctor")),
|
||||
has(cxxMethodDecl(isMoveAssignmentOperator())
|
||||
.bind("move-assign"))))
|
||||
.bind("class-def"),
|
||||
this);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,9 @@ public:
|
|||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
void onEndOfTranslationUnit() override;
|
||||
|
||||
llvm::Optional<TraversalKind> getCheckTraversalKind() const override {
|
||||
return TK_IgnoreUnlessSpelledInSource;
|
||||
}
|
||||
enum class SpecialMemberFunctionKind : uint8_t {
|
||||
Destructor,
|
||||
DefaultDestructor,
|
||||
|
|
Loading…
Reference in New Issue