[PATCH] D77811: [clangd] Implement semanticTokens modifiers
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 5 00:58:28 PST 2021
nridge added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:476
+ if (!Kind || (Result && Kind != Result))
+ continue;
+ Result = Kind;
----------------
nridge wrote:
> This is a change of behaviour from before, in the case where the `ReferenceLoc` has multiple targets.
>
> Before, we would produce at most one highlighting token for the `ReferenceLoc`. In the case where different target decls had different highlighting kinds, we wouldn't produce any.
>
> Now, it looks like we produce a separate token for every target whose kind matches the kind of the first target (and skip targets with a conflicting kind).
>
> Is that the intention?
>
> It seems a bit strange: if we allow multiple tokens, why couldn't they have different kinds?
Thinking more about this, the behaviour may actually be reasonable as written.
* Tokens with different kinds would get discarded via `resolveConflict()`.
* Multiple tokens with the same kind are potentially useful because they may have different modifiers, and the modifiers are then merged in `resolveConflict()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77811/new/
https://reviews.llvm.org/D77811
More information about the cfe-commits
mailing list