[PATCH] D74829: [clang-rename] Add the USR of incomplete decl to the USRSet.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 07:57:59 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe6d0bad843c4: [clang-rename] Add the USR of incomplete decl to the USRSet. (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74829/new/
https://reviews.llvm.org/D74829
Files:
clang-tools-extra/clangd/unittests/RenameTests.cpp
clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
Index: clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
===================================================================
--- clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
+++ clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
@@ -126,12 +126,14 @@
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));
Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -202,6 +202,13 @@
}
)cpp",
+ // Incomplete class specializations
+ R"cpp(
+ template <typename T>
+ class [[Fo^o]] {};
+ void func([[Foo]]<int>);
+ )cpp",
+
// Template class instantiations.
R"cpp(
template <typename T>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74829.246468.patch
Type: text/x-patch
Size: 1368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200225/24c666a9/attachment-0001.bin>
More information about the cfe-commits
mailing list