This revision was automatically updated to reflect the committed changes.
Closed by commit rGb67287088664: [clang-tidy] Simplify special member functions 
check (authored by stephenkelly).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97152/new/

https://reviews.llvm.org/D97152

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h


Index: 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
===================================================================
--- clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -32,7 +32,9 @@
   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,
Index: 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
===================================================================
--- 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
+++ 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
@@ -40,18 +40,13 @@
 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);
 }


Index: clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
===================================================================
--- clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -32,7 +32,9 @@
   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,
Index: clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
@@ -40,18 +40,13 @@
 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);
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to