Skip to content

Commit

Permalink
[clangd] Avoid recursion on UnresolvedUsingValueDecl during semantic …
Browse files Browse the repository at this point in the history
…highlighting

Fixes clangd/clangd#1313

Differential Revision: https://reviews.llvm.org/D134827
  • Loading branch information
HighCommander4 committed Mar 19, 2023
1 parent 2538e55 commit 7138e75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/SemanticHighlighting.cpp
Expand Up @@ -156,7 +156,7 @@ std::optional<HighlightingKind> kindForDecl(const NamedDecl *D,
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;
Expand Down
Expand Up @@ -1045,7 +1045,15 @@ sizeof...($TemplateParameter[[Elements]]);
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.
Expand Down

0 comments on commit 7138e75

Please sign in to comment.