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

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

Issue 1783923003: rewrite_to_chrome_style: Blacklisted methods are not blink methods! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | no next file » | 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 13b36000a1e2bbe359079ecb4d05560b0db1343b..dff645c825d17ca7fdc87b49a9fa5ec7487fb5af 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -64,6 +64,10 @@ const char kBlinkFieldPrefix[] = "m_";
const char kBlinkStaticMemberPrefix[] = "s_";
const char kGeneratedFileRegex[] = "^gen/|/gen/";
+// These methods should never be renamed, we do not consider them
+// to be blink (or wtf) methods at all.
+const char* const kBlacklistMethods[] = {"trace", "lock", "unlock", "try_lock"};
+
AST_MATCHER(clang::FunctionDecl, isOverloadedOperator) {
return Node.isOverloadedOperator();
}
@@ -131,6 +135,15 @@ bool IsBlinkOrWTFMethod(const clang::CXXMethodDecl& decl,
bool overrides_blink = false;
bool overrides_non_blink = false;
+ // Blacklisted methods are not considered to be in blink so that they will
dcheng 2016/03/10 22:52:46 1) Would it make sense to just combine the iterato
danakj 2016/03/10 22:55:14 We made the iterator blacklist only kick in based
dcheng 2016/03/10 22:57:53 Hmm... that makes it more complicated. I'd sugges
+ // never be rewritten.
+ if (!decl.isStatic()) {
+ for (const auto& b : kBlacklistMethods) {
+ if (decl.getNameAsString() == b)
+ return false;
+ }
+ }
+
for (auto it = decl.begin_overridden_methods();
it != decl.end_overridden_methods(); ++it) {
if (IsBlinkOrWTFMethod(**it, source_manager))
@@ -305,13 +318,6 @@ bool GetNameForDecl(const clang::CXXMethodDecl& decl,
return false;
}
}
-
- // Some methods shouldn't be renamed because reasons.
- static const char* kBlacklist[] = {"trace", "lock", "unlock", "try_lock"};
- for (const auto& b : kBlacklist) {
- if (original_name == b)
- return false;
- }
}
name = decl.getName().str();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698