diff --git a/src/indexer.h b/src/indexer.h index 6bbdf16b..bf43c1e5 100644 --- a/src/indexer.h +++ b/src/indexer.h @@ -96,7 +96,6 @@ using VarRef = Ref; template struct TypeDefDefinitionData { // General metadata. @@ -113,18 +112,9 @@ struct TypeDefDefinitionData { // It's also difficult to identify a `class Foo;` statement with the clang // indexer API (it's doable using cursor AST traversal), so we don't bother // supporting the feature. - optional definition_spelling; + optional definition_spelling; optional definition_extent; - // TODO: change |definition| to be a Position, and have an |extents| field which - // stores the range of the definition body. Also do this for methods. - // TODO: cleanup Range, Position, etc to take less memory. Model vscode api of - // Location, Range, Position. - // TODO: drop paths from everything in the index. We never store things outside - // of the main file. - // TODO: fix tests, the change to ranges is breaking them. Breaking currently - // coming from marking - // If set, then this is the same underlying type as the given value (ie, this // type comes from a using or typedef statement). optional alias_of; @@ -140,7 +130,7 @@ struct TypeDefDefinitionData { TypeDefDefinitionData() {} // For reflection. TypeDefDefinitionData(const std::string& usr) : usr(usr) {} - bool operator==(const TypeDefDefinitionData& + bool operator==(const TypeDefDefinitionData& other) const { return usr == other.usr && short_name == other.short_name && qualified_name == other.qualified_name && @@ -151,7 +141,7 @@ struct TypeDefDefinitionData { funcs == other.funcs && vars == other.vars; } - bool operator!=(const TypeDefDefinitionData& + bool operator!=(const TypeDefDefinitionData& other) const { return !(*this == other); } @@ -160,10 +150,9 @@ template void Reflect(TVisitor& visitor, - TypeDefDefinitionData& value) { + TypeDefDefinitionData& value) { REFLECT_MEMBER_START(); REFLECT_MEMBER(usr); REFLECT_MEMBER(short_name); @@ -178,7 +167,7 @@ void Reflect(TVisitor& visitor, } struct IndexedTypeDef { - using Def = TypeDefDefinitionData; + using Def = TypeDefDefinitionData; Def def; TypeId id; @@ -219,14 +208,13 @@ template struct FuncDefDefinitionData { // General metadata. std::string usr; std::string short_name; std::string qualified_name; - optional definition_spelling; + optional definition_spelling; optional definition_extent; // Type which declares this one (ie, it is a method) @@ -247,7 +235,7 @@ struct FuncDefDefinitionData { } bool operator==( - const FuncDefDefinitionData& + const FuncDefDefinitionData& other) const { return usr == other.usr && short_name == other.short_name && qualified_name == other.qualified_name && @@ -257,7 +245,7 @@ struct FuncDefDefinitionData { locals == other.locals && callees == other.callees; } bool operator!=( - const FuncDefDefinitionData& + const FuncDefDefinitionData& other) const { return !(*this == other); } @@ -268,11 +256,10 @@ template void Reflect( TVisitor& visitor, - FuncDefDefinitionData& value) { + FuncDefDefinitionData& value) { REFLECT_MEMBER_START(); REFLECT_MEMBER(usr); REFLECT_MEMBER(short_name); @@ -286,7 +273,7 @@ void Reflect( } struct IndexedFuncDef { - using Def = FuncDefDefinitionData; + using Def = FuncDefDefinitionData; Def def; FuncId id; @@ -333,7 +320,6 @@ MAKE_HASHABLE(IndexedFuncDef, t.def.usr); template struct VarDefDefinitionData { // General metadata. @@ -343,7 +329,7 @@ struct VarDefDefinitionData { optional declaration; // TODO: definitions should be a list of ranges, since there can be more // than one - when?? - optional definition_spelling; + optional definition_spelling; optional definition_extent; // Type of the variable. @@ -355,7 +341,7 @@ struct VarDefDefinitionData { VarDefDefinitionData() {} // For reflection. VarDefDefinitionData(const std::string& usr) : usr(usr) {} - bool operator==(const VarDefDefinitionData& + bool operator==(const VarDefDefinitionData& other) const { return usr == other.usr && short_name == other.short_name && qualified_name == other.qualified_name && @@ -365,7 +351,7 @@ struct VarDefDefinitionData { variable_type == other.variable_type && declaring_type == other.declaring_type; } - bool operator!=(const VarDefDefinitionData& + bool operator!=(const VarDefDefinitionData& other) const { return !(*this == other); } @@ -375,10 +361,9 @@ template void Reflect(TVisitor& visitor, - VarDefDefinitionData& value) { + VarDefDefinitionData& value) { REFLECT_MEMBER_START(); REFLECT_MEMBER(usr); REFLECT_MEMBER(short_name); @@ -391,7 +376,7 @@ void Reflect(TVisitor& visitor, } struct IndexedVarDef { - using Def = VarDefDefinitionData; + using Def = VarDefDefinitionData; Def def; VarId id; diff --git a/src/query.h b/src/query.h index 64b7b553..c8eb4164 100644 --- a/src/query.h +++ b/src/query.h @@ -106,7 +106,7 @@ struct QueryableFile { }; struct QueryableTypeDef { - using DefUpdate = TypeDefDefinitionData; + using DefUpdate = TypeDefDefinitionData; using DerivedUpdate = MergeableUpdate; using InstantiationsUpdate = MergeableUpdate; using UsesUpdate = MergeableUpdate; @@ -121,7 +121,7 @@ struct QueryableTypeDef { }; struct QueryableFuncDef { - using DefUpdate = FuncDefDefinitionData; + using DefUpdate = FuncDefDefinitionData; using DeclarationsUpdate = MergeableUpdate; using DerivedUpdate = MergeableUpdate; using CallersUpdate = MergeableUpdate; @@ -138,7 +138,7 @@ struct QueryableFuncDef { }; struct QueryableVarDef { - using DefUpdate = VarDefDefinitionData; + using DefUpdate = VarDefDefinitionData; using UsesUpdate = MergeableUpdate; DefUpdate def;