[clang-tools-extra] c3846bc - [clangd][NFC] Reserve storage when creating semantic token encoding.
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 28 14:40:01 PDT 2021
Author: Nathan James
Date: 2021-04-28T22:39:54+01:00
New Revision: c3846bcfe1cc6d6421a543757b5046ea841d4610
URL: https://github.com/llvm/llvm-project/commit/c3846bcfe1cc6d6421a543757b5046ea841d4610
DIFF: https://github.com/llvm/llvm-project/commit/c3846bcfe1cc6d6421a543757b5046ea841d4610.diff
LOG: [clangd][NFC] Reserve storage when creating semantic token encoding.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D101461
Added:
Modified:
clang-tools-extra/clangd/Protocol.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp
index 543239264909..71a89ccdc587 100644
--- a/clang-tools-extra/clangd/Protocol.cpp
+++ b/clang-tools-extra/clangd/Protocol.cpp
@@ -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);
More information about the cfe-commits
mailing list