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

Side by Side 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, 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 namespace blink { 5 namespace blink {
6 6
7 // Note: do not add any copy or move constructors to this class: doing so will 7 // Note: do not add any copy or move constructors to this class: doing so will
8 // break test coverage that we don't clobber the class name by trying to emit 8 // break test coverage that we don't clobber the class name by trying to emit
9 // replacements for synthesized functions. 9 // replacements for synthesized functions.
10 class C { 10 class C {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 char fourChars[4]; 59 char fourChars[4];
60 short twoShorts[2]; 60 short twoShorts[2];
61 int one_hopefully_four_byte_int; 61 int one_hopefully_four_byte_int;
62 int m_hasPrefix; 62 int m_hasPrefix;
63 }; 63 };
64 64
65 } // namespace blink 65 } // namespace blink
66 66
67 namespace WTF { 67 namespace WTF {
68 68
69 struct TypeTrait { 69 // We don't want to capitalize fields in type traits
70 // WTF has structs for things like type traits, which we don't want to 70 // (i.e. no |value| -> |kValue| rename is undesirable below).
71 // capitalize. 71 struct TypeTrait1 {
72 static const bool value = true; 72 static const bool value = true;
73 }; 73 };
74 74
75 // Some type traits are implemented as classes, not structs
76 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable).
77 template <typename T>
78 class TypeTrait2 {
79 public:
80 static const bool value = false;
81 };
82 template <>
83 class TypeTrait2<void> {
84 public:
85 static const bool value = false;
86 };
87
75 }; // namespace WTF 88 }; // namespace WTF
76 89
77 void F() { 90 void F() {
78 // Test that references to a static field are correctly rewritten. 91 // Test that references to a static field are correctly rewritten.
79 blink::C::instanceCount++; 92 blink::C::instanceCount++;
80 // Force instantiation of a copy constructor for blink::C to make sure field 93 // Force instantiation of a copy constructor for blink::C to make sure field
81 // initializers for synthesized functions don't cause weird rewrites. 94 // initializers for synthesized functions don't cause weird rewrites.
82 blink::C c; 95 blink::C c;
83 blink::C c2 = c; 96 blink::C c2 = c;
84 97
85 bool b = WTF::TypeTrait::value; 98 bool b1 = WTF::TypeTrait1::value;
99 bool b2 = WTF::TypeTrait2<void>::value;
86 } 100 }
OLDNEW
« 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