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

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: not-static-methods 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
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..73360705bcdd0aca0ca9185827a8cf72c4727188 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)) {
+ if (!method->isStatic()) {
+ // Some methods shouldn't be renamed because reasons.
+ static const std::string kBlacklist[] = {"begin", "end", "rbegin",
dcheng 2016/01/28 06:58:12 Did you see trace() getting renamed to Trace() in
danakj 2016/01/28 19:47:58 fun:trace:Trace Ya, I'll add it.
danakj 2016/01/28 19:47:58 Oh, sure, char* it is.
+ "rend"};
+ for (const auto& b : kBlacklist) {
+ if (name == b)
+ return false;
+ }
+ }
+ }
+
name[0] = clang::toUppercase(name[0]);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698