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 cd4a279e73aa139b96629463a064a0a6e42ee5e0..2c1d481a856259d8e85887f5a3c96e4c11a16b3a 100644 |
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
@@ -208,6 +208,12 @@ bool IsMethodOverrideOf(const clang::CXXMethodDecl& decl, |
} |
bool IsBlacklistedFunctionName(llvm::StringRef name) { |
+ // https://crbug.com/672902: Method names with an underscore are typically |
+ // mimicked after std library / are typically not originating from Blink. |
+ // Do not rewrite such names (like push_back, emplace_back, etc.). |
+ if (name.find('_') != llvm::StringRef::npos) |
+ return true; |
+ |
// https://crbug.com/677166: Have to avoid renaming |hash| -> |Hash| to avoid |
// colliding with a struct already named |Hash|. |
return name == "hash"; |
@@ -225,6 +231,10 @@ bool IsBlacklistedInstanceMethodName(llvm::StringRef name) { |
// 2. They (begin+end) are used in range-based for syntax sugar |
// - for (auto x : foo) { ... } // <- foo.begin() will be called. |
"begin", "end", "rbegin", "rend", "lock", "unlock", "try_lock", |
+ |
+ // https://crbug.com/672902: Should not rewrite names that mimick methods |
+ // from std library. |
+ "back", "empty", "erase", "front", |
dcheng
2016/12/28 18:19:09
What about insert?
Łukasz Anforowicz
2016/12/28 18:27:16
Oops. "insert" is mentioned explicitly in https:/
|
}; |
for (const auto& b : kBlacklistedNames) { |
if (name == b) |