1 | template <typename T> |
2 | class Foo { /* Test 1 */ // CHECK: class Bar { /* Test 1 */ |
3 | public: |
4 | T foo(T arg, T& ref, T* ptr) { |
5 | T value; |
6 | int number = 42; |
7 | value = (T)number; |
8 | value = static_cast<T>(number); |
9 | return value; |
10 | } |
11 | static void foo(T value) {} |
12 | T member; |
13 | }; |
14 | |
15 | template <typename T> |
16 | void func() { |
17 | Foo<T> obj; /* Test 2 */ // CHECK: Bar<T> obj; |
18 | obj.member = T(); |
19 | Foo<T>::foo(); // CHECK: Bar<T>::foo(); |
20 | } |
21 | |
22 | int main() { |
23 | Foo<int> i; /* Test 3 */ // CHECK: Bar<int> i; |
24 | i.member = 0; |
25 | Foo<int>::foo(0); // CHECK: Bar<int>::foo(0); |
26 | |
27 | Foo<bool> b; // CHECK: Bar<bool> b; |
28 | b.member = false; |
29 | Foo<bool>::foo(false); // CHECK: Bar<bool>::foo(false); |
30 | |
31 | return 0; |
32 | } |
33 | |
34 | // Test 1. |
35 | // RUN: clang-rename -offset=29 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s |
36 | // Test 2. |
37 | // RUN: clang-rename -offset=324 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s |
38 | // Test 3. |
39 | // RUN: clang-rename -offset=463 -new-name=Bar %s -- -fno-delayed-template-parsing | sed 's,//.*,,' | FileCheck %s |
40 | |
41 | // To find offsets after modifying the file, use: |
42 | // grep -Ubo 'Foo.*' <file> |
43 | |