[PATCH] D87225: [clangd] When finding refs for a renaming alias, do not return refs to underlying decls

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 27 23:47:46 PDT 2020


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

thanks.



================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1147
+        getDeclAtPosition(AST, *CurLoc, Relations);
+    std::vector<const NamedDecl *> AdditionalDecls;
+    // If the results include a *non-renaming* alias, get its
----------------
nit: name it `NonrenamingAliasUnderlyingDecls`?


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1155
+          AdditionalDecls.push_back(AD);
+        break;
+      }
----------------
I think the `break` is not necessarily needed. In practice we should just have one non-renaming alias at the current position. If not, that probably means we likely have a bug, `break` seems to just hide the bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87225



More information about the cfe-commits mailing list