From b515fabb3bca172f13a52d144824b56180dad158 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 18 Oct 2018 10:43:50 +0000 Subject: [clangd] Encode Line/Column as a 32-bits integer. Summary: This would buy us more memory. Using a 32-bits integer is enough for most human-readable source code (up to 4M lines and 4K columns). Previsouly, we used 8 bytes for a position, now 4 bytes, it would save us 8 bytes for each Ref and each Symbol instance. For LLVM-project binary index file, we save ~13% memory. | Before | After | | 412MB | 355MB | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53363 llvm-svn: 344735 --- clang-tools-extra/clangd/FindSymbols.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'clang-tools-extra/clangd/FindSymbols.cpp') diff --git a/clang-tools-extra/clangd/FindSymbols.cpp b/clang-tools-extra/clangd/FindSymbols.cpp index 0b000121e15..129674f5fd5 100644 --- a/clang-tools-extra/clangd/FindSymbols.cpp +++ b/clang-tools-extra/clangd/FindSymbols.cpp @@ -140,10 +140,10 @@ getWorkspaceSymbols(StringRef Query, int Limit, const SymbolIndex *const Index, Location L; L.uri = URIForFile((*Path)); Position Start, End; - Start.line = CD.Start.Line; - Start.character = CD.Start.Column; - End.line = CD.End.Line; - End.character = CD.End.Column; + Start.line = CD.Start.line(); + Start.character = CD.Start.column(); + End.line = CD.End.line(); + End.character = CD.End.column(); L.range = {Start, End}; SymbolKind SK = indexSymbolKindToSymbolKind(Sym.SymInfo.Kind); std::string Scope = Sym.Scope; -- cgit v1.2.3