This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGca4485d9fc34: [clang-tidy] Simplify const params check 
(authored by stephenkelly).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96141

Files:
  clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
  clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h


Index: clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h
===================================================================
--- clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h
+++ clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h
@@ -24,6 +24,9 @@
 
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  llvm::Optional<TraversalKind> getCheckTraversalKind() const override {
+    return TK_IgnoreUnlessSpelledInSource;
+  }
 };
 
 } // namespace readability
Index: clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
+++ clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
@@ -33,14 +33,6 @@
       parmVarDecl(hasType(qualType(isConstQualified()))).bind("param");
   Finder->addMatcher(
       functionDecl(unless(isDefinition()),
-                   // Lambdas are always their own definition, but they
-                   // generate a non-definition FunctionDecl too. Ignore those.
-                   // Class template instantiations have a non-definition
-                   // CXXMethodDecl for methods that aren't used in this
-                   // translation unit. Ignore those, as the template will have
-                   // already been checked.
-                   unless(cxxMethodDecl(ofClass(cxxRecordDecl(anyOf(
-                       isLambda(), 
ast_matchers::isTemplateInstantiation()))))),
                    has(typeLoc(forEach(ConstParamDecl))))
           .bind("func"),
       this);


Index: clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h
===================================================================
--- clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h
+++ clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.h
@@ -24,6 +24,9 @@
 
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  llvm::Optional<TraversalKind> getCheckTraversalKind() const override {
+    return TK_IgnoreUnlessSpelledInSource;
+  }
 };
 
 } // namespace readability
Index: clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
+++ clang-tools-extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
@@ -33,14 +33,6 @@
       parmVarDecl(hasType(qualType(isConstQualified()))).bind("param");
   Finder->addMatcher(
       functionDecl(unless(isDefinition()),
-                   // Lambdas are always their own definition, but they
-                   // generate a non-definition FunctionDecl too. Ignore those.
-                   // Class template instantiations have a non-definition
-                   // CXXMethodDecl for methods that aren't used in this
-                   // translation unit. Ignore those, as the template will have
-                   // already been checked.
-                   unless(cxxMethodDecl(ofClass(cxxRecordDecl(anyOf(
-                       isLambda(), ast_matchers::isTemplateInstantiation()))))),
                    has(typeLoc(forEach(ConstParamDecl))))
           .bind("func"),
       this);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to