Clang Project

clang_source_code/test/clang-rename/DeclRefExpr.cpp
1class C {
2public:
3  static int Foo; /* Test 1 */  // CHECK: static int Bar;
4};
5
6int foo(int x) { return 0; }
7#define MACRO(a) foo(a)
8
9int main() {
10  C::Foo = 1;     /* Test 2 */  // CHECK: C::Bar = 1;
11  MACRO(C::Foo);                // CHECK: MACRO(C::Bar);
12  int y = C::Foo; /* Test 3 */  // CHECK: int y = C::Bar;
13  return 0;
14}
15
16// Test 1.
17// RUN: clang-rename -offset=31 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
18// Test 2.
19// RUN: clang-rename -offset=152 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
20// Test 3.
21// RUN: clang-rename -offset=271 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
22
23// To find offsets after modifying the file, use:
24//   grep -Ubo 'Foo.*' <file>
25