1 | #define NAMESPACE namespace A |
2 | NAMESPACE { |
3 | int Foo; /* Test 1 */ // CHECK: int Bar; |
4 | } |
5 | int Foo; // CHECK: int Foo; |
6 | int Qux = Foo; // CHECK: int Qux = Foo; |
7 | int Baz = A::Foo; /* Test 2 */ // CHECK: Baz = A::Bar; |
8 | void fun() { |
9 | struct { |
10 | int Foo; // CHECK: int Foo; |
11 | } b = {100}; |
12 | int Foo = 100; // CHECK: int Foo = 100; |
13 | Baz = Foo; // CHECK: Baz = Foo; |
14 | { |
15 | extern int Foo; // CHECK: extern int Foo; |
16 | Baz = Foo; // CHECK: Baz = Foo; |
17 | Foo = A::Foo /* Test 3 */ + Baz; // CHECK: Foo = A::Bar /* Test 3 */ + Baz; |
18 | A::Foo /* Test 4 */ = b.Foo; // CHECK: A::Bar /* Test 4 */ = b.Foo; |
19 | } |
20 | Foo = b.Foo; // Foo = b.Foo; |
21 | } |
22 | |
23 | // Test 1. |
24 | // RUN: clang-rename -offset=46 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s |
25 | // Test 2. |
26 | // RUN: clang-rename -offset=234 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s |
27 | // Test 3. |
28 | // RUN: clang-rename -offset=641 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s |
29 | // Test 4. |
30 | // RUN: clang-rename -offset=716 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s |
31 | |
32 | // To find offsets after modifying the file, use: |
33 | // grep -Ubo 'Foo.*' <file> |
34 | |