[PATCH] D153617: [clangd] Fix an assertion failure in NamedDecl::getName during the prepareRename
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 14 00:18:05 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5649b24c48ab: [clangd] Fix an assertion failure in NamedDecl::getName during the prepareRename (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153617/new/
https://reviews.llvm.org/D153617
Files:
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/unittests/RenameTests.cpp
Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -1129,6 +1129,15 @@
using ns::^foo;
)cpp",
"there are multiple symbols at the given location", !HeaderFile},
+
+ {R"cpp(
+ void test() {
+ // no crash
+ using namespace std;
+ int [[V^ar]];
+ }
+ )cpp",
+ nullptr, !HeaderFile},
};
for (const auto& Case : Cases) {
Index: clang-tools-extra/clangd/refactor/Rename.cpp
===================================================================
--- clang-tools-extra/clangd/refactor/Rename.cpp
+++ clang-tools-extra/clangd/refactor/Rename.cpp
@@ -332,7 +332,8 @@
return nullptr;
for (const auto &Child : DS->getDeclGroup())
if (const auto *ND = dyn_cast<NamedDecl>(Child))
- if (ND != &RenamedDecl && ND->getName() == Name)
+ if (ND != &RenamedDecl && ND->getDeclName().isIdentifier() &&
+ ND->getName() == Name)
return ND;
return nullptr;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153617.540293.patch
Type: text/x-patch
Size: 1174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230714/5d5eb423/attachment.bin>
More information about the cfe-commits
mailing list