[PATCH] D64634: [clangd] Fix duplicate highlighting tokens appearing in initializer lists
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 12 14:15:36 PDT 2019
hokein added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:36
+ // must be deduplicated.
+ std::sort(Tokens.begin(), Tokens.end());
+ for (unsigned I = 1; I < Tokens.size(); ++I) {
----------------
nit: we could write it like
```
llvm::sort(Tokens, [](const HighlightingToken &Lhs, const HighlightingToken &Rhs) {
return std::tie(Lhs.Kind, Lhs.R) < std::tie(Rhs.Kind, Rhs.R);
});
auto Last = std::unique(Tokens.begin(), Tokens.end());
Tokens.erase(Last, Tokens.end());
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64634/new/
https://reviews.llvm.org/D64634
More information about the cfe-commits
mailing list