[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:27:07 PDT 2023


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:143
     auto Targets = Resolver->resolveUsingValueDecl(UUVD);
-    if (!Targets.empty()) {
+    if (!Targets.empty() && Targets[0] != UUVD) {
       return kindForDecl(Targets[0], Resolver);
----------------
sammccall wrote:
> This looks good+safe.
> 
> I wonder if the check should be moved inside resolveUsingValueDecl - having it resolve to itself seems unhelpful always.
> I wonder if the check should be moved inside resolveUsingValueDecl - having it resolve to itself seems unhelpful always.

I haven't done this because, as mentioned earlier, I think a fix for the mutually-recursive case will need to build on logic here rather than inside resolveUsingValueDecl.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134827/new/

https://reviews.llvm.org/D134827



More information about the cfe-commits mailing list