teak-llvm/clang/test/clang-rename/DeclRefExpr.cpp
Alex Lorenz 4abbd92bf4 [refactor] Move clang-rename into the clang repository
The core engine of clang-rename will be used for local and global renames in the
new refactoring engine, as mentioned in
http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html.

The clang-rename tool is still supported but might get deprecated in the future.

Differential Revision: https://reviews.llvm.org/D34696

llvm-svn: 306840
2017-06-30 16:36:09 +00:00

25 lines
699 B
C++

class C {
public:
static int Foo; /* Test 1 */ // CHECK: static int Bar;
};
int foo(int x) { return 0; }
#define MACRO(a) foo(a)
int main() {
C::Foo = 1; /* Test 2 */ // CHECK: C::Bar = 1;
MACRO(C::Foo); // CHECK: MACRO(C::Bar);
int y = C::Foo; /* Test 3 */ // CHECK: int y = C::Bar;
return 0;
}
// Test 1.
// RUN: clang-rename -offset=31 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
// Test 2.
// RUN: clang-rename -offset=152 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
// Test 3.
// RUN: clang-rename -offset=271 -new-name=Bar %s -- | sed 's,//.*,,' | FileCheck %s
// To find offsets after modifying the file, use:
// grep -Ubo 'Foo.*' <file>