From f3f72a0dfabb6ac2dead437e829960d2910c65a0 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Fri, 24 Feb 2017 22:08:14 -0800 Subject: [PATCH] Datastructure update --- indexer.cpp | 60 +++++++------- indexer.h | 67 +++++++++++----- query.cc | 80 ++++++++++--------- serializer.cc | 72 ++++++++--------- tests/declaration_vs_definition/func.cc | 2 +- tests/declaration_vs_definition/method.cc | 6 +- tests/foobar.cc | 2 +- tests/function_declaration.cc | 2 +- tests/function_declaration_definition.cc | 2 +- tests/inheritance/function_override.cc | 2 +- tests/method_declaration.cc | 2 +- tests/method_definition.cc | 2 +- tests/namespaces/anonymous_function.cc | 2 +- tests/namespaces/function_declaration.cc | 2 +- tests/namespaces/method_declaration.cc | 2 +- tests/namespaces/method_definition.cc | 2 +- tests/usage/func_usage_addr_method.cc | 2 +- tests/usage/func_usage_call_method.cc | 2 +- tests/usage/func_usage_forward_decl_func.cc | 2 +- tests/usage/func_usage_forward_decl_method.cc | 2 +- tests/usage/func_usage_template_func.cc | 2 +- ...ype_usage_as_template_parameter_complex.cc | 2 +- .../type_usage_declare_param_prototype.cc | 2 +- tests/usage/type_usage_on_return_type.cc | 10 +-- tests/usage/type_usage_various.cc | 2 +- tests/usage/usage_inside_of_call.cc | 4 +- tests/usage/usage_inside_of_call_simple.cc | 2 +- tests/usage/var_usage_class_member.cc | 4 +- tests/usage/var_usage_class_member_static.cc | 2 +- 29 files changed, 190 insertions(+), 155 deletions(-) diff --git a/indexer.cpp b/indexer.cpp index 6639bd61..113949dc 100644 --- a/indexer.cpp +++ b/indexer.cpp @@ -71,12 +71,12 @@ std::string IndexedFile::ToString() { return output.GetString(); } -IndexedTypeDef::IndexedTypeDef(TypeId id, const std::string& usr) : id(id), usr(usr) { +IndexedTypeDef::IndexedTypeDef(TypeId id, const std::string& usr) : def(id, usr) { assert(usr.size() > 0); //std::cout << "Creating type with usr " << usr << std::endl; } -void IndexedTypeDef::AddUsage(Location loc, bool insert_if_not_present = true) { +void IndexedTypeDef::AddUsage(Location loc, bool insert_if_not_present) { if (is_system_def) return; @@ -430,15 +430,15 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { // TODO: Eventually run with this if. Right now I want to iron out bugs this may shadow. // TODO: Verify this gets called multiple times //if (!decl->isRedeclaration) { - var_def->short_name = decl->entityInfo->name; - var_def->qualified_name = ns->QualifiedName(decl->semanticContainer, var_def->short_name); + var_def->def.short_name = decl->entityInfo->name; + var_def->def.qualified_name = ns->QualifiedName(decl->semanticContainer, var_def->def.short_name); //} Location decl_loc = db->file_db.Resolve(decl->loc, false /*interesting*/); if (decl->isDefinition) - var_def->definition = decl_loc; + var_def->def.definition = decl_loc; else - var_def->declaration = decl_loc; + var_def->def.declaration = decl_loc; var_def->uses.push_back(decl_loc); @@ -448,14 +448,14 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { // declarations for unnamed parameters. optional var_type = ResolveDeclToType(db, decl_cursor, decl_cursor.get_kind() != CXCursor_ParmDecl /*is_interesting*/, decl->semanticContainer, decl->lexicalContainer); if (var_type.has_value()) - var_def->variable_type = var_type.value(); + var_def->def.variable_type = var_type.value(); if (decl->isDefinition && IsTypeDefinition(decl->semanticContainer)) { TypeId declaring_type_id = db->ToTypeId(decl->semanticContainer->cursor); IndexedTypeDef* declaring_type_def = db->Resolve(declaring_type_id); - var_def->declaring_type = declaring_type_id; - declaring_type_def->vars.push_back(var_id); + var_def->def.declaring_type = declaring_type_id; + declaring_type_def->def.vars.push_back(var_id); } break; @@ -476,15 +476,15 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { // TODO: Eventually run with this if. Right now I want to iron out bugs this may shadow. //if (!decl->isRedeclaration) { - func_def->short_name = decl->entityInfo->name; - func_def->qualified_name = ns->QualifiedName(decl->semanticContainer, func_def->short_name); + func_def->def.short_name = decl->entityInfo->name; + func_def->def.qualified_name = ns->QualifiedName(decl->semanticContainer, func_def->def.short_name); //} Location decl_loc = db->file_db.Resolve(decl->loc, false /*interesting*/); if (decl->isDefinition) - func_def->definition = decl_loc; + func_def->def.definition = decl_loc; else - func_def->declaration = decl_loc; + func_def->declarations.push_back(decl_loc); func_def->uses.push_back(decl_loc); bool is_pure_virtual = clang_CXXMethod_isPureVirtual(decl->cursor); @@ -497,7 +497,7 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { if (IsTypeDefinition(decl->semanticContainer)) { TypeId declaring_type_id = db->ToTypeId(decl->semanticContainer->cursor); IndexedTypeDef* declaring_type_def = db->Resolve(declaring_type_id); - func_def->declaring_type = declaring_type_id; + func_def->def.declaring_type = declaring_type_id; // Mark a type reference at the ctor/dtor location. // TODO: Should it be interesting? @@ -507,8 +507,8 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { } // Register function in declaring type if it hasn't been registered yet. - if (!Contains(declaring_type_def->funcs, func_id)) - declaring_type_def->funcs.push_back(func_id); + if (!Contains(declaring_type_def->def.funcs, func_id)) + declaring_type_def->def.funcs.push_back(func_id); } @@ -562,7 +562,7 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { IndexedFuncDef* parent_def = db->Resolve(parent_id); func_def = db->Resolve(func_id); // ToFuncId invalidated func_def - func_def->base = parent_id; + func_def->def.base = parent_id; parent_def->derived.push_back(func_id); } @@ -592,13 +592,13 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { type_def->is_system_def = is_system_def; if (alias_of) - type_def->alias_of = alias_of.value(); + type_def->def.alias_of = alias_of.value(); - type_def->short_name = decl->entityInfo->name; - type_def->qualified_name = ns->QualifiedName(decl->semanticContainer, type_def->short_name); + type_def->def.short_name = decl->entityInfo->name; + type_def->def.qualified_name = ns->QualifiedName(decl->semanticContainer, type_def->def.short_name); Location decl_loc = db->file_db.Resolve(decl->loc, true /*interesting*/); - type_def->definition = decl_loc.WithInteresting(false); + type_def->def.definition = decl_loc.WithInteresting(false); type_def->AddUsage(decl_loc); break; } @@ -620,19 +620,19 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { // name can be null in an anonymous struct (see tests/types/anonymous_struct.cc). if (decl->entityInfo->name) { ns->RegisterQualifiedName(decl->entityInfo->USR, decl->semanticContainer, decl->entityInfo->name); - type_def->short_name = decl->entityInfo->name; + type_def->def.short_name = decl->entityInfo->name; } else { - type_def->short_name = ""; + type_def->def.short_name = ""; } - type_def->qualified_name = ns->QualifiedName(decl->semanticContainer, type_def->short_name); + type_def->def.qualified_name = ns->QualifiedName(decl->semanticContainer, type_def->def.short_name); // } assert(decl->isDefinition); Location decl_loc = db->file_db.Resolve(decl->loc, true /*interesting*/); - type_def->definition = decl_loc.WithInteresting(false); + type_def->def.definition = decl_loc.WithInteresting(false); type_def->AddUsage(decl_loc); //type_def->alias_of @@ -652,7 +652,7 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) { if (parent_type_id) { IndexedTypeDef* parent_type_def = db->Resolve(parent_type_id.value()); parent_type_def->derived.push_back(type_id); - type_def->parents.push_back(parent_type_id.value()); + type_def->def.parents.push_back(parent_type_id.value()); } } } @@ -729,7 +729,7 @@ void indexEntityReference(CXClientData client_data, const CXIdxEntityRefInfo* re IndexedFuncDef* caller_def = db->Resolve(caller_id); IndexedFuncDef* called_def = db->Resolve(called_id); - caller_def->callees.push_back(FuncRef(called_id, loc)); + caller_def->def.callees.push_back(FuncRef(called_id, loc)); called_def->callers.push_back(FuncRef(caller_id, loc)); called_def->uses.push_back(loc); } @@ -750,8 +750,8 @@ void indexEntityReference(CXClientData client_data, const CXIdxEntityRefInfo* re Location our_loc = db->file_db.Resolve(ref->loc, true /*is_interesting*/); if (!parent_loc.IsEqualTo(our_loc)) { IndexedFuncDef* called_def = db->Resolve(called_id); - assert(called_def->declaring_type.has_value()); - IndexedTypeDef* type_def = db->Resolve(called_def->declaring_type.value()); + assert(called_def->def.declaring_type.has_value()); + IndexedTypeDef* type_def = db->Resolve(called_def->def.declaring_type.value()); type_def->AddUsage(our_loc); } } @@ -932,7 +932,7 @@ void WriteToFile(const std::string& filename, const std::string& content) { file << content; } -int main3(int argc, char** argv) { +int main(int argc, char** argv) { // TODO: Assert that we need to be on clang >= 3.9.1 /* diff --git a/indexer.h b/indexer.h index ab19cc68..a4662972 100644 --- a/indexer.h +++ b/indexer.h @@ -166,9 +166,7 @@ using VarRef = Ref; // TODO: Either eliminate the defs created as a by-product of cross-referencing, // or do not emit things we don't have definitions for. -struct IndexedTypeDef { - bool is_system_def = false; - +struct TypeDefDefinitionData { // General metadata. TypeId id; std::string usr; @@ -190,44 +188,67 @@ struct IndexedTypeDef { // type comes from a using or typedef statement). optional alias_of; - // Immediate parent and immediate derived types. + // Immediate parent types. std::vector parents; - std::vector derived; // Types, functions, and variables defined in this type. std::vector types; std::vector funcs; std::vector vars; + TypeDefDefinitionData(TypeId id, const std::string& usr) : id(id), usr(usr) {} +}; + +struct IndexedTypeDef { + TypeDefDefinitionData def; + + // Immediate derived types. + std::vector derived; + // Every usage, useful for things like renames. // NOTE: Do not insert directly! Use AddUsage instead. std::vector uses; + bool is_system_def = false; + IndexedTypeDef(TypeId id, const std::string& usr); void AddUsage(Location loc, bool insert_if_not_present = true); }; -struct IndexedFuncDef { - bool is_system_def = false; - +struct FuncDefDefinitionData { // General metadata. FuncId id; std::string usr; std::string short_name; std::string qualified_name; - optional declaration; optional definition; // Type which declares this one (ie, it is a method) optional declaring_type; + // Method this method overrides. optional base; - // Methods which directly override this one. - std::vector derived; // Local variables defined in this function. std::vector locals; + // Functions that this function calls. + std::vector callees; + + FuncDefDefinitionData(FuncId id, const std::string& usr) : id(id), usr(usr) { + assert(usr.size() > 0); + } +}; + +struct IndexedFuncDef { + FuncDefDefinitionData def; + + // Places the function is forward-declared. + std::vector declarations; + + // Methods which directly override this one. + std::vector derived; + // Functions which call this one. // TODO: Functions can get called outside of just functions - for example, // they can get called in static context (maybe redirect to main?) @@ -235,20 +256,18 @@ struct IndexedFuncDef { // - Right now those usages will not get listed here (but they should be // inside of all_uses). std::vector callers; - // Functions that this function calls. - std::vector callees; // All usages. For interesting usages, see callees. std::vector uses; - IndexedFuncDef(FuncId id, const std::string& usr) : id(id), usr(usr) { + bool is_system_def = false; + + IndexedFuncDef(FuncId id, const std::string& usr) : def(id, usr) { assert(usr.size() > 0); } }; -struct IndexedVarDef { - bool is_system_def = false; - +struct VarDefDefinitionData { // General metadata. VarId id; std::string usr; @@ -265,10 +284,18 @@ struct IndexedVarDef { // Type which declares this one (ie, it is a method) optional declaring_type; + VarDefDefinitionData(VarId id, const std::string& usr) : id(id), usr(usr) {} +}; + +struct IndexedVarDef { + VarDefDefinitionData def; + // Usages. std::vector uses; + + bool is_system_def = false; - IndexedVarDef(VarId id, const std::string& usr) : id(id), usr(usr) { + IndexedVarDef(VarId id, const std::string& usr) : def(id, usr) { assert(usr.size() > 0); } }; @@ -310,6 +337,10 @@ struct IndexedFile { // TODO: ^^^ I don't think we can do this. It will probably stall the main // indexer for far too long since we will have to iterate over tons of // data. +// TODO: Idea: when indexing and joining to the main db, allow many dbs that +// are joined to. So that way even if the main db is busy we can +// still be joining. Joining the partially joined db to the main +// db should be faster since we will have larger data lanes to use. struct IndexedTypeDefDiff {}; struct IndexedFuncDefDiff {}; struct IndexedVarDefDiff {}; diff --git a/query.cc b/query.cc index 96521d79..334b19fa 100644 --- a/query.cc +++ b/query.cc @@ -24,53 +24,57 @@ struct SymbolIdx { }; }; -template -struct TrackContributors { - std::vector values; - std::vector contributors; + + +// There are two sources of reindex updates: the (single) definition of a +// symbol has changed, or one of many users of the symbol has changed. +// +// For simplicitly, if the single definition has changed, we update all of the +// associated single-owner definition data. See |Update*DefId|. +// +// If one of the many symbol users submits an update, we store the update such +// that it can be merged with other updates before actually being applied to +// the main database. See |MergeableUpdate|. + +template +struct MergeableUpdate { + // The type/func/var which is getting new usages. + TId id; + // Entries to add and remove. + std::vector to_add; + std::vector to_remove; }; -// See comments in IndexedTypeDef for variable descriptions. struct QueryableTypeDef { - TypeId id; - std::string short_name; - std::string qualified_name; - optional definition; - optional alias_of; - std::vector parents; - TrackContributors derived; - std::vector types; - std::vector funcs; - std::vector vars; - TrackContributors uses; + TypeDefDefinitionData def; + std::vector derived; + std::vector uses; + + using DefUpdate = TypeDefDefinitionData; + using DerivedUpdate = MergeableUpdate; + using UsesUpdate = MergeableUpdate; }; -// See comments in IndexedFuncDef for variable descriptions. struct QueryableFuncDef { - FuncId id; - std::string short_name; - std::string qualified_name; - TrackContributors declarations; - optional definition; - optional declaring_type; - optional base; - TrackContributors derived; - std::vector locals; - TrackContributors callers; - std::vector callees; - TrackContributors uses; + FuncDefDefinitionData def; + std::vector declarations; + std::vector derived; + std::vector callers; + std::vector uses; + + using DefUpdate = FuncDefDefinitionData; + using DeclarationsUpdate = MergeableUpdate; + using DerivedUpdate = MergeableUpdate; + using CallersUpdate = MergeableUpdate; + using UsesUpdate = MergeableUpdate; }; -// See comments in IndexedVarDef for variable descriptions. struct QueryableVarDef { - VarId id; - std::string short_name; - std::string qualified_name; - TrackContributors declaration; - optional definition; - optional variable_type; - optional declaring_type; - TrackContributors uses; + VarDefDefinitionData def; + std::vector uses; + + using DefUpdate = VarDefDefinitionData; + using UsesUpdate = MergeableUpdate; }; struct QueryableFile { diff --git a/serializer.cc b/serializer.cc index 87ffe055..9176044f 100644 --- a/serializer.cc +++ b/serializer.cc @@ -193,11 +193,11 @@ void Serialize(Writer& writer, const char* key, uint64_t value) { void Serialize(Writer& writer, IndexedFile* file) { auto it = file->usr_to_type_id.find(""); if (it != file->usr_to_type_id.end()) { - file->Resolve(it->second)->short_name = ""; + file->Resolve(it->second)->def.short_name = ""; assert(file->Resolve(it->second)->uses.size() == 0); } -#define SERIALIZE(name) Serialize(writer, #name, def.name) +#define SERIALIZE(name, value) Serialize(writer, name, def.value) writer.StartObject(); @@ -208,18 +208,18 @@ void Serialize(Writer& writer, IndexedFile* file) { if (def.is_system_def) continue; writer.StartObject(); - SERIALIZE(id); - SERIALIZE(usr); - SERIALIZE(short_name); - SERIALIZE(qualified_name); - SERIALIZE(definition); - SERIALIZE(alias_of); - SERIALIZE(parents); - SERIALIZE(derived); - SERIALIZE(types); - SERIALIZE(funcs); - SERIALIZE(vars); - SERIALIZE(uses); + SERIALIZE("id", def.id); + SERIALIZE("usr", def.usr); + SERIALIZE("short_name", def.short_name); + SERIALIZE("qualified_name", def.qualified_name); + SERIALIZE("definition", def.definition); + SERIALIZE("alias_of", def.alias_of); + SERIALIZE("parents", def.parents); + SERIALIZE("derived", derived); + SERIALIZE("types", def.types); + SERIALIZE("funcs", def.funcs); + SERIALIZE("vars", def.vars); + SERIALIZE("uses", uses); writer.EndObject(); } writer.EndArray(); @@ -231,19 +231,19 @@ void Serialize(Writer& writer, IndexedFile* file) { if (def.is_system_def) continue; writer.StartObject(); - SERIALIZE(id); - SERIALIZE(usr); - SERIALIZE(short_name); - SERIALIZE(qualified_name); - SERIALIZE(declaration); - SERIALIZE(definition); - SERIALIZE(declaring_type); - SERIALIZE(base); - SERIALIZE(derived); - SERIALIZE(locals); - SERIALIZE(callers); - SERIALIZE(callees); - SERIALIZE(uses); + SERIALIZE("id", def.id); + SERIALIZE("usr", def.usr); + SERIALIZE("short_name", def.short_name); + SERIALIZE("qualified_name", def.qualified_name); + SERIALIZE("declarations", declarations); + SERIALIZE("definition", def.definition); + SERIALIZE("declaring_type", def.declaring_type); + SERIALIZE("base", def.base); + SERIALIZE("derived", derived); + SERIALIZE("locals", def.locals); + SERIALIZE("callers", callers); + SERIALIZE("callees", def.callees); + SERIALIZE("uses", uses); writer.EndObject(); } writer.EndArray(); @@ -255,15 +255,15 @@ void Serialize(Writer& writer, IndexedFile* file) { if (def.is_system_def) continue; writer.StartObject(); - SERIALIZE(id); - SERIALIZE(usr); - SERIALIZE(short_name); - SERIALIZE(qualified_name); - SERIALIZE(declaration); - SERIALIZE(definition); - SERIALIZE(variable_type); - SERIALIZE(declaring_type); - SERIALIZE(uses); + SERIALIZE("id", def.id); + SERIALIZE("usr", def.usr); + SERIALIZE("short_name", def.short_name); + SERIALIZE("qualified_name", def.qualified_name); + SERIALIZE("declaration", def.declaration); + SERIALIZE("definition", def.definition); + SERIALIZE("variable_type", def.variable_type); + SERIALIZE("declaring_type", def.declaring_type); + SERIALIZE("uses", uses); writer.EndObject(); } writer.EndArray(); diff --git a/tests/declaration_vs_definition/func.cc b/tests/declaration_vs_definition/func.cc index 593df83c..6811c365 100644 --- a/tests/declaration_vs_definition/func.cc +++ b/tests/declaration_vs_definition/func.cc @@ -13,7 +13,7 @@ OUTPUT: "usr": "c:@F@foo#", "short_name": "foo", "qualified_name": "foo", - "declaration": "1:4:6", + "declarations": ["1:1:6", "1:2:6", "1:4:6"], "definition": "1:3:6", "uses": ["1:1:6", "1:2:6", "1:3:6", "1:4:6"] }], diff --git a/tests/declaration_vs_definition/method.cc b/tests/declaration_vs_definition/method.cc index 4ada7cbd..0a6e1f7b 100644 --- a/tests/declaration_vs_definition/method.cc +++ b/tests/declaration_vs_definition/method.cc @@ -23,7 +23,7 @@ OUTPUT: "usr": "c:@S@Foo@F@declonly#", "short_name": "declonly", "qualified_name": "Foo::declonly", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "declaring_type": 0, "uses": ["1:2:8"] }, { @@ -31,7 +31,7 @@ OUTPUT: "usr": "c:@S@Foo@F@purevirtual#", "short_name": "purevirtual", "qualified_name": "Foo::purevirtual", - "declaration": "1:3:16", + "declarations": ["1:3:16"], "declaring_type": 0, "uses": ["1:3:16"] }, { @@ -39,7 +39,7 @@ OUTPUT: "usr": "c:@S@Foo@F@def#", "short_name": "def", "qualified_name": "Foo::def", - "declaration": "1:4:8", + "declarations": ["1:4:8"], "definition": "1:7:11", "declaring_type": 0, "uses": ["1:4:8", "1:7:11"] diff --git a/tests/foobar.cc b/tests/foobar.cc index 4db43b17..a25609ba 100644 --- a/tests/foobar.cc +++ b/tests/foobar.cc @@ -15,7 +15,7 @@ OUTPUT: "usr": "c:@F@called#I#", "short_name": "called", "qualified_name": "called", - "declaration": "1:1:6", + "declarations": ["1:1:6"], "callers": ["2@1:6:3"], "uses": ["1:1:6", "1:6:3"] }, { diff --git a/tests/function_declaration.cc b/tests/function_declaration.cc index d2cbd17a..239c2dfb 100644 --- a/tests/function_declaration.cc +++ b/tests/function_declaration.cc @@ -9,7 +9,7 @@ OUTPUT: "usr": "c:@F@foo#I#I#", "short_name": "foo", "qualified_name": "foo", - "declaration": "1:1:6", + "declarations": ["1:1:6"], "uses": ["1:1:6"] }], "variables": [] diff --git a/tests/function_declaration_definition.cc b/tests/function_declaration_definition.cc index cdb65920..7f476822 100644 --- a/tests/function_declaration_definition.cc +++ b/tests/function_declaration_definition.cc @@ -11,7 +11,7 @@ OUTPUT: "usr": "c:@F@foo#", "short_name": "foo", "qualified_name": "foo", - "declaration": "1:1:6", + "declarations": ["1:1:6"], "definition": "1:3:6", "uses": ["1:1:6", "1:3:6"] }], diff --git a/tests/inheritance/function_override.cc b/tests/inheritance/function_override.cc index 0a9a5d94..eff050b4 100644 --- a/tests/inheritance/function_override.cc +++ b/tests/inheritance/function_override.cc @@ -32,7 +32,7 @@ OUTPUT: "usr": "c:@S@Root@F@foo#", "short_name": "foo", "qualified_name": "Root::foo", - "declaration": "1:2:16", + "declarations": ["1:2:16"], "declaring_type": 0, "derived": [1], "uses": ["1:2:16"] diff --git a/tests/method_declaration.cc b/tests/method_declaration.cc index 0e6755db..f35a9348 100644 --- a/tests/method_declaration.cc +++ b/tests/method_declaration.cc @@ -23,7 +23,7 @@ OUTPUT: "usr": "c:@S@Foo@F@foo#", "short_name": "foo", "qualified_name": "Foo::foo", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "declaring_type": 0, "uses": ["1:2:8"] }], diff --git a/tests/method_definition.cc b/tests/method_definition.cc index 5ddfa307..06739b7b 100644 --- a/tests/method_definition.cc +++ b/tests/method_definition.cc @@ -21,7 +21,7 @@ OUTPUT: "usr": "c:@S@Foo@F@foo#", "short_name": "foo", "qualified_name": "Foo::foo", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "definition": "1:5:11", "declaring_type": 0, "uses": ["1:2:8", "1:5:11"] diff --git a/tests/namespaces/anonymous_function.cc b/tests/namespaces/anonymous_function.cc index 770efadf..477f08d7 100644 --- a/tests/namespaces/anonymous_function.cc +++ b/tests/namespaces/anonymous_function.cc @@ -11,7 +11,7 @@ OUTPUT: "usr": "c:anonymous_function.cc@aN@F@foo#", "short_name": "foo", "qualified_name": "::foo", - "declaration": "1:2:6", + "declarations": ["1:2:6"], "uses": ["1:2:6"] }], "variables": [] diff --git a/tests/namespaces/function_declaration.cc b/tests/namespaces/function_declaration.cc index 8afe389f..e29adc10 100644 --- a/tests/namespaces/function_declaration.cc +++ b/tests/namespaces/function_declaration.cc @@ -11,7 +11,7 @@ OUTPUT: "usr": "c:@N@hello@F@foo#I#I#", "short_name": "foo", "qualified_name": "hello::foo", - "declaration": "1:2:6", + "declarations": ["1:2:6"], "uses": ["1:2:6"] }], "variables": [] diff --git a/tests/namespaces/method_declaration.cc b/tests/namespaces/method_declaration.cc index 8e5a2561..4e259727 100644 --- a/tests/namespaces/method_declaration.cc +++ b/tests/namespaces/method_declaration.cc @@ -21,7 +21,7 @@ OUTPUT: "usr": "c:@N@hello@S@Foo@F@foo#", "short_name": "foo", "qualified_name": "hello::Foo::foo", - "declaration": "1:3:8", + "declarations": ["1:3:8"], "declaring_type": 0, "uses": ["1:3:8"] }], diff --git a/tests/namespaces/method_definition.cc b/tests/namespaces/method_definition.cc index cec742aa..21d2ce07 100644 --- a/tests/namespaces/method_definition.cc +++ b/tests/namespaces/method_definition.cc @@ -23,7 +23,7 @@ OUTPUT: "usr": "c:@N@hello@S@Foo@F@foo#", "short_name": "foo", "qualified_name": "hello::Foo::foo", - "declaration": "1:3:8", + "declarations": ["1:3:8"], "definition": "1:6:11", "declaring_type": 0, "uses": ["1:3:8", "1:6:11"] diff --git a/tests/usage/func_usage_addr_method.cc b/tests/usage/func_usage_addr_method.cc index a76849cc..8d1c3030 100644 --- a/tests/usage/func_usage_addr_method.cc +++ b/tests/usage/func_usage_addr_method.cc @@ -24,7 +24,7 @@ OUTPUT: "usr": "c:@S@Foo@F@Used#", "short_name": "Used", "qualified_name": "Foo::Used", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "declaring_type": 0, "callers": ["1@1:6:18"], "uses": ["1:2:8", "1:6:18"] diff --git a/tests/usage/func_usage_call_method.cc b/tests/usage/func_usage_call_method.cc index 6473578e..739c9e22 100644 --- a/tests/usage/func_usage_call_method.cc +++ b/tests/usage/func_usage_call_method.cc @@ -24,7 +24,7 @@ OUTPUT: "usr": "c:@S@Foo@F@Used#", "short_name": "Used", "qualified_name": "Foo::Used", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "declaring_type": 0, "callers": ["1@1:7:6"], "uses": ["1:2:8", "1:7:6"] diff --git a/tests/usage/func_usage_forward_decl_func.cc b/tests/usage/func_usage_forward_decl_func.cc index d0ec7568..4bd67d53 100644 --- a/tests/usage/func_usage_forward_decl_func.cc +++ b/tests/usage/func_usage_forward_decl_func.cc @@ -12,7 +12,7 @@ OUTPUT: "usr": "c:@F@foo#", "short_name": "foo", "qualified_name": "foo", - "declaration": "1:1:6", + "declarations": ["1:1:6"], "callers": ["1@1:4:3"], "uses": ["1:1:6", "1:4:3"] }, { diff --git a/tests/usage/func_usage_forward_decl_method.cc b/tests/usage/func_usage_forward_decl_method.cc index 1214aca0..bdf6ba3b 100644 --- a/tests/usage/func_usage_forward_decl_method.cc +++ b/tests/usage/func_usage_forward_decl_method.cc @@ -23,7 +23,7 @@ OUTPUT: "usr": "c:@S@Foo@F@foo#", "short_name": "foo", "qualified_name": "Foo::foo", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "declaring_type": 0, "callers": ["1@1:7:6"], "uses": ["1:2:8", "1:7:6"] diff --git a/tests/usage/func_usage_template_func.cc b/tests/usage/func_usage_template_func.cc index 1063e773..72a035c9 100644 --- a/tests/usage/func_usage_template_func.cc +++ b/tests/usage/func_usage_template_func.cc @@ -15,7 +15,7 @@ OUTPUT: "usr": "c:@FT@>1#Taccept#t0.0#v#", "short_name": "accept", "qualified_name": "accept", - "declaration": "1:2:6", + "declarations": ["1:2:6"], "callers": ["1@1:5:3", "1@1:6:3"], "uses": ["1:2:6", "1:5:3", "1:6:3"] }, { diff --git a/tests/usage/type_usage_as_template_parameter_complex.cc b/tests/usage/type_usage_as_template_parameter_complex.cc index eb79612e..f110b9db 100644 --- a/tests/usage/type_usage_as_template_parameter_complex.cc +++ b/tests/usage/type_usage_as_template_parameter_complex.cc @@ -128,7 +128,7 @@ OUTPUT: "usr": "c:@S@Foo@F@foo#", "short_name": "foo", "qualified_name": "Foo::foo", - "declaration": "1:65:23", + "declarations": ["1:65:23"], "definition": "1:79:26", "declaring_type": 3, "uses": ["1:65:23", "1:79:26"] diff --git a/tests/usage/type_usage_declare_param_prototype.cc b/tests/usage/type_usage_declare_param_prototype.cc index acdbee45..d6ff63f9 100644 --- a/tests/usage/type_usage_declare_param_prototype.cc +++ b/tests/usage/type_usage_declare_param_prototype.cc @@ -21,7 +21,7 @@ OUTPUT: "usr": "c:@F@foo#*$@S@Foo#S0_#", "short_name": "foo", "qualified_name": "foo", - "declaration": "1:3:6", + "declarations": ["1:3:6"], "definition": "1:4:6", "uses": ["1:3:6", "1:4:6"] }], diff --git a/tests/usage/type_usage_on_return_type.cc b/tests/usage/type_usage_on_return_type.cc index 00bd6d15..c142e428 100644 --- a/tests/usage/type_usage_on_return_type.cc +++ b/tests/usage/type_usage_on_return_type.cc @@ -38,7 +38,7 @@ OUTPUT: "usr": "c:@F@foo#", "short_name": "foo", "qualified_name": "foo", - "declaration": "1:4:7", + "declarations": ["1:3:7", "1:4:7"], "definition": "1:5:7", "uses": ["1:3:7", "1:4:7", "1:5:7"] }, { @@ -46,7 +46,7 @@ OUTPUT: "usr": "c:@S@Foo@F@Get#I#", "short_name": "Get", "qualified_name": "Foo::Get", - "declaration": "1:8:9", + "declarations": ["1:8:9"], "definition": "1:12:12", "declaring_type": 1, "uses": ["1:8:9", "1:12:12"] @@ -55,7 +55,7 @@ OUTPUT: "usr": "c:@S@Foo@F@Empty#", "short_name": "Empty", "qualified_name": "Foo::Empty", - "declaration": "1:9:8", + "declarations": ["1:9:8"], "definition": "1:13:11", "declaring_type": 1, "uses": ["1:9:8", "1:13:11"] @@ -64,14 +64,14 @@ OUTPUT: "usr": "c:@F@external#", "short_name": "external", "qualified_name": "external", - "declaration": "1:15:20", + "declarations": ["1:15:20"], "uses": ["1:15:20"] }, { "id": 4, "usr": "c:type_usage_on_return_type.cc@F@bar#", "short_name": "bar", "qualified_name": "bar", - "declaration": "1:17:14", + "declarations": ["1:17:14"], "definition": "1:18:14", "uses": ["1:17:14", "1:18:14"] }], diff --git a/tests/usage/type_usage_various.cc b/tests/usage/type_usage_various.cc index 8d839f9a..c2e84897 100644 --- a/tests/usage/type_usage_various.cc +++ b/tests/usage/type_usage_various.cc @@ -26,7 +26,7 @@ OUTPUT: "usr": "c:@S@Foo@F@make#", "short_name": "make", "qualified_name": "Foo::make", - "declaration": "1:2:8", + "declarations": ["1:2:8"], "definition": "1:5:11", "declaring_type": 0, "uses": ["1:2:8", "1:5:11"] diff --git a/tests/usage/usage_inside_of_call.cc b/tests/usage/usage_inside_of_call.cc index eb4aed5c..fb0b7799 100644 --- a/tests/usage/usage_inside_of_call.cc +++ b/tests/usage/usage_inside_of_call.cc @@ -31,7 +31,7 @@ OUTPUT: "usr": "c:@F@called#I#", "short_name": "called", "qualified_name": "called", - "declaration": "1:1:6", + "declarations": ["1:1:6"], "callers": ["2@1:14:3"], "uses": ["1:1:6", "1:14:3"] }, { @@ -39,7 +39,7 @@ OUTPUT: "usr": "c:@F@gen#", "short_name": "gen", "qualified_name": "gen", - "declaration": "1:3:5", + "declarations": ["1:3:5"], "callers": ["2@1:14:14"], "uses": ["1:3:5", "1:14:14"] }, { diff --git a/tests/usage/usage_inside_of_call_simple.cc b/tests/usage/usage_inside_of_call_simple.cc index 4db43b17..a25609ba 100644 --- a/tests/usage/usage_inside_of_call_simple.cc +++ b/tests/usage/usage_inside_of_call_simple.cc @@ -15,7 +15,7 @@ OUTPUT: "usr": "c:@F@called#I#", "short_name": "called", "qualified_name": "called", - "declaration": "1:1:6", + "declarations": ["1:1:6"], "callers": ["2@1:6:3"], "uses": ["1:1:6", "1:6:3"] }, { diff --git a/tests/usage/var_usage_class_member.cc b/tests/usage/var_usage_class_member.cc index 003fd378..efd37a7c 100644 --- a/tests/usage/var_usage_class_member.cc +++ b/tests/usage/var_usage_class_member.cc @@ -34,7 +34,7 @@ OUTPUT: "usr": "c:@F@accept#I#", "short_name": "accept", "qualified_name": "accept", - "declaration": "1:7:6", + "declarations": ["1:7:6"], "callers": ["2@1:14:3", "2@1:15:3", "2@1:17:3"], "uses": ["1:7:6", "1:14:3", "1:15:3", "1:17:3"] }, { @@ -42,7 +42,7 @@ OUTPUT: "usr": "c:@F@accept#*I#", "short_name": "accept", "qualified_name": "accept", - "declaration": "1:8:6", + "declarations": ["1:8:6"], "callers": ["2@1:16:3"], "uses": ["1:8:6", "1:16:3"] }, { diff --git a/tests/usage/var_usage_class_member_static.cc b/tests/usage/var_usage_class_member_static.cc index 43be421e..f8f51979 100644 --- a/tests/usage/var_usage_class_member_static.cc +++ b/tests/usage/var_usage_class_member_static.cc @@ -24,7 +24,7 @@ OUTPUT: "usr": "c:@F@accept#I#", "short_name": "accept", "qualified_name": "accept", - "declaration": "1:5:6", + "declarations": ["1:5:6"], "callers": ["1@1:8:3"], "uses": ["1:5:6", "1:8:3"] }, {