[clangd][NFC] Reserve storage when creating semantic token encoding.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D101461
This commit is contained in:
Nathan James 2021-04-28 22:39:54 +01:00
parent 0c01b37eeb
commit c3846bcfe1
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 1 additions and 0 deletions

View File

@ -1075,6 +1075,7 @@ llvm::json::Value toJSON(const FileStatus &FStatus) {
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);