From 7bee63d0e059431a6c94a50645fb693d9ad7fd59 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 e1d577ab..83c74005 100644 --- a/src/indexer.hh +++ b/src/indexer.hh @@ -131,6 +131,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); @@ -144,7 +147,8 @@ template struct NameMixin { } }; -struct FuncDef : NameMixin { +template