summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-rename
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2014-08-17 18:00:59 +0000
committerManuel Klimek <klimek@google.com>2014-08-17 18:00:59 +0000
commitccf0d797242da0656896bc38e1f6b7303e7ab91a (patch)
treebfe41e056b7dcf363c2ae5aacaf435f0403c903d /clang-tools-extra/test/clang-rename
parentab73774c4771a7e310d403934d0c961eb0ad213b (diff)
downloadbcm5719-llvm-ccf0d797242da0656896bc38e1f6b7303e7ab91a.tar.gz
bcm5719-llvm-ccf0d797242da0656896bc38e1f6b7303e7ab91a.zip
First version of a clang-rename tool.
Summary: Note that this code is still grossly under-tested - the next steps will be to add significantly better test coverage. Patch by Matthew Plant. Test Plan: Reviewers: Subscribers: llvm-svn: 215839
Diffstat (limited to 'clang-tools-extra/test/clang-rename')
-rw-r--r--clang-tools-extra/test/clang-rename/VarTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-rename/VarTest.cpp b/clang-tools-extra/test/clang-rename/VarTest.cpp
new file mode 100644
index 00000000000..ecf2df4b023
--- /dev/null
+++ b/clang-tools-extra/test/clang-rename/VarTest.cpp
@@ -0,0 +1,24 @@
+namespace A {
+int foo; // CHECK: int hector;
+}
+int foo; // CHECK: int foo;
+int bar = foo; // CHECK: bar = foo;
+int baz = A::foo; // CHECK: baz = A::hector;
+void fun1() {
+ struct {
+ int foo; // CHECK: int foo;
+ } b = { 100 };
+ int foo = 100; // CHECK: int foo
+ baz = foo; // CHECK: baz = foo;
+ {
+ extern int foo; // CHECK: int foo;
+ baz = foo; // CHECK: baz = foo;
+ foo = A::foo + baz; // CHECK: foo = A::hector + baz;
+ A::foo = b.foo; // CHECK: A::hector = b.foo;
+ }
+ foo = b.foo; // CHECK: foo = b.foo;
+}
+// REQUIRES: shell
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=$(grep -FUbo 'foo;' %t.cpp | head -1 | cut -d: -f1) -new-name=hector %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
OpenPOWER on IntegriCloud