summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp10
-rw-r--r--tools/clang/rewrite_to_chrome_style/tests/enums-expected.cc5
-rw-r--r--tools/clang/rewrite_to_chrome_style/tests/enums-original.cc5
3 files changed, 20 insertions, 0 deletions
diff --git a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
index 6df3096..0cc6ce0 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -198,6 +198,16 @@ bool GetNameForDecl(const clang::EnumConstantDecl& decl,
std::string& name) {
StringRef original_name = decl.getName();
+ bool already_shouty = true;
+ for (char c : original_name) {
+ if (!clang::isUppercase(c) && !clang::isDigit(c) && c != '_') {
+ already_shouty = false;
+ break;
+ }
+ }
+ if (already_shouty)
+ return false;
+
name = CamelCaseToUnderscoreCase(original_name, true);
for (auto& c : name)
c = clang::toUppercase(c);
diff --git a/tools/clang/rewrite_to_chrome_style/tests/enums-expected.cc b/tools/clang/rewrite_to_chrome_style/tests/enums-expected.cc
index 8d8f2bd..1ecdea0 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/enums-expected.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/enums-expected.cc
@@ -31,6 +31,11 @@ class T {
};
};
+// Already SHOUT_CAPS, so the naming shouldn't change.
+enum AlreadyShouty {
+ ENABLE_DIRECTZ3000_SUPPORT_FOR_HL3E1,
+};
+
} // namespace blink
enum EnumOutsideNamespace {
diff --git a/tools/clang/rewrite_to_chrome_style/tests/enums-original.cc b/tools/clang/rewrite_to_chrome_style/tests/enums-original.cc
index b248290..000a41e 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/enums-original.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/enums-original.cc
@@ -31,6 +31,11 @@ class T {
};
};
+// Already SHOUT_CAPS, so the naming shouldn't change.
+enum AlreadyShouty {
+ ENABLE_DIRECTZ3000_SUPPORT_FOR_HL3E1,
+};
+
} // namespace blink
enum EnumOutsideNamespace {