Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / clang-rename / TemplateClassInstantiation.cpp
blob493d0951df57b99327358033eda5c5eb80503a6c
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;
11 static void foo(T value) {}
12 T member;
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();
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);
27 Foo<bool> b; // CHECK: Bar<bool> b;
28 b.member = false;
29 Foo<bool>::foo(false); // CHECK: Bar<bool>::foo(false);
31 return 0;
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
41 // To find offsets after modifying the file, use:
42 // grep -Ubo 'Foo.*' <file>