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

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

Issue 2307643002: Account for the fact that some type traits have static methods. (Closed)
Patch Set: 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
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 class TypeTrait2 { 86 class TypeTrait2 {
87 public: 87 public:
88 static const bool value = false; 88 static const bool value = false;
89 }; 89 };
90 template <> 90 template <>
91 class TypeTrait2<void> { 91 class TypeTrait2<void> {
92 public: 92 public:
93 static const bool value = false; 93 static const bool value = false;
94 }; 94 };
95 95
96 template <typename T, typename U>
dcheng 2016/09/01 21:04:22 Please add some comments to this test (e.g. what s
Łukasz Anforowicz 2016/09/01 21:39:45 Done.
97 struct IsSubclass {
98 private:
99 typedef char YesType;
100 struct NoType {
101 char padding[8];
102 };
103
104 static YesType SubclassCheck(U*);
105 static NoType SubclassCheck(...);
106 static T* t_;
107
108 public:
109 static const bool value = sizeof(SubclassCheck(t_)) == sizeof(YesType);
110 };
111
112 template <typename U = void>
113 struct IsTraceableInCollection {
114 // Expanded from STATIC_ONLY(IsTraceableInCollection):
115 private:
116 IsTraceableInCollection() = delete;
117 IsTraceableInCollection(const IsTraceableInCollection&) = delete;
118 IsTraceableInCollection& operator=(const IsTraceableInCollection&) = delete;
119 void* operator new(unsigned long) = delete;
120 void* operator new(unsigned long, void*) = delete;
121
122 public:
123 static const bool value = true;
124 };
125
96 }; // namespace WTF 126 }; // namespace WTF
97 127
98 void F() { 128 void F() {
99 // Test that references to a static field are correctly rewritten. 129 // Test that references to a static field are correctly rewritten.
100 blink::C::instance_count_++; 130 blink::C::instance_count_++;
101 // Force instantiation of a copy constructor for blink::C to make sure field 131 // Force instantiation of a copy constructor for blink::C to make sure field
102 // initializers for synthesized functions don't cause weird rewrites. 132 // initializers for synthesized functions don't cause weird rewrites.
103 blink::C c; 133 blink::C c;
104 blink::C c2 = c; 134 blink::C c2 = c;
105 135
106 bool b1 = WTF::TypeTrait1::value; 136 bool b1 = WTF::TypeTrait1::value;
107 bool b2 = WTF::TypeTrait2<void>::value; 137 bool b2 = WTF::TypeTrait2<void>::value;
108 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698