diff options
author | Alexander Kornienko <alexfh@google.com> | 2018-11-25 02:41:01 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2018-11-25 02:41:01 +0000 |
commit | a4fe7201db6f7d1e14213287269b7f6eadea81c3 (patch) | |
tree | 6d8c28698a9494e8fdc69496a7170952268fc4b6 /clang-tools-extra/change-namespace | |
parent | 4813f0b5840e2d01d39e2bf3adba9f4344adf92f (diff) |
A bit of AST matcher cleanup, NFC.
Removed the uses of the allOf() matcher inside node matchers that are implicit
allOf(). Replaced uses of allOf() with the explicit node matcher where it makes
matchers more readable. Replace anyOf(hasName(), hasName(), ...) with the more
efficient and readable hasAnyName().
Diffstat (limited to 'clang-tools-extra/change-namespace')
-rw-r--r-- | clang-tools-extra/change-namespace/ChangeNamespace.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/clang-tools-extra/change-namespace/ChangeNamespace.cpp b/clang-tools-extra/change-namespace/ChangeNamespace.cpp index d0eaa306a79..7a7103181f5 100644 --- a/clang-tools-extra/change-namespace/ChangeNamespace.cpp +++ b/clang-tools-extra/change-namespace/ChangeNamespace.cpp @@ -450,8 +450,8 @@ void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) { typeLoc(IsInMovedNs, loc(qualType(hasDeclaration(DeclMatcher.bind("from_decl")))), unless(anyOf(hasParent(typeLoc(loc(qualType( - allOf(hasDeclaration(DeclMatcher), - unless(templateSpecializationType())))))), + hasDeclaration(DeclMatcher), + unless(templateSpecializationType()))))), hasParent(nestedNameSpecifierLoc()), hasAncestor(isImplicit()), hasAncestor(UsingShadowDeclInClass), @@ -505,13 +505,12 @@ void ChangeNamespaceTool::registerMatchers(ast_matchers::MatchFinder *Finder) { hasAncestor(namespaceDecl(isAnonymous())), hasAncestor(cxxRecordDecl()))), hasParent(namespaceDecl())); - Finder->addMatcher( - expr(allOf(hasAncestor(decl().bind("dc")), IsInMovedNs, - unless(hasAncestor(isImplicit())), - anyOf(callExpr(callee(FuncMatcher)).bind("call"), - declRefExpr(to(FuncMatcher.bind("func_decl"))) - .bind("func_ref")))), - this); + Finder->addMatcher(expr(hasAncestor(decl().bind("dc")), IsInMovedNs, + unless(hasAncestor(isImplicit())), + anyOf(callExpr(callee(FuncMatcher)).bind("call"), + declRefExpr(to(FuncMatcher.bind("func_decl"))) + .bind("func_ref"))), + this); auto GlobalVarMatcher = varDecl( hasGlobalStorage(), hasParent(namespaceDecl()), |