summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-rename/Variable.cpp
blob: 02935bdb360e33b37f07bafbdb6030d6f41b63b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: cat %s > %t.cpp
// RUN: clang-rename -offset=148 -new-name=Bar %t.cpp -i --
// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s

namespace A {
int Foo;                // CHECK: int Bar;
}
int Foo;                // CHECK: int Foo;
int Qux = Foo;          // CHECK: int Qux = Foo;
int Baz = A::Foo;       // CHECK: Baz = A::Bar;
void fun() {
  struct {
    int Foo;            // CHECK: int Foo;
  } b = {100};
  int Foo = 100;        // CHECK: int Foo = 100;
  Baz = Foo;            // CHECK: Baz = Foo;
  {
    extern int Foo;     // CHECK: extern int Foo;
    Baz = Foo;          // CHECK: Baz = Foo;
    Foo = A::Foo + Baz; // CHECK: Foo = A::Bar + Baz;
    A::Foo = b.Foo;     // CHECK: A::Bar = b.Foo;
  }
  Foo = b.Foo;          // Foo = b.Foo;
}

// Use grep -FUbo 'Foo' <file> to get the correct offset of foo when changing
// this file.
OpenPOWER on IntegriCloud