mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Move InsertSymbolIntoResult into query_utils.cc
This commit is contained in:
parent
f5314b62b1
commit
772df3e92a
@ -655,29 +655,6 @@ void RegisterMessageTypes() {
|
||||
MessageRegistry::instance()->Register<Ipc_CqueryExitWhenIdle>();
|
||||
}
|
||||
|
||||
void InsertSymbolIntoResult(QueryDatabase* db,
|
||||
WorkingFiles* working_files,
|
||||
SymbolIdx symbol,
|
||||
std::vector<lsSymbolInformation>* result) {
|
||||
optional<lsSymbolInformation> info = GetSymbolInfo(db, working_files, symbol);
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
optional<QueryLocation> location = GetDefinitionExtentOfSymbol(db, symbol);
|
||||
if (!location) {
|
||||
auto decls = GetDeclarationsOfSymbolForGotoDefinition(db, symbol);
|
||||
if (decls.empty())
|
||||
return;
|
||||
location = decls[0];
|
||||
}
|
||||
|
||||
optional<lsLocation> ls_location =
|
||||
GetLsLocation(db, working_files, *location);
|
||||
if (!ls_location)
|
||||
return;
|
||||
info->location = *ls_location;
|
||||
result->push_back(*info);
|
||||
}
|
||||
|
||||
// Manages files inside of the indexing pipeline so we don't have the same file
|
||||
// being imported multiple times.
|
||||
|
@ -916,3 +916,27 @@ NonElidedVector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void InsertSymbolIntoResult(QueryDatabase* db,
|
||||
WorkingFiles* working_files,
|
||||
SymbolIdx symbol,
|
||||
std::vector<lsSymbolInformation>* result) {
|
||||
optional<lsSymbolInformation> info = GetSymbolInfo(db, working_files, symbol);
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
optional<QueryLocation> location = GetDefinitionExtentOfSymbol(db, symbol);
|
||||
if (!location) {
|
||||
auto decls = GetDeclarationsOfSymbolForGotoDefinition(db, symbol);
|
||||
if (decls.empty())
|
||||
return;
|
||||
location = decls[0];
|
||||
}
|
||||
|
||||
optional<lsLocation> ls_location =
|
||||
GetLsLocation(db, working_files, *location);
|
||||
if (!ls_location)
|
||||
return;
|
||||
info->location = *ls_location;
|
||||
result->push_back(*info);
|
||||
}
|
@ -107,4 +107,10 @@ NonElidedVector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree(
|
||||
NonElidedVector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
|
||||
QueryDatabase* db,
|
||||
WorkingFiles* working_files,
|
||||
QueryFuncId root);
|
||||
QueryFuncId root);
|
||||
|
||||
// Lookup |symbol| in |db| and insert the value into |result|.
|
||||
void InsertSymbolIntoResult(QueryDatabase* db,
|
||||
WorkingFiles* working_files,
|
||||
SymbolIdx symbol,
|
||||
std::vector<lsSymbolInformation>* result);
|
Loading…
Reference in New Issue
Block a user