From 4276c2b383faf292b98965b733e47a3e1db9ef16 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 15 Mar 2019 09:33:44 -0700 Subject: [PATCH] Change containers of Query*::Def fields from std::vector to ccls::Vec Query*::Def contain several immutable std::vector fields. Change them to ccls::Vec to save bytes which were wasted by `capacity`. --- src/indexer.hh | 48 ++++++++++------- src/messages/textDocument_references.cc | 6 ++- src/query.cc | 72 +++++++++++++++++++++---- src/query.hh | 15 +++--- src/utils.hh | 23 ++++++++ 5 files changed, 126 insertions(+), 38 deletions(-) diff --git a/src/indexer.hh b/src/indexer.hh index fb762ac1..62401ab3 100644 --- a/src/indexer.hh +++ b/src/indexer.hh @@ -143,6 +143,9 @@ void Reflect(BinaryWriter &visitor, SymbolRef &value); void Reflect(BinaryWriter &visitor, Use &value); void Reflect(BinaryWriter &visitor, DeclRef &value); +template +using VectorAdapter = std::vector>; + template struct NameMixin { std::string_view Name(bool qualified) const { auto self = static_cast(this); @@ -156,7 +159,8 @@ template struct NameMixin { } }; -struct FuncDef : NameMixin { +template