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

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

Issue 1647763002: rewrite_to_chrome_style: Don't rename begin()/end()/rbegin()/rend(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rewrite-begin-end: . Created 4 years, 11 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 db208abc2f762e0a7848ddb5f3700cb21743c46f..9cd4eb1b990b9c62d19be6767a484ef7eab7dafe 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -60,6 +60,19 @@ bool GetNameForDecl(const clang::FunctionDecl& decl,
const clang::ASTContext& context,
std::string& name) {
name = decl.getNameAsString();
+
+ if (const auto* method = clang::dyn_cast<const clang::CXXMethodDecl>(&decl)) {
dcheng 2016/01/28 20:20:33 Nit: dyn_cast<clang::CXXMethodDecl> should work.
danakj 2016/01/28 21:26:38 Nope..
+ if (!method->isStatic()) {
+ // Some methods shouldn't be renamed because reasons.
+ static const char* kBlacklist[] = {"begin", "end", "rbegin", "rend",
+ "trace"};
+ for (const auto& b : kBlacklist) {
+ if (name == b)
+ return false;
+ }
+ }
+ }
+
name[0] = clang::toUppercase(name[0]);
return true;
}
« 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