[PATCH] D64741: [clangd] Added highlighting for tokens that are macro arguments.
Johan Vikström via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 04:57:48 PDT 2019
jvikstrom marked an inline comment as done.
jvikstrom added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:46
+ // removed.
+ for (unsigned I = 0; I < Tokens.size(); ++I) {
+ ArrayRef<HighlightingToken> TokRef(Tokens);
----------------
hokein wrote:
> we don't care the Kind in `HighlightingToken` now, I think we could simplify the code by tweaking the deduplication logic above?
>
> ```
> llvm::sort(Tokens, [](const HighlightingToken &L, const HighlightingToken &R) {
> return L.R < R.R;
> });
> std::unique(Tokens.begin(), Tokens.end(), [](const HighlightingToken &L, const HighlightingToken &R) {
> return L.R == R.R;
> });
> ```
This would still keep one entry of the conflicting token though. (If we have one Kind that is a variable and one that is a function. One of those tokens would still be in Tokens at the place they were conflicting as unique removes every element but one of duplicates)
If we have conflicting tokens we want to remove all of them because it doesn't really make sense to highlight them as anything.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64741/new/
https://reviews.llvm.org/D64741
More information about the cfe-commits
mailing list