[PATCH] D101461: [clangd][NFC] Reserve storage when creating semantic token encoding.
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 28 07:42:03 PDT 2021
njames93 created this revision.
njames93 added reviewers: sammccall, kadircet.
Herald added subscribers: usaxena95, arphaman.
njames93 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101461
Files:
clang-tools-extra/clangd/Protocol.cpp
Index: clang-tools-extra/clangd/Protocol.cpp
===================================================================
--- clang-tools-extra/clangd/Protocol.cpp
+++ clang-tools-extra/clangd/Protocol.cpp
@@ -1075,6 +1075,7 @@
constexpr unsigned SemanticTokenEncodingSize = 5;
static llvm::json::Value encodeTokens(llvm::ArrayRef<SemanticToken> Toks) {
llvm::json::Array Result;
+ Result.reserve(SemanticTokenEncodingSize * Toks.size());
for (const auto &Tok : Toks) {
Result.push_back(Tok.deltaLine);
Result.push_back(Tok.deltaStart);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101461.341203.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210428/94fef4a7/attachment.bin>
More information about the cfe-commits
mailing list