Rename instantiations to instances.

This commit is contained in:
Jacob Dufault 2017-04-21 00:03:33 -07:00
parent bdd433abd4
commit bb25640d91
6 changed files with 13 additions and 13 deletions

View File

@ -1517,7 +1517,7 @@ void QueryDbMainLoop(
QueryType& type = db->types[symbol.idx]; QueryType& type = db->types[symbol.idx];
AddCodeLens(&common, ref.loc.OffsetStartColumn(0), type.uses, "ref", "refs"); AddCodeLens(&common, ref.loc.OffsetStartColumn(0), type.uses, "ref", "refs");
AddCodeLens(&common, ref.loc.OffsetStartColumn(1), ToQueryLocation(db, type.derived), "derived", "derived"); AddCodeLens(&common, ref.loc.OffsetStartColumn(1), ToQueryLocation(db, type.derived), "derived", "derived");
AddCodeLens(&common, ref.loc.OffsetStartColumn(2), ToQueryLocation(db, type.instantiations), "var", "vars"); AddCodeLens(&common, ref.loc.OffsetStartColumn(2), ToQueryLocation(db, type.instances), "var", "vars");
break; break;
} }
case SymbolKind::Func: { case SymbolKind::Func: {

View File

@ -776,7 +776,7 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
// Don't treat enum definition variables as instantiations. // Don't treat enum definition variables as instantiations.
bool is_enum_member = decl->semanticContainer && decl->semanticContainer->cursor.kind == CXCursor_EnumDecl; bool is_enum_member = decl->semanticContainer && decl->semanticContainer->cursor.kind == CXCursor_EnumDecl;
if (!is_enum_member) if (!is_enum_member)
db->Resolve(var_type.value())->instantiations.push_back(var_id); db->Resolve(var_type.value())->instances.push_back(var_id);
var_def->def.variable_type = var_type.value(); var_def->def.variable_type = var_type.value();
} }

View File

@ -205,7 +205,7 @@ struct IndexedTypeDef {
std::vector<IndexTypeId> derived; std::vector<IndexTypeId> derived;
// Declared variables of this type. // Declared variables of this type.
std::vector<IndexVarId> instantiations; std::vector<IndexVarId> instances;
// Every usage, useful for things like renames. // Every usage, useful for things like renames.
// NOTE: Do not insert directly! Use AddUsage instead. // NOTE: Do not insert directly! Use AddUsage instead.
@ -219,7 +219,7 @@ struct IndexedTypeDef {
return return
def.HasInterestingState() || def.HasInterestingState() ||
!derived.empty() || !derived.empty() ||
!instantiations.empty() || !instances.empty() ||
!uses.empty(); !uses.empty();
} }

View File

@ -515,8 +515,8 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map, const IdMap& current_id_m
types_def_update.push_back(ToQuery(current_id_map, type->def)); types_def_update.push_back(ToQuery(current_id_map, type->def));
if (!type->derived.empty()) if (!type->derived.empty())
types_derived.push_back(QueryType::DerivedUpdate(current_id_map.ToQuery(type->id), current_id_map.ToQuery(type->derived))); types_derived.push_back(QueryType::DerivedUpdate(current_id_map.ToQuery(type->id), current_id_map.ToQuery(type->derived)));
if (!type->instantiations.empty()) if (!type->instances.empty())
types_instantiations.push_back(QueryType::InstantiationsUpdate(current_id_map.ToQuery(type->id), current_id_map.ToQuery(type->instantiations))); types_instances.push_back(QueryType::InstancesUpdate(current_id_map.ToQuery(type->id), current_id_map.ToQuery(type->instances)));
if (!type->uses.empty()) if (!type->uses.empty())
types_uses.push_back(QueryType::UsesUpdate(current_id_map.ToQuery(type->id), current_id_map.ToQuery(type->uses))); types_uses.push_back(QueryType::UsesUpdate(current_id_map.ToQuery(type->id), current_id_map.ToQuery(type->uses)));
}, },
@ -527,7 +527,7 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map, const IdMap& current_id_m
types_def_update.push_back(*current_remapped_def); types_def_update.push_back(*current_remapped_def);
PROCESS_UPDATE_DIFF(QueryTypeId, types_derived, derived, QueryTypeId); PROCESS_UPDATE_DIFF(QueryTypeId, types_derived, derived, QueryTypeId);
PROCESS_UPDATE_DIFF(QueryTypeId, types_instantiations, instantiations, QueryVarId); PROCESS_UPDATE_DIFF(QueryTypeId, types_instances, instances, QueryVarId);
PROCESS_UPDATE_DIFF(QueryTypeId, types_uses, uses, QueryLocation); PROCESS_UPDATE_DIFF(QueryTypeId, types_uses, uses, QueryLocation);
}); });
@ -594,7 +594,7 @@ void IndexUpdate::Merge(const IndexUpdate& update) {
INDEX_UPDATE_APPEND(types_removed); INDEX_UPDATE_APPEND(types_removed);
INDEX_UPDATE_APPEND(types_def_update); INDEX_UPDATE_APPEND(types_def_update);
INDEX_UPDATE_MERGE(types_derived); INDEX_UPDATE_MERGE(types_derived);
INDEX_UPDATE_MERGE(types_instantiations); INDEX_UPDATE_MERGE(types_instances);
INDEX_UPDATE_MERGE(types_uses); INDEX_UPDATE_MERGE(types_uses);
INDEX_UPDATE_APPEND(funcs_removed); INDEX_UPDATE_APPEND(funcs_removed);
@ -674,7 +674,7 @@ void QueryDatabase::ApplyIndexUpdate(IndexUpdate* update) {
RemoveUsrs(update->types_removed); RemoveUsrs(update->types_removed);
ImportOrUpdate(update->types_def_update); ImportOrUpdate(update->types_def_update);
HANDLE_MERGEABLE(types_derived, derived, types); HANDLE_MERGEABLE(types_derived, derived, types);
HANDLE_MERGEABLE(types_instantiations, instantiations, types); HANDLE_MERGEABLE(types_instances, instances, types);
HANDLE_MERGEABLE(types_uses, uses, types); HANDLE_MERGEABLE(types_uses, uses, types);
RemoveUsrs(update->funcs_removed); RemoveUsrs(update->funcs_removed);

View File

@ -163,12 +163,12 @@ struct QueryFile {
struct QueryType { struct QueryType {
using DefUpdate = TypeDefDefinitionData<QueryTypeId, QueryFuncId, QueryVarId, QueryLocation>; using DefUpdate = TypeDefDefinitionData<QueryTypeId, QueryFuncId, QueryVarId, QueryLocation>;
using DerivedUpdate = MergeableUpdate<QueryTypeId, QueryTypeId>; using DerivedUpdate = MergeableUpdate<QueryTypeId, QueryTypeId>;
using InstantiationsUpdate = MergeableUpdate<QueryTypeId, QueryVarId>; using InstancesUpdate = MergeableUpdate<QueryTypeId, QueryVarId>;
using UsesUpdate = MergeableUpdate<QueryTypeId, QueryLocation>; using UsesUpdate = MergeableUpdate<QueryTypeId, QueryLocation>;
DefUpdate def; DefUpdate def;
std::vector<QueryTypeId> derived; std::vector<QueryTypeId> derived;
std::vector<QueryVarId> instantiations; std::vector<QueryVarId> instances;
std::vector<QueryLocation> uses; std::vector<QueryLocation> uses;
size_t detailed_name_idx = -1; size_t detailed_name_idx = -1;
@ -219,7 +219,7 @@ struct IndexUpdate {
std::vector<Usr> types_removed; std::vector<Usr> types_removed;
std::vector<QueryType::DefUpdate> types_def_update; std::vector<QueryType::DefUpdate> types_def_update;
std::vector<QueryType::DerivedUpdate> types_derived; std::vector<QueryType::DerivedUpdate> types_derived;
std::vector<QueryType::InstantiationsUpdate> types_instantiations; std::vector<QueryType::InstancesUpdate> types_instances;
std::vector<QueryType::UsesUpdate> types_uses; std::vector<QueryType::UsesUpdate> types_uses;
// Function updates. // Function updates.

View File

@ -136,7 +136,7 @@ void Reflect(TVisitor& visitor, IndexedTypeDef& value) {
REFLECT_MEMBER2("types", value.def.types); REFLECT_MEMBER2("types", value.def.types);
REFLECT_MEMBER2("funcs", value.def.funcs); REFLECT_MEMBER2("funcs", value.def.funcs);
REFLECT_MEMBER2("vars", value.def.vars); REFLECT_MEMBER2("vars", value.def.vars);
REFLECT_MEMBER2("instantiations", value.instantiations); REFLECT_MEMBER2("instantiations", value.instances);
REFLECT_MEMBER2("uses", value.uses); REFLECT_MEMBER2("uses", value.uses);
REFLECT_MEMBER_END(); REFLECT_MEMBER_END();
} }