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

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

Issue 2569783002: When prepending "Get" to accessors, consider inheritance chain. (Closed)
Patch Set: Added test for non-virtual method scenario. Created 4 years 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 Foo GetFoo() { return kBlah; } 182 Foo GetFoo() { return kBlah; }
183 const Bar& GetBar() const { return bar_; } 183 const Bar& GetBar() const { return bar_; }
184 MyRefPtr<Baz> GetBaz() { return MyRefPtr<Baz>(); } 184 MyRefPtr<Baz> GetBaz() { return MyRefPtr<Baz>(); }
185 const MyRefPtr<FooBar>& GetFooBar() { return foobar_; } 185 const MyRefPtr<FooBar>& GetFooBar() { return foobar_; }
186 186
187 private: 187 private:
188 Bar bar_; 188 Bar bar_;
189 MyRefPtr<FooBar> foobar_; 189 MyRefPtr<FooBar> foobar_;
190 }; 190 };
191 191
192 namespace get_prefix_vs_inheritance {
193
194 // Regression test for https://crbug.com/673031:
195 // 1. |frame| accessor/method should be renamed in the same way for
196 // WebFrameImplBase and WebLocalFrameImpl.
197 // 2. Need to rename |frame| to |GetFrame| (not to |Frame|) to avoid
198 // a conflict with the Frame type.
199
200 class Frame {};
201 class LocalFrame : public Frame {};
202
203 class WebFrameImplBase {
204 public:
205 virtual Frame* GetFrame() const = 0;
206 };
207
208 class WebLocalFrameImpl : public WebFrameImplBase {
209 public:
210 LocalFrame* GetFrame() const override { return nullptr; }
211 };
212
213 // This is also a regression test for https://crbug.com/673031
214 // (which can happen in a non-virtual-method case):
215 class LayoutObject {};
216 class LayoutBoxModelObject : public LayoutObject {};
217 class PaintLayerStackingNode {
218 public:
219 // |layoutObject| should be renamed to |GetLayoutObject|.
220 LayoutBoxModelObject* GetLayoutObject() { return nullptr; }
221 };
222
223 } // namespace get_prefix_vs_inheritance
224
192 } // namespace blink 225 } // namespace blink
193 226
194 namespace WTF { 227 namespace WTF {
195 228
196 struct StructInWTF { 229 struct StructInWTF {
197 // Structs in WTF should rename their methods to capitals. 230 // Structs in WTF should rename their methods to capitals.
198 bool Function() { return true; } 231 bool Function() { return true; }
199 }; 232 };
200 233
201 } // namespace WTF 234 } // namespace WTF
(...skipping 19 matching lines...) Expand all
221 static void Method(); 254 static void Method();
222 }; 255 };
223 256
224 } // namespace internal 257 } // namespace internal
225 258
226 } // namespace blink 259 } // namespace blink
227 260
228 // https://crbug.com/640688 - need to rewrite method name below. 261 // https://crbug.com/640688 - need to rewrite method name below.
229 void blink::ClassDeclaredInsideBlink::MethodDefinedOutsideBlink() {} 262 void blink::ClassDeclaredInsideBlink::MethodDefinedOutsideBlink() {}
230 void blink::internal::InternalClass::Method() {} 263 void blink::internal::InternalClass::Method() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698