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

Unified Diff: tools/clang/rewrite_to_chrome_style/tests/fields-original.cc

Issue 2276813003: Improve accuracy of detecting type trait fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-style-definition-outside-of-namespace-node
Patch Set: Moving part of a matcher into a separate |is_wtf_type_trait_value| variable. Created 4 years, 4 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
« no previous file with comments | « tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
diff --git a/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc b/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
index 183be2bfdce5a15600fdef407ce3b1b1427e918d..05b75a7a3b7b1b8e81eb0c28b0623fbe294d6e57 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
@@ -66,12 +66,25 @@ union U {
namespace WTF {
-struct TypeTrait {
- // WTF has structs for things like type traits, which we don't want to
- // capitalize.
+// We don't want to capitalize fields in type traits
+// (i.e. no |value| -> |kValue| rename is undesirable below).
+struct TypeTrait1 {
static const bool value = true;
};
+// Some type traits are implemented as classes, not structs
+// (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable).
+template <typename T>
+class TypeTrait2 {
+ public:
+ static const bool value = false;
+};
+template <>
+class TypeTrait2<void> {
+ public:
+ static const bool value = false;
+};
+
}; // namespace WTF
void F() {
@@ -82,5 +95,6 @@ void F() {
blink::C c;
blink::C c2 = c;
- bool b = WTF::TypeTrait::value;
+ bool b1 = WTF::TypeTrait1::value;
+ bool b2 = WTF::TypeTrait2<void>::value;
}
« no previous file with comments | « tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698