mirror of
https://github.com/intel/llvm.git
synced 2026-02-02 02:00:03 +08:00
When renaming a class, ename pointers to that class as well.
Patch by Miklos Vajna. llvm-svn: 268484
This commit is contained in:
@@ -45,6 +45,18 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VisitVarDecl(clang::VarDecl *Decl) {
|
||||
clang::QualType Type = Decl->getType();
|
||||
const clang::RecordDecl *RecordDecl = Type->getPointeeCXXRecordDecl();
|
||||
if (RecordDecl) {
|
||||
if (getUSRForDecl(RecordDecl) == USR) {
|
||||
// The declaration refers to a type that is to be renamed.
|
||||
LocationsFound.push_back(Decl->getTypeSpecStartLoc());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Expression visitors:
|
||||
|
||||
bool VisitDeclRefExpr(const DeclRefExpr *Expr) {
|
||||
|
||||
15
clang-tools-extra/test/clang-rename/ClassTest.cpp
Normal file
15
clang-tools-extra/test/clang-rename/ClassTest.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
class Cla // CHECK: class Hector
|
||||
{
|
||||
};
|
||||
// RUN: cat %s > %t.cpp
|
||||
// RUN: clang-rename -offset=6 -new-name=Hector %t.cpp -i --
|
||||
// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
|
||||
|
||||
int main()
|
||||
{
|
||||
Cla *Pointer = 0; // CHECK: Hector *Pointer = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Use grep -FUbo 'Cla' <file> to get the correct offset of Cla when changing
|
||||
// this file.
|
||||
Reference in New Issue
Block a user