summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clangd/index/Index.h4
-rw-r--r--clang-tools-extra/clangd/index/SymbolCollector.cpp10
2 files changed, 10 insertions, 4 deletions
diff --git a/clang-tools-extra/clangd/index/Index.h b/clang-tools-extra/clangd/index/Index.h
index 1816d79fce1..b5044634d3c 100644
--- a/clang-tools-extra/clangd/index/Index.h
+++ b/clang-tools-extra/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/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index ee1c69dde92..c53522a40f2 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/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;
OpenPOWER on IntegriCloud