clang-rename: handle non-inline ctor definitions when renaming classes

The result of the test was C::D(), not D::D().

Reviewers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D20356

llvm-svn: 269952
This commit is contained in:
Miklos Vajna 2016-05-18 16:12:48 +00:00
parent a519cf593f
commit 5a6d2985d7
2 changed files with 20 additions and 0 deletions

View File

@ -79,6 +79,11 @@ public:
}
}
}
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;
}

View File

@ -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.