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

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

Issue 2655943003: Rename references to type traits the same as we rename the traits. (Closed)
Patch Set: Created 3 years, 11 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // as in mojo. But their names are unique so we can globally treat them as 76 // as in mojo. But their names are unique so we can globally treat them as
77 // type traits for renaming. 77 // type traits for renaming.
78 struct GloballyKnownTraits { 78 struct GloballyKnownTraits {
79 static const bool safeToCompareToEmptyOrDeleted = false; 79 static const bool safeToCompareToEmptyOrDeleted = false;
80 }; 80 };
81 81
82 } // namespace not_blink 82 } // namespace not_blink
83 83
84 namespace WTF { 84 namespace WTF {
85 85
86 void testForTraits() {
87 bool a = blink::IsGarbageCollectedMixin::safeToCompareToEmptyOrDeleted;
88 bool b = not_blink::GloballyKnownTraits::safeToCompareToEmptyOrDeleted;
89 }
90
86 // We don't want to capitalize fields in type traits 91 // We don't want to capitalize fields in type traits
87 // (i.e. the |value| -> |kValue| rename is undesirable below). 92 // (i.e. the |value| -> |kValue| rename is undesirable below).
88 struct TypeTrait1 { 93 struct TypeTrait1 {
89 static const bool value = true; 94 static const bool value = true;
90 }; 95 };
91 96
92 // Some type traits are implemented as classes, not structs 97 // Some type traits are implemented as classes, not structs
93 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). 98 // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable).
94 // We should not perform a |value| -> |kValue| rename in the type trait below. 99 // We should not perform a |value| -> |kValue| rename in the type trait below.
95 template <typename T> 100 template <typename T>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Test that references to a static field are correctly rewritten. 180 // Test that references to a static field are correctly rewritten.
176 blink::C::instanceCount++; 181 blink::C::instanceCount++;
177 // Force instantiation of a copy constructor for blink::C to make sure field 182 // Force instantiation of a copy constructor for blink::C to make sure field
178 // initializers for synthesized functions don't cause weird rewrites. 183 // initializers for synthesized functions don't cause weird rewrites.
179 blink::C c; 184 blink::C c;
180 blink::C c2 = c; 185 blink::C c2 = c;
181 186
182 bool b1 = WTF::TypeTrait1::value; 187 bool b1 = WTF::TypeTrait1::value;
183 bool b2 = WTF::TypeTrait2<void>::value; 188 bool b2 = WTF::TypeTrait2<void>::value;
184 } 189 }
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