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

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

Issue 1647763002: rewrite_to_chrome_style: Don't rename begin()/end()/rbegin()/rend(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rewrite-begin-end: . Created 4 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 class Task { 7 class Task {
8 public: 8 public:
9 // Already style-compliant methods shouldn't change. 9 // Already style-compliant methods shouldn't change.
10 void OutputDebugString() {} 10 void OutputDebugString() {}
11 11
12 // Tests that the declarations for methods are updated. 12 // Tests that the declarations for methods are updated.
13 void doTheWork(); 13 void doTheWork();
14 virtual void reallyDoTheWork() = 0; 14 virtual void reallyDoTheWork() = 0;
15 15
16 // Note: this is purposely copyable and assignable, to make sure the Clang 16 // Note: this is purposely copyable and assignable, to make sure the Clang
17 // tool doesn't try to emit replacements for things that aren't explicitly 17 // tool doesn't try to emit replacements for things that aren't explicitly
18 // written. 18 // written.
19 19
20 // Overloaded operators should not be rewritten. 20 // Overloaded operators should not be rewritten.
21 Task& operator++() { 21 Task& operator++() {
22 return *this; 22 return *this;
23 } 23 }
24 24
25 // Conversion functions should not be rewritten. 25 // Conversion functions should not be rewritten.
26 explicit operator int() const { 26 explicit operator int() const {
27 return 42; 27 return 42;
28 } 28 }
29
30 // These are special functions that we don't rename so that range-based
31 // for loops and STL things work.
32 void begin() {}
33 void end() {}
34 void rbegin() {}
35 void rend() {}
36 // The trace() method is used by Oilpan, we shouldn't rename it.
37 void trace() {}
38 };
39
40 class Other {
41 // Static begin/end/trace don't count, and should be renamed.
42 static void begin() {}
43 static void end() {}
44 static void trace() {}
29 }; 45 };
30 46
31 // Test that the actual method definition is also updated. 47 // Test that the actual method definition is also updated.
32 void Task::doTheWork() { 48 void Task::doTheWork() {
33 reallyDoTheWork(); 49 reallyDoTheWork();
34 } 50 }
35 51
36 } // namespace blink 52 } // namespace blink
37 53
38 namespace Moo { 54 namespace Moo {
(...skipping 12 matching lines...) Expand all
51 67
52 // Finally, test that method pointers are also updated. 68 // Finally, test that method pointers are also updated.
53 void F() { 69 void F() {
54 void (blink::Task::*p1)() = &blink::Task::doTheWork; 70 void (blink::Task::*p1)() = &blink::Task::doTheWork;
55 void (blink::Task::*p2)() = &BovineTask::doTheWork; 71 void (blink::Task::*p2)() = &BovineTask::doTheWork;
56 void (blink::Task::*p3)() = &blink::Task::reallyDoTheWork; 72 void (blink::Task::*p3)() = &blink::Task::reallyDoTheWork;
57 void (BovineTask::*p4)() = &BovineTask::reallyDoTheWork; 73 void (BovineTask::*p4)() = &BovineTask::reallyDoTheWork;
58 } 74 }
59 75
60 } // namespace Moo 76 } // namespace Moo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698