Remove local variables from documentSymbol

This commit is contained in:
Fangrui Song 2018-02-18 12:07:40 -08:00
parent 58d6547411
commit bfd4edf177

View File

@ -275,13 +275,17 @@ QueryFile::DefUpdate BuildFileDefUpdate(const IdMap& id_map, const IndexFile& in
}
for (const IndexVar& var : indexed.vars) {
QueryVarId id = id_map.ToQuery(var.id);
if (var.def.spell)
if (var.def.spell) {
add_all_symbols(*var.def.spell, id, SymbolKind::Var);
if (var.def.extent)
add_outline(*var.def.extent, id, SymbolKind::Var);
if (var.def.extent && (var.def.spell->kind != SymbolKind::Func ||
var.def.storage == StorageClass::Static))
add_outline(*var.def.extent, id, SymbolKind::Var);
}
for (Use decl : var.declarations) {
add_all_symbols(decl, id, SymbolKind::Var);
add_outline(decl, id, SymbolKind::Var);
if (decl.kind != SymbolKind::Func ||
var.def.storage == StorageClass::Static)
add_outline(decl, id, SymbolKind::Var);
}
for (Use use : var.uses)
add_all_symbols(use, id, SymbolKind::Var);