Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 namespace blink { | |
| 6 | |
| 7 class Task { | |
| 8 public: | |
| 9 // Already style-compliant methods shouldn't change. | |
| 10 void OutputDebugString() {} | |
| 11 | |
| 12 // Tests that the declarations for methods are updated. | |
| 13 void doTheWork(); | |
| 14 virtual void reallyDoTheWork() = 0; | |
| 15 | |
| 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 | |
| 18 // written. | |
| 19 // TODO(dcheng): Add an explicit test for something like operator+. | |
| 20 }; | |
| 21 | |
| 22 // Test that the actual method definition is also updated. | |
| 23 void Task::doTheWork() { | |
| 24 reallyDoTheWork(); | |
| 25 } | |
| 26 | |
| 27 } // namespace blink | |
| 28 | |
| 29 namespace Moo { | |
| 30 | |
| 31 // Test that overrides from outside the Blink namespace are also updated. | |
| 32 class BovineTask : public blink::Task { | |
| 33 public: | |
| 34 void reallyDoTheWork() override; | |
| 35 }; | |
| 36 | |
| 37 void BovineTask::reallyDoTheWork() { | |
| 38 doTheWork(); | |
| 39 // Calls via an overridden method should also be updated. | |
| 40 reallyDoTheWork(); | |
| 41 } | |
| 42 | |
| 43 // Finally, test that method pointers are also updated. | |
| 44 void F() { | |
| 45 void (blink::Task::*p1)() = &BovineTask::doTheWork; | |
|
danakj
2016/01/06 22:09:40
maybe check blink::Task::doTheWork too?
dcheng
2016/01/08 01:41:11
Done.
| |
| 46 void (blink::Task::*p2)() = &blink::Task::reallyDoTheWork; | |
|
danakj
2016/01/06 22:09:40
and BovineTask::reallyDoTheWork?
dcheng
2016/01/08 01:41:11
Done.
| |
| 47 } | |
| 48 | |
| 49 } // namespace Moo | |
| OLD | NEW |