mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Remove definition_spelling from uses in IndexVar
Instead, specify `include_decl = true` in GetUsesOfSymbol
This commit is contained in:
parent
37809def7c
commit
6b3673a438
@ -1432,8 +1432,8 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
var->def.definition_extent = decl_cursor.get_extent();
|
||||
} else {
|
||||
var->def.declaration = decl_spell;
|
||||
UniqueAdd(var->uses, decl_spell);
|
||||
}
|
||||
UniqueAdd(var->uses, decl_spell);
|
||||
|
||||
AddDeclInitializerUsages(db, decl_cursor);
|
||||
var = db->Resolve(var_id);
|
||||
@ -1829,7 +1829,6 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
||||
var->def.short_name = referenced.get_spelling();
|
||||
SetVarDetail(var, referenced, nullptr, true, db, param);
|
||||
var->def.kind = ClangSymbolKind::Parameter;
|
||||
UniqueAdd(var->uses, referenced.get_spelling_range());
|
||||
}
|
||||
}
|
||||
UniqueAdd(var->uses, loc);
|
||||
|
@ -202,7 +202,10 @@ std::vector<QueryLocation> GetUsesOfSymbol(QueryDatabase* db,
|
||||
}
|
||||
case SymbolKind::Var: {
|
||||
QueryVar& var = db->vars[symbol.idx];
|
||||
return var.uses;
|
||||
std::vector<QueryLocation> ret = var.uses;
|
||||
if (include_decl && var.def && var.def->definition_spelling)
|
||||
ret.push_back(*var.def->definition_spelling);
|
||||
return ret;
|
||||
}
|
||||
case SymbolKind::File:
|
||||
case SymbolKind::Invalid: {
|
||||
|
Loading…
Reference in New Issue
Block a user