[PATCH] D140379: [clangd] Avoid triggering linkage computation for decl with unstable linkage in SymbolRelevanceSignals::computeASTSignals()
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 20 18:56:53 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6761ba7639a4: [clangd] Avoid triggering linkage computation for decl with unstable linkage in… (authored by nridge).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140379/new/
https://reviews.llvm.org/D140379
Files:
clang-tools-extra/clangd/Quality.cpp
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
Index: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -1100,6 +1100,21 @@
)cpp");
}
+TEST(CompletionTest, Issue1427Crash) {
+ // Need to provide main file signals to ensure that the branch in
+ // SymbolRelevanceSignals::computeASTSignals() that tries to
+ // compute a symbol ID is taken.
+ ASTSignals MainFileSignals;
+ CodeCompleteOptions Opts;
+ Opts.MainFileSignals = &MainFileSignals;
+ completions(R"cpp(
+ auto f = []() {
+ 1.0_^
+ };
+ )cpp",
+ {}, Opts);
+}
+
TEST(CompletionTest, BacktrackCrashes) {
// Sema calls code completion callbacks twice in these cases.
auto Results = completions(R"cpp(
Index: clang-tools-extra/clangd/Quality.cpp
===================================================================
--- clang-tools-extra/clangd/Quality.cpp
+++ clang-tools-extra/clangd/Quality.cpp
@@ -303,6 +303,8 @@
(SemaResult.Kind != CodeCompletionResult::RK_Pattern))
return;
if (const NamedDecl *ND = SemaResult.getDeclaration()) {
+ if (hasUnstableLinkage(ND))
+ return;
auto ID = getSymbolID(ND);
if (!ID)
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140379.484449.patch
Type: text/x-patch
Size: 1339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221221/82fb784e/attachment.bin>
More information about the cfe-commits
mailing list