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

Side by Side Diff: tools/clang/rewrite_to_chrome_style/tests/methods-expected.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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void BlinkVirtual() override {} 165 void BlinkVirtual() override {}
166 }; 166 };
167 167
168 namespace blink { 168 namespace blink {
169 169
170 struct StructInBlink { 170 struct StructInBlink {
171 // Structs in blink should rename their methods to capitals. 171 // Structs in blink should rename their methods to capitals.
172 bool Function() { return true; } 172 bool Function() { return true; }
173 }; 173 };
174 174
175 class BitVector {
176 public:
177 class OutOfLineBits {};
178 enum Foo { kBlah };
179 struct Bar {};
180
181 // Naive renaming will break the build, by leaving return type the same
182 // as method the name - to avoid this "Get" prefix needs to be prepended
183 // as suggested in https://crbug.com/582312#c17.
184 const OutOfLineBits* GetOutOfLineBits() const { return nullptr; }
185 Foo GetFoo() { return kBlah; }
186 const Bar& GetBar() const { return bar_; }
187
188 private:
189 Bar bar_;
190 };
191
175 } // namespace blink 192 } // namespace blink
176 193
177 namespace WTF { 194 namespace WTF {
178 195
179 struct StructInWTF { 196 struct StructInWTF {
180 // Structs in WTF should rename their methods to capitals. 197 // Structs in WTF should rename their methods to capitals.
181 bool Function() { return true; } 198 bool Function() { return true; }
182 }; 199 };
183 200
184 } // namespace WTF 201 } // namespace WTF
185 202
186 void F2() { 203 void F2() {
187 blink::StructInBlink b; 204 blink::StructInBlink b;
188 b.Function(); 205 b.Function();
189 WTF::StructInWTF w; 206 WTF::StructInWTF w;
190 w.Function(); 207 w.Function();
191 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698