[PATCH] D76896: [clangd] Color dependent names based on their heuristic target if they have one
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 21:45:33 PDT 2020
nridge added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:157
+resolveConflict(ArrayRef<HighlightingToken> Tokens) {
+ if (Tokens.size() != 2)
+ return llvm::None;
----------------
sammccall wrote:
> why a limit of 2, vs a loop?
I'm not aware of a scenario where we'd get more than two conflicting highlightings, except when macros are involved in which case we don't have a good way to disambiguate anyways.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:211
NonConflicting.push_back(TokRef.front());
+ else if (auto Resolved = resolveConflict(Conflicting))
+ NonConflicting.push_back(*Resolved);
----------------
sammccall wrote:
> out of curiosity, *why* is the same token being highlighted as dependentname and resolved? Is it being traversed twice?
It's for the reason you described in [this comment](https://github.com/clangd/clangd/issues/297#issuecomment-593736036): the resolved highlighting comes from `findExplicitReferences()`, and the dependent one form `CollectExtraHighlightings`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76896/new/
https://reviews.llvm.org/D76896
More information about the cfe-commits
mailing list