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 3607731f3699aefa6ff2f897e5f272e4f838a26e..2166c228b5e6aa0460db684c74cee641ee5f47d4 100644 |
| --- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| +++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| @@ -375,6 +375,14 @@ bool GetNameForDecl(const clang::VarDecl& decl, |
| name[1] = clang::toUppercase(name[1]); |
| } else { |
| name = CamelCaseToUnderscoreCase(original_name); |
| + |
| + // Non-const variables with static storage duration at translation unit or |
|
danakj
2016/03/28 18:28:33
update this then
dcheng
2016/03/28 19:50:54
Done.
|
| + // namespace scope get prefixed with `g_' to reduce the likelihood of a |
| + // naming collision. |
| + const clang::DeclContext* decl_context = decl.getDeclContext(); |
| + if (name.find("g_") != 0 && decl.hasGlobalStorage() && |
| + decl_context->isNamespace()) |
|
danakj
2016/03/28 18:28:33
OK can you have global storage and not be isNamesp
dcheng
2016/03/28 19:50:54
Yeah, static locals inside functions.
danakj
2016/03/28 19:54:06
ooh, cool
|
| + name.insert(0, "g_"); |
| } |
| // Static members end with _ just like other members, but constants should |