[PATCH] D155898: [clangd] Fix go-to-type target location

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 15:23:46 PDT 2023


sammccall created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Previously it'd ~always jump to the lexically first declaration, which was
often an unhelpful forward declaration.

- consult the index for definition and preferred declaration locations (query code shared with go-to-definition)
- when unwrapping to LSP, prefer definition to declaration This matches "go-to-definition", which is the most common go-to operation


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155898

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/XRefs.h
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155898.542703.patch
Type: text/x-patch
Size: 11244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230720/e710ab2e/attachment-0001.bin>


More information about the cfe-commits mailing list