Chromium Code Reviews| Index: tools/clang/rewrite_to_chrome_style/tests/methods-original.cc |
| diff --git a/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc b/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..30393e640670f13a52a5595a430b470f4e747809 |
| --- /dev/null |
| +++ b/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +namespace blink { |
| + |
| +class Task { |
| + public: |
| + // Already style-compliant methods shouldn't change. |
| + void OutputDebugString() {} |
| + |
| + // Tests that the declarations for methods are updated. |
| + void doTheWork(); |
| + virtual void reallyDoTheWork() = 0; |
| + |
| + // Note: this is purposely copyable and assignable, to make sure the Clang |
| + // tool doesn't try to emit replacements for things that aren't explicitly |
| + // written. |
| + // TODO(dcheng): Add an explicit test for something like operator+. |
| +}; |
| + |
| +// Test that the actual method definition is also updated. |
| +void Task::doTheWork() { |
| + reallyDoTheWork(); |
| +} |
| + |
| +} // namespace blink |
| + |
| +namespace Moo { |
| + |
| +// Test that overrides from outside the Blink namespace are also updated. |
| +class BovineTask : public blink::Task { |
| + public: |
| + void reallyDoTheWork() override; |
| +}; |
| + |
| +void BovineTask::reallyDoTheWork() { |
| + doTheWork(); |
| + // Calls via an overridden method should also be updated. |
| + reallyDoTheWork(); |
| +} |
| + |
| +// Finally, test that method pointers are also updated. |
| +void F() { |
| + 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.
|
| + 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.
|
| +} |
| + |
| +} // namespace Moo |