[clang-tools-extra] r282476 - [clang-tidy] Use isStaticStorageClass ast matcher.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 00:58:52 PDT 2016


Author: hokein
Date: Tue Sep 27 02:58:52 2016
New Revision: 282476

URL: http://llvm.org/viewvc/llvm-project?rev=282476&view=rev
Log:
[clang-tidy] Use isStaticStorageClass ast matcher.

Modified:
    clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp?rev=282476&r1=282475&r2=282476&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp Tue Sep 27 02:58:52 2016
@@ -18,20 +18,14 @@ namespace clang {
 namespace tidy {
 namespace readability {
 
-namespace {
-AST_POLYMORPHIC_MATCHER(isStatic, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
-                                                                  VarDecl)) {
-  return Node.getStorageClass() == SC_Static;
-}
-} // namespace
-
 void StaticDefinitionInAnonymousNamespaceCheck::registerMatchers(
     MatchFinder *Finder) {
-  Finder->addMatcher(namedDecl(anyOf(functionDecl(isDefinition(), isStatic()),
-                                     varDecl(isDefinition(), isStatic())),
-                               hasParent(namespaceDecl(isAnonymous())))
-                         .bind("static-def"),
-                     this);
+  Finder->addMatcher(
+      namedDecl(anyOf(functionDecl(isDefinition(), isStaticStorageClass()),
+                      varDecl(isDefinition(), isStaticStorageClass())),
+                hasParent(namespaceDecl(isAnonymous())))
+          .bind("static-def"),
+      this);
 }
 
 void StaticDefinitionInAnonymousNamespaceCheck::check(




More information about the cfe-commits mailing list