[PATCH] D20356: clang-rename: handle non-inline ctor definitions when renaming classes
Miklos Vajna via cfe-commits
cfe-commits at lists.llvm.org
Wed May 18 09:19:03 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269952: clang-rename: handle non-inline ctor definitions when renaming classes (authored by vmiklos).
Changed prior to commit:
http://reviews.llvm.org/D20356?vs=57582&id=57641#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20356
Files:
clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===================================================================
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -79,6 +79,11 @@
}
}
}
+
+ if (getUSRForDecl(ConstructorDecl) == USR) {
+ // This takes care of the class name part of a non-inline ctor definition.
+ LocationsFound.push_back(ConstructorDecl->getLocStart());
+ }
return true;
}
Index: clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
+++ clang-tools-extra/trunk/test/clang-rename/CtorDefTest.cpp
@@ -0,0 +1,15 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=133 -new-name=D %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class C
+{
+public:
+ C();
+};
+
+C::C() // CHECK: D::D()
+{
+}
+
+// Use grep -FUbo 'C' <file> to get the correct offset of foo when changing
+// this file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20356.57641.patch
Type: text/x-patch
Size: 1088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160518/60210967/attachment.bin>
More information about the cfe-commits
mailing list