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

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

Issue 2276983002: Prepend "Get" to method name if method name conflicts with return type name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-style-partition-allocator-new-array-delete-array
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 #include "gen/thing.h" 5 #include "gen/thing.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 8
9 class InterfaceOutsideOfBlink { 9 class InterfaceOutsideOfBlink {
10 public: 10 public:
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void blinkVirtual() override {} 169 void blinkVirtual() override {}
170 }; 170 };
171 171
172 namespace blink { 172 namespace blink {
173 173
174 struct StructInBlink { 174 struct StructInBlink {
175 // Structs in blink should rename their methods to capitals. 175 // Structs in blink should rename their methods to capitals.
176 bool function() { return true; } 176 bool function() { return true; }
177 }; 177 };
178 178
179 class BitVector {
180 public:
181 class OutOfLineBits {};
182 enum Foo { Blah };
183 struct Bar {};
184
185 // Naive renaming will break the build, by leaving return type the same
186 // as method the name - to avoid this "Get" prefix needs to be prepended
187 // as suggested in https://crbug.com/582312#c17.
188 const OutOfLineBits* outOfLineBits() const { return nullptr; }
189 Foo foo() { return Blah; }
190 const Bar& bar() const { return m_bar; }
191
192 private:
193 Bar m_bar;
194 };
195
179 } // namespace blink 196 } // namespace blink
180 197
181 namespace WTF { 198 namespace WTF {
182 199
183 struct StructInWTF { 200 struct StructInWTF {
184 // Structs in WTF should rename their methods to capitals. 201 // Structs in WTF should rename their methods to capitals.
185 bool function() { return true; } 202 bool function() { return true; }
186 }; 203 };
187 204
188 } // namespace WTF 205 } // namespace WTF
189 206
190 void F2() { 207 void F2() {
191 blink::StructInBlink b; 208 blink::StructInBlink b;
192 b.function(); 209 b.function();
193 WTF::StructInWTF w; 210 WTF::StructInWTF w;
194 w.function(); 211 w.function();
195 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698