Chromium Code Reviews| Index: tools/clang/rewrite_to_chrome_style/tests/template-expected.cc |
| diff --git a/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc b/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc |
| index a7f42051912159954aa9badeaa837a09954e55a9..439e6ef29633a9f00f0ba995601b541d3c59f96a 100644 |
| --- a/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc |
| +++ b/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc |
| @@ -2,6 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include <type_traits> |
| + |
| namespace not_blink { |
| void function(int x) {} |
| @@ -9,6 +11,7 @@ void function(int x) {} |
| class Class { |
| public: |
| void method() {} |
| + virtual void virtualMethod() {} |
| template <typename T> |
| void methodTemplate(T) {} |
| template <typename T> |
| @@ -18,6 +21,17 @@ class Class { |
| template <typename T> |
| void functionTemplate(T x) {} |
| +template <typename T = Class> |
| +void functionTemplate2() { |
| + T::staticMethodTemplate(123); |
| +} |
| + |
| +template <typename T = Class> |
| +class TemplatedClass { |
| + public: |
| + void anotherMethod() { T::staticMethodTemplate(123); } |
| +}; |
| + |
| } // not_blink |
| namespace blink { |
| @@ -180,4 +194,90 @@ void Foo() { |
| } // namespace test_unnamed_arg |
| +namespace cxx_dependend_scope_member_expr_testing { |
| + |
| +class PartitionAllocator { |
| + public: |
| + static void Method() {} |
| +}; |
| + |
| +template <typename Allocator = PartitionAllocator> |
| +class Vector { |
| + public: |
| + // https://crbug.com/582315: |Allocator::method| is a |
| + // CXXDependentScopeMemberExpr. |
| + void AnotherMethod() { |
| + if (std::is_class<Allocator>::value) // Shouldn't rename |value| |
| + Allocator::Method(); // Should rename |method| -> |Method|. |
| + } |
| +}; |
| + |
| +template <typename Allocator = PartitionAllocator> |
| +void Test() { |
| + // https://crbug.com/582315: |Allocator::method| is a |
| + // DependentScopeDeclRefExpr. |
| + if (std::is_class<Allocator>::value) // Shouldn't rename |value|. |
| + Allocator::Method(); // Should rename |method|. |
| +} |
| + |
| +class InterceptingCanvasBase : public ::not_blink::Class { |
| + public: |
| + virtual void VirtualMethodInBlink(){}; |
| +}; |
| + |
| +template <typename DerivedCanvas> |
| +class InterceptingCanvas : public InterceptingCanvasBase { |
| + public: |
| + void virtualMethod() override { |
| + this->Class::virtualMethod(); // https://crbug.com/582315#c19 |
| + this->InterceptingCanvasBase::VirtualMethodInBlink(); |
| + } |
| +}; |
| + |
| +template <typename T> |
| +class ThreadSpecific { |
| + public: |
| + T* operator->(); |
| + operator T*(); |
| +}; |
| + |
| +template <typename T> |
| +inline ThreadSpecific<T>::operator T*() { |
| + return nullptr; |
| +} |
| + |
| +template <typename T> |
| +inline T* ThreadSpecific<T>::operator->() { |
| + return operator T*(); |
| +} |
| + |
| +class Class { |
| + public: |
| + virtual void VirtualMethodInBlink() {} |
| +}; |
| + |
| +} // namespace cxx_dependend_scope_member_expr_testing |
| + |
| } // namespace blink |
| + |
| +namespace not_blink { |
| + |
| +namespace cxx_dependend_scope_member_expr_testing { |
|
dcheng
2016/12/01 07:15:06
Nit: dependent?
Łukasz Anforowicz
2016/12/01 18:26:57
Ooops. Done. :-)
|
| + |
| +class Base : public ::blink::cxx_dependend_scope_member_expr_testing::Class { |
| + public: |
| + virtual void virtualMethod() {} |
| +}; |
| + |
| +template <typename T> |
| +class Derived : public Base { |
| + public: |
| + void virtualMethod() override { |
| + this->Class::VirtualMethodInBlink(); |
| + this->Base::virtualMethod(); |
| + } |
| +}; |
| + |
| +} // namespace cxx_dependend_scope_member_expr_testing |
| + |
| +} // namespace not_blink |