[PATCH] D134827: [clangd] Avoid recursion on UnresolvedUsingValueDecl during semantic highlighting
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 19 01:31:02 PDT 2023
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7138e75d1bb5: [clangd] Avoid recursion on UnresolvedUsingValueDecl during semantic… (authored by nridge).
Changed prior to commit:
https://reviews.llvm.org/D134827?vs=506359&id=506360#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134827/new/
https://reviews.llvm.org/D134827
Files:
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -1045,7 +1045,15 @@
auto $LocalVariable_def[[s]] = $Operator[[new]] $Class[[Foo]]$Bracket[[<]]$TemplateParameter[[T]]$Bracket[[>]]();
$Operator[[delete]] $LocalVariable[[s]];
}
- )cpp"};
+ )cpp",
+ // Recursive UsingValueDecl
+ R"cpp(
+ template <int> class $Class_def[[X]] {
+ template <int> class $Class_def[[Y]] {
+ using $Class[[Y]]<0>::$Unknown_dependentName[[xxx]];
+ };
+ };
+ )cpp"};
for (const auto &TestCase : TestCases)
// Mask off scope modifiers to keep the tests manageable.
// They're tested separately.
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===================================================================
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -156,7 +156,7 @@
return HighlightingKind::Concept;
if (const auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(D)) {
auto Targets = Resolver->resolveUsingValueDecl(UUVD);
- if (!Targets.empty()) {
+ if (!Targets.empty() && Targets[0] != UUVD) {
return kindForDecl(Targets[0], Resolver);
}
return HighlightingKind::Unknown;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134827.506360.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230319/64fd4ca8/attachment.bin>
More information about the cfe-commits
mailing list