vmiklos created this revision. vmiklos added reviewers: cfe-commits, klimek.
The result of the test was C::D(), not D::D(). http://reviews.llvm.org/D20356 Files: clang-rename/USRLocFinder.cpp test/clang-rename/CtorDefTest.cpp Index: test/clang-rename/CtorDefTest.cpp =================================================================== --- /dev/null +++ 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-rename/USRLocFinder.cpp =================================================================== --- clang-rename/USRLocFinder.cpp +++ 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: test/clang-rename/CtorDefTest.cpp =================================================================== --- /dev/null +++ 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-rename/USRLocFinder.cpp =================================================================== --- clang-rename/USRLocFinder.cpp +++ 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; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits