From 0bf34062caf58358ab3ee7fbab084b4e692ae2ec Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Fri, 22 Dec 2017 08:12:39 +0000 Subject: [clangd] Improve packing of Symbol struct. NFC git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@321348 91177308-0d34-0410-b5e6-96231b3b80d8 --- clangd/index/Index.h | 4 ++-- clangd/index/SymbolCollector.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/clangd/index/Index.h b/clangd/index/Index.h index 1816d79f..b5044634 100644 --- a/clangd/index/Index.h +++ b/clangd/index/Index.h @@ -82,13 +82,13 @@ void operator>>(llvm::StringRef HexStr, SymbolID &ID); struct Symbol { // The ID of the symbol. SymbolID ID; + // The symbol information, like symbol kind. + index::SymbolInfo SymInfo; // The unqualified name of the symbol, e.g. "bar" (for "n1::n2::bar"). llvm::StringRef Name; // The scope (e.g. namespace) of the symbol, e.g. "n1::n2" (for // "n1::n2::bar"). llvm::StringRef Scope; - // The symbol information, like symbol kind. - index::SymbolInfo SymInfo; // The location of the canonical declaration of the symbol. // // A C++ symbol could have multiple declarations and one definition (e.g. diff --git a/clangd/index/SymbolCollector.cpp b/clangd/index/SymbolCollector.cpp index ee1c69dd..c53522a4 100644 --- a/clangd/index/SymbolCollector.cpp +++ b/clangd/index/SymbolCollector.cpp @@ -101,8 +101,14 @@ bool SymbolCollector::handleDeclOccurence( SM.getFileOffset(D->getLocEnd())}; std::string QName = ND->getQualifiedNameAsString(); auto ScopeAndName = splitQualifiedName(QName); - Symbols.insert({std::move(ID), ScopeAndName.second, ScopeAndName.first, - index::getSymbolInfo(D), std::move(Location)}); + + Symbol S; + S.ID = std::move(ID); + S.Scope = ScopeAndName.first; + S.Name = ScopeAndName.second; + S.SymInfo = index::getSymbolInfo(D); + S.CanonicalDeclaration = Location; + Symbols.insert(S); } return true; -- cgit v1.2.3