summaryrefslogtreecommitdiff
path: root/test/clang-rename/DeclRefExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/clang-rename/DeclRefExpr.cpp')
-rw-r--r--test/clang-rename/DeclRefExpr.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/clang-rename/DeclRefExpr.cpp b/test/clang-rename/DeclRefExpr.cpp
new file mode 100644
index 0000000000000..6462862d82adf
--- /dev/null
+++ b/test/clang-rename/DeclRefExpr.cpp
@@ -0,0 +1,24 @@
+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>