[clang-tools-extra] bf452f9 - [clang-tidy][NFC] Replace custom isStatic matcher with the existing isStaticStorageClass
Carlos Galvez via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 19 07:24:08 PST 2022
Author: Carlos Galvez
Date: 2022-12-19T15:23:50Z
New Revision: bf452f9b347aa0e1f8f368da925b8e1ca27df0c5
URL: https://github.com/llvm/llvm-project/commit/bf452f9b347aa0e1f8f368da925b8e1ca27df0c5
DIFF: https://github.com/llvm/llvm-project/commit/bf452f9b347aa0e1f8f368da925b8e1ca27df0c5.diff
LOG: [clang-tidy][NFC] Replace custom isStatic matcher with the existing isStaticStorageClass
Added:
Modified:
clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp b/clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp
index b26632d10779..211bd3c73e12 100644
--- a/clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp
@@ -16,11 +16,6 @@ namespace clang {
namespace tidy {
namespace misc {
namespace {
-AST_POLYMORPHIC_MATCHER(isStatic, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
- VarDecl)) {
- return Node.getStorageClass() == SC_Static;
-}
-
AST_POLYMORPHIC_MATCHER_P(isInHeaderFile,
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
VarDecl),
@@ -60,13 +55,13 @@ void UseAnonymousNamespaceCheck::storeOptions(
void UseAnonymousNamespaceCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
- functionDecl(isStatic(),
+ functionDecl(isStaticStorageClass(),
unless(anyOf(isInHeaderFile(HeaderFileExtensions),
isInAnonymousNamespace(), isMemberFunction())))
.bind("x"),
this);
Finder->addMatcher(
- varDecl(isStatic(),
+ varDecl(isStaticStorageClass(),
unless(anyOf(isInHeaderFile(HeaderFileExtensions),
isInAnonymousNamespace(), isStaticLocal(),
isStaticDataMember(), hasType(isConstQualified()))))
More information about the cfe-commits
mailing list