[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 14:40:07 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3846bcfe1cc: [clangd][NFC] Reserve storage when creating semantic token encoding. (authored by njames93).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101461/new/

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.341322.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210428/acc31899/attachment-0001.bin>


More information about the cfe-commits mailing list