[clang-tools-extra] r321348 - [clangd] Improve packing of Symbol struct. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 22 00:12:39 PST 2017
Author: sammccall
Date: Fri Dec 22 00:12:39 2017
New Revision: 321348
URL: http://llvm.org/viewvc/llvm-project?rev=321348&view=rev
Log:
[clangd] Improve packing of Symbol struct. NFC
Modified:
clang-tools-extra/trunk/clangd/index/Index.h
clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
Modified: clang-tools-extra/trunk/clangd/index/Index.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.h?rev=321348&r1=321347&r2=321348&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/Index.h (original)
+++ clang-tools-extra/trunk/clangd/index/Index.h Fri Dec 22 00:12:39 2017
@@ -82,13 +82,13 @@ void operator>>(llvm::StringRef HexStr,
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.
Modified: clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp?rev=321348&r1=321347&r2=321348&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp Fri Dec 22 00:12:39 2017
@@ -101,8 +101,14 @@ bool SymbolCollector::handleDeclOccurenc
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;
More information about the cfe-commits
mailing list