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..3f4e5008d1434a97a673a727cc399b5e96e9b552 100644 |
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
@@ -156,7 +156,8 @@ bool GetNameForDecl(const clang::VarDecl& decl, |
else if (original_name.startswith(kBlinkFieldPrefix)) |
original_name = original_name.substr(strlen(kBlinkFieldPrefix)); |
- if (IsProbablyConst(decl, context)) { |
+ bool is_const = IsProbablyConst(decl, context); |
+ if (is_const) { |
// Don't try to rename constants that already conform to Chrome style. |
if (original_name.size() >= 2 && original_name[0] == 'k' && |
clang::isUppercase(original_name[1])) |
@@ -168,7 +169,9 @@ bool GetNameForDecl(const clang::VarDecl& decl, |
name = CamelCaseToUnderscoreCase(original_name); |
} |
- if (decl.isStaticDataMember()) { |
+ // Static members end with _ just like other members, but constants should |
+ // not. |
+ if (!is_const && decl.isStaticDataMember()) { |
name += '_'; |
} |