summaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp')
-rw-r--r--clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
index d966a5ef23c2..43dc32e158d3 100644
--- a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
+++ b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
@@ -126,15 +126,24 @@ private:
addUSRsOfCtorDtors(TemplateDecl->getTemplatedDecl());
}
- void addUSRsOfCtorDtors(const CXXRecordDecl *RecordDecl) {
- RecordDecl = RecordDecl->getDefinition();
+ void addUSRsOfCtorDtors(const CXXRecordDecl *RD) {
+ const auto* RecordDecl = RD->getDefinition();
// Skip if the CXXRecordDecl doesn't have definition.
- if (!RecordDecl)
+ if (!RecordDecl) {
+ USRSet.insert(getUSRForDecl(RD));
return;
+ }
for (const auto *CtorDecl : RecordDecl->ctors())
USRSet.insert(getUSRForDecl(CtorDecl));
+ // Add template constructor decls, they are not in ctors() unfortunately.
+ if (RecordDecl->hasUserDeclaredConstructor())
+ for (const auto *D : RecordDecl->decls())
+ if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
+ if (const auto *Ctor =
+ dyn_cast<CXXConstructorDecl>(FTD->getTemplatedDecl()))
+ USRSet.insert(getUSRForDecl(Ctor));
USRSet.insert(getUSRForDecl(RecordDecl->getDestructor()));
USRSet.insert(getUSRForDecl(RecordDecl));