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

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

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

Powered by Google App Engine
This is Rietveld 408576698