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

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

Issue 2604023002: ABANDONED CL: Rewrite also identifiers declared in generated files. (Closed)
Patch Set: Created 4 years 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/generated-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 a268739ccd31eddba1b9f780e521fc96fd8e74d4..4df38c7974592eb7797478fff9e819950ec2864e 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -43,7 +43,6 @@ namespace {
const char kBlinkFieldPrefix[] = "m_";
const char kBlinkStaticMemberPrefix[] = "s_";
-const char kGeneratedFileRegex[] = "^gen/|/gen/";
template <typename MatcherType, typename NodeType>
bool IsMatching(const MatcherType& matcher,
@@ -994,12 +993,19 @@ int main(int argc, const char* argv[]) {
namespaceDecl(anyOf(hasName("blink"), hasName("WTF")),
hasParent(translationUnitDecl()));
+ auto protocol_namespace_decl =
+ namespaceDecl(hasName("protocol"),
+ hasParent(namespaceDecl(hasName("blink"),
+ hasParent(translationUnitDecl()))));
+
// Given top-level compilation unit:
// namespace WTF {
// void foo() {}
// }
// matches |foo|.
- auto decl_under_blink_namespace = decl(hasAncestor(blink_namespace_decl));
+ auto decl_under_blink_namespace =
+ decl(hasAncestor(blink_namespace_decl),
+ unless(hasAncestor(protocol_namespace_decl)));
// Given top-level compilation unit:
// void WTF::function() {}
@@ -1011,8 +1017,7 @@ int main(int argc, const char* argv[]) {
auto in_blink_namespace = decl(
anyOf(decl_under_blink_namespace, decl_has_qualifier_to_blink_namespace,
- hasAncestor(decl_has_qualifier_to_blink_namespace)),
- unless(isExpansionInFileMatching(kGeneratedFileRegex)));
+ hasAncestor(decl_has_qualifier_to_blink_namespace)));
// Field, variable, and enum declarations ========
// Given
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/generated-expected.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698