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

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: not-static-methods 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 };
33
34 class Other {
35 // Static begin/end don't count, and should be renamed.
36 static void Begin() {}
37 static void End() {}
25 }; 38 };
26 39
27 // Test that the actual method definition is also updated. 40 // Test that the actual method definition is also updated.
28 void Task::DoTheWork() { 41 void Task::DoTheWork() {
29 ReallyDoTheWork(); 42 ReallyDoTheWork();
30 } 43 }
31 44
32 } // namespace blink 45 } // namespace blink
33 46
34 namespace Moo { 47 namespace Moo {
(...skipping 12 matching lines...) Expand all
47 60
48 // Finally, test that method pointers are also updated. 61 // Finally, test that method pointers are also updated.
49 void F() { 62 void F() {
50 void (blink::Task::*p1)() = &blink::Task::DoTheWork; 63 void (blink::Task::*p1)() = &blink::Task::DoTheWork;
51 void (blink::Task::*p2)() = &BovineTask::DoTheWork; 64 void (blink::Task::*p2)() = &BovineTask::DoTheWork;
52 void (blink::Task::*p3)() = &blink::Task::ReallyDoTheWork; 65 void (blink::Task::*p3)() = &blink::Task::ReallyDoTheWork;
53 void (BovineTask::*p4)() = &BovineTask::ReallyDoTheWork; 66 void (BovineTask::*p4)() = &BovineTask::ReallyDoTheWork;
54 } 67 }
55 68
56 } // namespace Moo 69 } // namespace Moo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698