Chromium Code Reviews| 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; |
| } |