diff options
| author | Miklos Vajna <vmiklos@vmiklos.hu> | 2016-06-06 19:40:12 +0000 |
|---|---|---|
| committer | Miklos Vajna <vmiklos@vmiklos.hu> | 2016-06-06 19:40:12 +0000 |
| commit | b54a26d19d8a4de6941d083c7c2692fbc3555513 (patch) | |
| tree | ea443a0dba7268d772468e08d7c44d0e76755992 /clang-tools-extra/clang-rename/USRLocFinder.cpp | |
| parent | 82c447823b81b21304a1872d1e01ab98fa9242b4 (diff) | |
| download | bcm5719-llvm-b54a26d19d8a4de6941d083c7c2692fbc3555513.tar.gz bcm5719-llvm-b54a26d19d8a4de6941d083c7c2692fbc3555513.zip | |
clang-rename: implement renaming of classes inside static_cast
"Derived" in static_cast<Derived&>(...) wasn't renamed, nor in its
pointer equivalent.
Reviewers: klimek
Differential Revision: http://reviews.llvm.org/D21012
llvm-svn: 271933
Diffstat (limited to 'clang-tools-extra/clang-rename/USRLocFinder.cpp')
| -rw-r--r-- | clang-tools-extra/clang-rename/USRLocFinder.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-rename/USRLocFinder.cpp b/clang-tools-extra/clang-rename/USRLocFinder.cpp index caf4f149009..be110f15276 100644 --- a/clang-tools-extra/clang-rename/USRLocFinder.cpp +++ b/clang-tools-extra/clang-rename/USRLocFinder.cpp @@ -123,6 +123,23 @@ public: return true; } + bool VisitCXXStaticCastExpr(clang::CXXStaticCastExpr *Expr) { + clang::QualType Type = Expr->getType(); + // See if this a cast of a pointer. + const RecordDecl* Decl = Type->getPointeeCXXRecordDecl(); + if (!Decl) { + // See if this is a cast of a reference. + Decl = Type->getAsCXXRecordDecl(); + } + + if (Decl && getUSRForDecl(Decl) == USR) { + SourceLocation Location = Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc(); + LocationsFound.push_back(Location); + } + + return true; + } + // Non-visitors: // \brief Returns a list of unique locations. Duplicate or overlapping |

