[PATCH] D92788: [clangd] NFC: Use SmallVector<T> where possible
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 9 09:00:08 PST 2020
sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:608
for (const auto &Line : Tokens) {
- llvm::SmallVector<char, 128> LineByteTokens;
+ llvm::SmallVector<char> LineByteTokens;
llvm::raw_svector_ostream OS(LineByteTokens);
----------------
njames93 wrote:
> Looks like this is referring to how many bytes are in a line, having 128 seems like a good amount, most coding standards don't like lines longer than that. As a follow up refractor, this could be extracted out the loop to reuse the buffer on the case it does need to allocate.
Nit; This is rather the encoded data for all the highlighted tokens on a line of source code. Which appears to be a constant 8 bytes for token. So previously 16 tokens, now 32 tokens. Either seems fine to me given we don't highlight most punctuation I think.
(Incidentally, this is the old pre-standard semantic highlighting protocol that will go away soon, so I wouldn't worry too much about its performance)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92788/new/
https://reviews.llvm.org/D92788
More information about the cfe-commits
mailing list