blob: 992c96bd20bb085211852731a5e8c77facc0cb80 [file] [log] [blame]
Kirill Bobyrevee99fd12016-07-15 12:22:38 +00001namespace A {
Kirill Bobyrev77f522c2016-08-10 13:28:30 +00002int Foo; /* Test 1 */ // CHECK: int Bar;
Kirill Bobyrevee99fd12016-07-15 12:22:38 +00003}
Kirill Bobyrev77f522c2016-08-10 13:28:30 +00004int Foo; // CHECK: int Foo;
5int Qux = Foo; // CHECK: int Qux = Foo;
6int Baz = A::Foo; /* Test 2 */ // CHECK: Baz = A::Bar;
Kirill Bobyrevee99fd12016-07-15 12:22:38 +00007void fun() {
8 struct {
Kirill Bobyrev77f522c2016-08-10 13:28:30 +00009 int Foo; // CHECK: int Foo;
Kirill Bobyrevee99fd12016-07-15 12:22:38 +000010 } b = {100};
Kirill Bobyrev77f522c2016-08-10 13:28:30 +000011 int Foo = 100; // CHECK: int Foo = 100;
12 Baz = Foo; // CHECK: Baz = Foo;
Kirill Bobyrevee99fd12016-07-15 12:22:38 +000013 {
Kirill Bobyrev77f522c2016-08-10 13:28:30 +000014 extern int Foo; // CHECK: extern int Foo;
15 Baz = Foo; // CHECK: Baz = Foo;
16 Foo = A::Foo /* Test 3 */ + Baz; // CHECK: Foo = A::Bar /* Test 3 */ + Baz;
17 A::Foo /* Test 4 */ = b.Foo; // CHECK: A::Bar /* Test 4 */ = b.Foo;
Kirill Bobyrevee99fd12016-07-15 12:22:38 +000018 }
Kirill Bobyrev77f522c2016-08-10 13:28:30 +000019 Foo = b.Foo; // Foo = b.Foo;
Kirill Bobyrevee99fd12016-07-15 12:22:38 +000020}
21
Kirill Bobyrev77f522c2016-08-10 13:28:30 +000022// Test 1.
23// RUN: clang-rename -offset=18 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
24// Test 2.
25// RUN: clang-rename -offset=206 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
26// Test 3.
27// RUN: clang-rename -offset=613 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
28// Test 4.
29// RUN: clang-rename -offset=688 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
30
31// To find offsets after modifying the file, use:
32// grep -Ubo 'Foo.*' <file>