summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-rename
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-rename')
-rw-r--r--clang-tools-extra/clang-rename/USRFinder.cpp4
-rw-r--r--clang-tools-extra/clang-rename/USRLocFinder.cpp7
2 files changed, 11 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-rename/USRFinder.cpp b/clang-tools-extra/clang-rename/USRFinder.cpp
index 7f26945c329..2589be18df0 100644
--- a/clang-tools-extra/clang-rename/USRFinder.cpp
+++ b/clang-tools-extra/clang-rename/USRFinder.cpp
@@ -77,6 +77,10 @@ public:
const auto TypeBeginLoc = Loc.getBeginLoc();
const auto TypeEndLoc = Lexer::getLocForEndOfToken(
TypeBeginLoc, 0, Context.getSourceManager(), Context.getLangOpts());
+ if (const auto *TemplateTypeParm =
+ dyn_cast<TemplateTypeParmType>(Loc.getType())) {
+ return setResult(TemplateTypeParm->getDecl(), TypeBeginLoc, TypeEndLoc);
+ }
return setResult(Loc.getType()->getAsCXXRecordDecl(), TypeBeginLoc,
TypeEndLoc);
}
diff --git a/clang-tools-extra/clang-rename/USRLocFinder.cpp b/clang-tools-extra/clang-rename/USRLocFinder.cpp
index 394569a4a7d..d3c64baf742 100644
--- a/clang-tools-extra/clang-rename/USRLocFinder.cpp
+++ b/clang-tools-extra/clang-rename/USRLocFinder.cpp
@@ -104,6 +104,13 @@ public:
USRSet.end()) {
checkAndAddLocation(Loc.getBeginLoc());
}
+ if (const auto *TemplateTypeParm =
+ dyn_cast<TemplateTypeParmType>(Loc.getType())) {
+ if (USRSet.find(getUSRForDecl(TemplateTypeParm->getDecl())) !=
+ USRSet.end()) {
+ checkAndAddLocation(Loc.getBeginLoc());
+ }
+ }
return true;
}
OpenPOWER on IntegriCloud