Index: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
diff --git a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
index 267f617258d5e23e1edd491c175af87160939f15..257c5eabeb5ec20750e0578c461596cf998dd376 100644 |
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
@@ -187,6 +187,16 @@ AST_MATCHER_P( |
return qual && InnerMatcher.matches(*qual, Finder, Builder); |
} |
+// Matches |T::f| DependentScopeDeclRefExpr if InnerMatcher matches |T|. |
+AST_MATCHER_P( |
+ clang::DeclaratorDecl, |
+ declaratorDeclHasQualifier, |
Łukasz Anforowicz
2016/08/24 19:20:21
Ideally I would name this |hasQualifier|, but if I
|
+ clang::ast_matchers::internal::Matcher<clang::NestedNameSpecifier>, |
+ InnerMatcher) { |
+ clang::NestedNameSpecifier* qual = Node.getQualifier(); |
+ return qual && InnerMatcher.matches(*qual, Finder, Builder); |
+} |
+ |
// Matches |const Class<T>&| QualType if InnerMatcher matches |Class<T>|. |
AST_MATCHER_P(clang::QualType, |
hasUnderlyingType, |
@@ -812,10 +822,15 @@ int main(int argc, const char* argv[]) { |
MatchFinder match_finder; |
std::set<Replacement> replacements; |
- auto in_blink_namespace = |
- decl(hasAncestor(namespaceDecl(anyOf(hasName("blink"), hasName("WTF")), |
- hasParent(translationUnitDecl()))), |
- unless(isExpansionInFileMatching(kGeneratedFileRegex))); |
+ auto blink_namespace_decl_matcher = |
+ namespaceDecl(anyOf(hasName("blink"), hasName("WTF")), |
+ hasParent(translationUnitDecl())); |
+ auto in_blink_namespace = decl( |
+ anyOf(decl(hasAncestor(blink_namespace_decl_matcher)), |
+ declaratorDecl(declaratorDeclHasQualifier(anyOf( |
+ specifiesNamespace(blink_namespace_decl_matcher), |
+ hasPrefix(specifiesNamespace(blink_namespace_decl_matcher)))))), |
+ unless(isExpansionInFileMatching(kGeneratedFileRegex))); |
// Field, variable, and enum declarations ======== |
// Given |