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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits