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

Side by Side Diff: tools/clang/rewrite_to_chrome_style/tests/methods-expected.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++() { return *this; } 21 Task& operator++() { return *this; }
22 22
23 // Conversion functions should not be rewritten. 23 // Conversion functions should not be rewritten.
24 explicit operator int() const { return 42; } 24 explicit operator int() const { return 42; }
25
26 // These are special functions that we don't rename so that range-based
27 // for loops and STL things work.
28 void begin() {}
29 void end() {}
30 void rbegin() {}
31 void rend() {}
32 // The trace() method is used by Oilpan, we shouldn't rename it.
33 void trace() {}
34 };
35
36 class Other {
37 // Static begin/end/trace don't count, and should be renamed.
38 static void Begin() {}
39 static void End() {}
40 static void Trace() {}
25 }; 41 };
26 42
27 // Test that the actual method definition is also updated. 43 // Test that the actual method definition is also updated.
28 void Task::DoTheWork() { 44 void Task::DoTheWork() {
29 ReallyDoTheWork(); 45 ReallyDoTheWork();
30 } 46 }
31 47
32 } // namespace blink 48 } // namespace blink
33 49
34 namespace Moo { 50 namespace Moo {
(...skipping 12 matching lines...) Expand all
47 63
48 // Finally, test that method pointers are also updated. 64 // Finally, test that method pointers are also updated.
49 void F() { 65 void F() {
50 void (blink::Task::*p1)() = &blink::Task::DoTheWork; 66 void (blink::Task::*p1)() = &blink::Task::DoTheWork;
51 void (blink::Task::*p2)() = &BovineTask::DoTheWork; 67 void (blink::Task::*p2)() = &BovineTask::DoTheWork;
52 void (blink::Task::*p3)() = &blink::Task::ReallyDoTheWork; 68 void (blink::Task::*p3)() = &blink::Task::ReallyDoTheWork;
53 void (BovineTask::*p4)() = &BovineTask::ReallyDoTheWork; 69 void (BovineTask::*p4)() = &BovineTask::ReallyDoTheWork;
54 } 70 }
55 71
56 } // namespace Moo 72 } // namespace Moo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698