[PATCH] D133982: [clangd] Improve inlay hints of things expanded from macros

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 15:48:33 PDT 2022


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

When we aim a hint at some expanded tokens, we're only willing to attach it
to spelled tokens that exactly corresponde.

e.g.
int zoom(int x, int y, int z);
int dummy = zoom(NUMBERS);

Here we want to place a hint "x:" on the expanded "1", but we shouldn't
be willing to place it on NUMBERS, because it doesn't *exactly*
correspond (it has more tokens).

Fortunately we don't even have to implement this algorithm from scratch,
TokenBuffer has it.

Fixes https://github.com/clangd/clangd/issues/1289
Fixes https://github.com/clangd/clangd/issues/1118
Fixes https://github.com/clangd/clangd/issues/1018


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133982

Files:
  clang-tools-extra/clangd/InlayHints.cpp
  clang-tools-extra/clangd/unittests/InlayHintTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133982.460521.patch
Type: text/x-patch
Size: 6045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220915/2c5523b2/attachment.bin>


More information about the cfe-commits mailing list