Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Unified Diff: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Issue 2271203004: Tweak |in_blink_namespace|, to look at ancestors *and also* at qualifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-style-same-type-and-method-name
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/functions-expected.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/functions-expected.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698