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.
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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits