[PATCH] D91626: [clangd] Implement textDocument/implementation.

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 05:56:23 PST 2020


usaxena95 added inline comments.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:1153
+  Index->relations(Req, [&](const SymbolID &Subject, const Symbol &Object) {
+    if (auto Loc = symbolToLocation(Object, *MainFilePath))
+      Results.References.push_back(*Loc);
----------------
hokein wrote:
> `symbolToLocation` will prefer definition location over declaration location.
> 
> there are a few options:
> 
> 1) just return declaration location
> 2) just return definition location
> 3) return both
> 
> in the find-implementaiton case, I think the declaration location is more? interesting than the definition location, I would slightly prefer 1), what do you think?
You are right. I experienced this while playing with it in VSCode. Sorry to not explicitly mention this.
I too prefer declaration in such case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91626



More information about the cfe-commits mailing list