OLD | NEW |
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 // TODO(dcheng): Add an explicit test for something like operator+. | 19 |
| 20 // Overloaded operators should not be rewritten. |
| 21 Task& operator++() { return *this; } |
| 22 |
| 23 // Conversion functions should not be rewritten. |
| 24 explicit operator int() const { return 42; } |
20 }; | 25 }; |
21 | 26 |
22 // Test that the actual method definition is also updated. | 27 // Test that the actual method definition is also updated. |
23 void Task::DoTheWork() { | 28 void Task::DoTheWork() { |
24 ReallyDoTheWork(); | 29 ReallyDoTheWork(); |
25 } | 30 } |
26 | 31 |
27 } // namespace blink | 32 } // namespace blink |
28 | 33 |
29 namespace Moo { | 34 namespace Moo { |
(...skipping 12 matching lines...) Expand all Loading... |
42 | 47 |
43 // Finally, test that method pointers are also updated. | 48 // Finally, test that method pointers are also updated. |
44 void F() { | 49 void F() { |
45 void (blink::Task::*p1)() = &blink::Task::DoTheWork; | 50 void (blink::Task::*p1)() = &blink::Task::DoTheWork; |
46 void (blink::Task::*p2)() = &BovineTask::DoTheWork; | 51 void (blink::Task::*p2)() = &BovineTask::DoTheWork; |
47 void (blink::Task::*p3)() = &blink::Task::ReallyDoTheWork; | 52 void (blink::Task::*p3)() = &blink::Task::ReallyDoTheWork; |
48 void (BovineTask::*p4)() = &BovineTask::ReallyDoTheWork; | 53 void (BovineTask::*p4)() = &BovineTask::ReallyDoTheWork; |
49 } | 54 } |
50 | 55 |
51 } // namespace Moo | 56 } // namespace Moo |
OLD | NEW |