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 |
| index b2d9381d24abcf6eb6b3ab1bd462f225bce9da47..b2e48440106ddfc726f754c4b4362f32a70ffb66 100644 |
| --- a/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc |
| +++ b/tools/clang/rewrite_to_chrome_style/tests/methods-original.cc |
| @@ -4,6 +4,9 @@ |
| namespace blink { |
| +class MyIterator {}; |
| +using my_iterator = MyIterator; |
| + |
| class Task { |
| public: |
| // Already style-compliant methods shouldn't change. |
| @@ -32,10 +35,10 @@ class Task { |
| // These are special functions that we don't rename so that range-based |
| // for loops and STL things work. |
| - void begin() {} |
| - void end() {} |
| - void rbegin() {} |
| - void rend() {} |
| + MyIterator begin() {} |
| + my_iterator end() {} |
| + my_iterator rbegin() {} |
| + MyIterator rend() {} |
| // The trace() method is used by Oilpan, we shouldn't rename it. |
| void trace() {} |
| // These are used by std::unique_lock and std::lock_guard. |
| @@ -46,12 +49,20 @@ class Task { |
| class Other { |
| // Static begin/end/trace don't count, and should be renamed. |
| - static void begin() {} |
| - static void end() {} |
| + static MyIterator begin() {} |
| + static my_iterator end() {} |
| static void trace() {} |
| static void lock() {} |
| }; |
| +class NonIterators { |
| + // begin()/end() and friends are only renamed if they return an iterator. |
|
dcheng
2016/03/01 23:58:03
don't
danakj
2016/03/02 00:32:12
Done.
|
| + void begin() {} |
| + int end() { return 0; } |
| + void rbegin() {} |
| + int rend() { return 0; } |
| +}; |
| + |
| // Test that the actual method definition is also updated. |
| void Task::doTheWork() { |
| reallyDoTheWork(); |
| @@ -84,3 +95,28 @@ void F() { |
| void (blink::Task::*p3)() = &blink::Task::reallyDoTheWork; |
| void (BovineTask::*p4)() = &BovineTask::reallyDoTheWork; |
| } |
| + |
| +namespace blink { |
| + |
| +struct StructInBlink { |
| + // Structs in blink should rename their methods to capitals. |
| + bool function() { return true; } |
| +}; |
| + |
| +} // namespace blink |
| + |
| +namespace WTF { |
| + |
| +struct StructInWTF { |
| + // Structs in WTF should rename their methods to capitals. |
| + bool function() { return true; } |
| +}; |
| + |
| +} // namespace WTF |
| + |
| +void F2() { |
| + blink::StructInBlink b; |
| + b.function(); |
| + WTF::StructInWTF w; |
| + w.function(); |
| +} |