mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 13:48:04 +00:00
Datastructure update
This commit is contained in:
parent
d59b7c7379
commit
f3f72a0dfa
60
indexer.cpp
60
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<TypeId> 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 = "<anonymous>";
|
||||
type_def->def.short_name = "<anonymous>";
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
/*
|
||||
|
67
indexer.h
67
indexer.h
@ -166,9 +166,7 @@ using VarRef = Ref<IndexedVarDef>;
|
||||
// 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<TypeId> alias_of;
|
||||
|
||||
// Immediate parent and immediate derived types.
|
||||
// Immediate parent types.
|
||||
std::vector<TypeId> parents;
|
||||
std::vector<TypeId> derived;
|
||||
|
||||
// Types, functions, and variables defined in this type.
|
||||
std::vector<TypeId> types;
|
||||
std::vector<FuncId> funcs;
|
||||
std::vector<VarId> vars;
|
||||
|
||||
TypeDefDefinitionData(TypeId id, const std::string& usr) : id(id), usr(usr) {}
|
||||
};
|
||||
|
||||
struct IndexedTypeDef {
|
||||
TypeDefDefinitionData def;
|
||||
|
||||
// Immediate derived types.
|
||||
std::vector<TypeId> derived;
|
||||
|
||||
// Every usage, useful for things like renames.
|
||||
// NOTE: Do not insert directly! Use AddUsage instead.
|
||||
std::vector<Location> 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<Location> declaration;
|
||||
optional<Location> definition;
|
||||
|
||||
// Type which declares this one (ie, it is a method)
|
||||
optional<TypeId> declaring_type;
|
||||
|
||||
// Method this method overrides.
|
||||
optional<FuncId> base;
|
||||
// Methods which directly override this one.
|
||||
std::vector<FuncId> derived;
|
||||
|
||||
// Local variables defined in this function.
|
||||
std::vector<VarId> locals;
|
||||
|
||||
// Functions that this function calls.
|
||||
std::vector<FuncRef> 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<Location> declarations;
|
||||
|
||||
// Methods which directly override this one.
|
||||
std::vector<FuncId> 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<FuncRef> callers;
|
||||
// Functions that this function calls.
|
||||
std::vector<FuncRef> callees;
|
||||
|
||||
// All usages. For interesting usages, see callees.
|
||||
std::vector<Location> 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<TypeId> declaring_type;
|
||||
|
||||
VarDefDefinitionData(VarId id, const std::string& usr) : id(id), usr(usr) {}
|
||||
};
|
||||
|
||||
struct IndexedVarDef {
|
||||
VarDefDefinitionData def;
|
||||
|
||||
// Usages.
|
||||
std::vector<Location> 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 {};
|
||||
|
80
query.cc
80
query.cc
@ -24,53 +24,57 @@ struct SymbolIdx {
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct TrackContributors {
|
||||
std::vector<T> values;
|
||||
std::vector<FileId> 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<typename TId, typename TValue>
|
||||
struct MergeableUpdate {
|
||||
// The type/func/var which is getting new usages.
|
||||
TId id;
|
||||
// Entries to add and remove.
|
||||
std::vector<TValue> to_add;
|
||||
std::vector<TValue> to_remove;
|
||||
};
|
||||
|
||||
// See comments in IndexedTypeDef for variable descriptions.
|
||||
struct QueryableTypeDef {
|
||||
TypeId id;
|
||||
std::string short_name;
|
||||
std::string qualified_name;
|
||||
optional<Location> definition;
|
||||
optional<TypeId> alias_of;
|
||||
std::vector<TypeId> parents;
|
||||
TrackContributors<TypeId> derived;
|
||||
std::vector<TypeId> types;
|
||||
std::vector<FuncId> funcs;
|
||||
std::vector<VarId> vars;
|
||||
TrackContributors<Location> uses;
|
||||
TypeDefDefinitionData def;
|
||||
std::vector<TypeId> derived;
|
||||
std::vector<Location> uses;
|
||||
|
||||
using DefUpdate = TypeDefDefinitionData;
|
||||
using DerivedUpdate = MergeableUpdate<TypeId, TypeId>;
|
||||
using UsesUpdate = MergeableUpdate<TypeId, Location>;
|
||||
};
|
||||
|
||||
// See comments in IndexedFuncDef for variable descriptions.
|
||||
struct QueryableFuncDef {
|
||||
FuncId id;
|
||||
std::string short_name;
|
||||
std::string qualified_name;
|
||||
TrackContributors<Location> declarations;
|
||||
optional<Location> definition;
|
||||
optional<TypeId> declaring_type;
|
||||
optional<FuncId> base;
|
||||
TrackContributors<FuncId> derived;
|
||||
std::vector<VarId> locals;
|
||||
TrackContributors<FuncRef> callers;
|
||||
std::vector<FuncRef> callees;
|
||||
TrackContributors<Location> uses;
|
||||
FuncDefDefinitionData def;
|
||||
std::vector<Location> declarations;
|
||||
std::vector<FuncId> derived;
|
||||
std::vector<FuncRef> callers;
|
||||
std::vector<Location> uses;
|
||||
|
||||
using DefUpdate = FuncDefDefinitionData;
|
||||
using DeclarationsUpdate = MergeableUpdate<FuncId, Location>;
|
||||
using DerivedUpdate = MergeableUpdate<FuncId, FuncId>;
|
||||
using CallersUpdate = MergeableUpdate<FuncId, FuncRef>;
|
||||
using UsesUpdate = MergeableUpdate<FuncId, Location>;
|
||||
};
|
||||
|
||||
// See comments in IndexedVarDef for variable descriptions.
|
||||
struct QueryableVarDef {
|
||||
VarId id;
|
||||
std::string short_name;
|
||||
std::string qualified_name;
|
||||
TrackContributors<Location> declaration;
|
||||
optional<Location> definition;
|
||||
optional<TypeId> variable_type;
|
||||
optional<TypeId> declaring_type;
|
||||
TrackContributors<Location> uses;
|
||||
VarDefDefinitionData def;
|
||||
std::vector<Location> uses;
|
||||
|
||||
using DefUpdate = VarDefDefinitionData;
|
||||
using UsesUpdate = MergeableUpdate<VarId, Location>;
|
||||
};
|
||||
|
||||
struct QueryableFile {
|
||||
|
@ -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 = "<fundamental>";
|
||||
file->Resolve(it->second)->def.short_name = "<fundamental>";
|
||||
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();
|
||||
|
@ -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"]
|
||||
}],
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
@ -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": []
|
||||
|
@ -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"]
|
||||
}],
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
}],
|
||||
|
@ -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"]
|
||||
|
@ -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": []
|
||||
|
@ -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": []
|
||||
|
@ -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"]
|
||||
}],
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
}],
|
||||
|
@ -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"]
|
||||
}],
|
||||
|
@ -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"]
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
@ -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"]
|
||||
}, {
|
||||
|
Loading…
Reference in New Issue
Block a user