mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 03:55:49 +00:00
Fix querydb corruption/invalid references accumulating over time.
Hopefully this catches all of the issues. We will see in time. This resolves issue #443
This commit is contained in:
parent
0c4d82667f
commit
71a55ce46b
13
src/query.cc
13
src/query.cc
@ -511,7 +511,6 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
||||
[this, &previous_id_map](IndexType* type) {
|
||||
if (type->def.spell)
|
||||
types_removed.push_back(type->usr);
|
||||
else {
|
||||
if (!type->derived.empty())
|
||||
types_derived.push_back(QueryType::DerivedUpdate(
|
||||
previous_id_map.ToQuery(type->id), {},
|
||||
@ -524,7 +523,6 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
||||
types_uses.push_back(
|
||||
QueryType::UsesUpdate(previous_id_map.ToQuery(type->id), {},
|
||||
previous_id_map.ToQuery(type->uses)));
|
||||
}
|
||||
},
|
||||
/*onAdded:*/
|
||||
[this, ¤t_id_map](IndexType* type) {
|
||||
@ -571,9 +569,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
||||
previous_file.funcs, current_file.funcs,
|
||||
/*onRemoved:*/
|
||||
[this, &previous_id_map](IndexFunc* func) {
|
||||
if (func->def.spell) {
|
||||
if (func->def.spell)
|
||||
funcs_removed.push_back(func->usr);
|
||||
} else {
|
||||
if (!func->declarations.empty())
|
||||
funcs_declarations.push_back(QueryFunc::DeclarationsUpdate(
|
||||
previous_id_map.ToQuery(func->id), {},
|
||||
@ -586,7 +583,6 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
||||
funcs_uses.push_back(QueryFunc::UsesUpdate(
|
||||
previous_id_map.ToQuery(func->id), {},
|
||||
previous_id_map.ToQuery(func->uses)));
|
||||
}
|
||||
},
|
||||
/*onAdded:*/
|
||||
[this, ¤t_id_map](IndexFunc* func) {
|
||||
@ -633,9 +629,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
||||
previous_file.vars, current_file.vars,
|
||||
/*onRemoved:*/
|
||||
[this, &previous_id_map](IndexVar* var) {
|
||||
if (var->def.spell) {
|
||||
if (var->def.spell)
|
||||
vars_removed.push_back(var->usr);
|
||||
} else {
|
||||
if (!var->declarations.empty())
|
||||
vars_declarations.push_back(QueryVar::DeclarationsUpdate(
|
||||
previous_id_map.ToQuery(var->id), {},
|
||||
@ -644,7 +639,6 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
|
||||
vars_uses.push_back(
|
||||
QueryVar::UsesUpdate(previous_id_map.ToQuery(var->id), {},
|
||||
previous_id_map.ToQuery(var->uses)));
|
||||
}
|
||||
},
|
||||
/*onAdded:*/
|
||||
[this, ¤t_id_map](IndexVar* var) {
|
||||
@ -1225,7 +1219,6 @@ TEST_SUITE("query") {
|
||||
db.ApplyIndexUpdate(&delta_update);
|
||||
}
|
||||
REQUIRE(db.vars.size() == 1);
|
||||
// FIXME/TODO: See https://github.com/cquery-project/cquery/issues/443.
|
||||
// REQUIRE(db.vars[0].uses.size() == 0);
|
||||
REQUIRE(db.vars[0].uses.size() == 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user