mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
Drop Position support from indexer templates
This commit is contained in:
parent
75b2db6dbf
commit
6114b507e2
@ -96,7 +96,6 @@ using VarRef = Ref<IndexedVarDef>;
|
|||||||
template <typename TypeId,
|
template <typename TypeId,
|
||||||
typename FuncId,
|
typename FuncId,
|
||||||
typename VarId,
|
typename VarId,
|
||||||
typename Position,
|
|
||||||
typename Range>
|
typename Range>
|
||||||
struct TypeDefDefinitionData {
|
struct TypeDefDefinitionData {
|
||||||
// General metadata.
|
// General metadata.
|
||||||
@ -113,18 +112,9 @@ struct TypeDefDefinitionData {
|
|||||||
// It's also difficult to identify a `class Foo;` statement with the clang
|
// 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
|
// indexer API (it's doable using cursor AST traversal), so we don't bother
|
||||||
// supporting the feature.
|
// supporting the feature.
|
||||||
optional<Position> definition_spelling;
|
optional<Range> definition_spelling;
|
||||||
optional<Range> definition_extent;
|
optional<Range> 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
|
// If set, then this is the same underlying type as the given value (ie, this
|
||||||
// type comes from a using or typedef statement).
|
// type comes from a using or typedef statement).
|
||||||
optional<TypeId> alias_of;
|
optional<TypeId> alias_of;
|
||||||
@ -140,7 +130,7 @@ struct TypeDefDefinitionData {
|
|||||||
TypeDefDefinitionData() {} // For reflection.
|
TypeDefDefinitionData() {} // For reflection.
|
||||||
TypeDefDefinitionData(const std::string& usr) : usr(usr) {}
|
TypeDefDefinitionData(const std::string& usr) : usr(usr) {}
|
||||||
|
|
||||||
bool operator==(const TypeDefDefinitionData<TypeId, FuncId, VarId, Position, Range>&
|
bool operator==(const TypeDefDefinitionData<TypeId, FuncId, VarId, Range>&
|
||||||
other) const {
|
other) const {
|
||||||
return usr == other.usr && short_name == other.short_name &&
|
return usr == other.usr && short_name == other.short_name &&
|
||||||
qualified_name == other.qualified_name &&
|
qualified_name == other.qualified_name &&
|
||||||
@ -151,7 +141,7 @@ struct TypeDefDefinitionData {
|
|||||||
funcs == other.funcs && vars == other.vars;
|
funcs == other.funcs && vars == other.vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const TypeDefDefinitionData<TypeId, FuncId, VarId, Position, Range>&
|
bool operator!=(const TypeDefDefinitionData<TypeId, FuncId, VarId, Range>&
|
||||||
other) const {
|
other) const {
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
@ -160,10 +150,9 @@ template <typename TVisitor,
|
|||||||
typename TypeId,
|
typename TypeId,
|
||||||
typename FuncId,
|
typename FuncId,
|
||||||
typename VarId,
|
typename VarId,
|
||||||
typename Position,
|
|
||||||
typename Range>
|
typename Range>
|
||||||
void Reflect(TVisitor& visitor,
|
void Reflect(TVisitor& visitor,
|
||||||
TypeDefDefinitionData<TypeId, FuncId, VarId, Position, Range>& value) {
|
TypeDefDefinitionData<TypeId, FuncId, VarId, Range>& value) {
|
||||||
REFLECT_MEMBER_START();
|
REFLECT_MEMBER_START();
|
||||||
REFLECT_MEMBER(usr);
|
REFLECT_MEMBER(usr);
|
||||||
REFLECT_MEMBER(short_name);
|
REFLECT_MEMBER(short_name);
|
||||||
@ -178,7 +167,7 @@ void Reflect(TVisitor& visitor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct IndexedTypeDef {
|
struct IndexedTypeDef {
|
||||||
using Def = TypeDefDefinitionData<TypeId, FuncId, VarId, Range, Range>;
|
using Def = TypeDefDefinitionData<TypeId, FuncId, VarId, Range>;
|
||||||
Def def;
|
Def def;
|
||||||
|
|
||||||
TypeId id;
|
TypeId id;
|
||||||
@ -219,14 +208,13 @@ template <typename TypeId,
|
|||||||
typename FuncId,
|
typename FuncId,
|
||||||
typename VarId,
|
typename VarId,
|
||||||
typename FuncRef,
|
typename FuncRef,
|
||||||
typename Position,
|
|
||||||
typename Range>
|
typename Range>
|
||||||
struct FuncDefDefinitionData {
|
struct FuncDefDefinitionData {
|
||||||
// General metadata.
|
// General metadata.
|
||||||
std::string usr;
|
std::string usr;
|
||||||
std::string short_name;
|
std::string short_name;
|
||||||
std::string qualified_name;
|
std::string qualified_name;
|
||||||
optional<Position> definition_spelling;
|
optional<Range> definition_spelling;
|
||||||
optional<Range> definition_extent;
|
optional<Range> definition_extent;
|
||||||
|
|
||||||
// Type which declares this one (ie, it is a method)
|
// Type which declares this one (ie, it is a method)
|
||||||
@ -247,7 +235,7 @@ struct FuncDefDefinitionData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(
|
bool operator==(
|
||||||
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Position, Range>&
|
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>&
|
||||||
other) const {
|
other) const {
|
||||||
return usr == other.usr && short_name == other.short_name &&
|
return usr == other.usr && short_name == other.short_name &&
|
||||||
qualified_name == other.qualified_name &&
|
qualified_name == other.qualified_name &&
|
||||||
@ -257,7 +245,7 @@ struct FuncDefDefinitionData {
|
|||||||
locals == other.locals && callees == other.callees;
|
locals == other.locals && callees == other.callees;
|
||||||
}
|
}
|
||||||
bool operator!=(
|
bool operator!=(
|
||||||
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Position, Range>&
|
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>&
|
||||||
other) const {
|
other) const {
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
@ -268,11 +256,10 @@ template <typename TVisitor,
|
|||||||
typename FuncId,
|
typename FuncId,
|
||||||
typename VarId,
|
typename VarId,
|
||||||
typename FuncRef,
|
typename FuncRef,
|
||||||
typename Position,
|
|
||||||
typename Range>
|
typename Range>
|
||||||
void Reflect(
|
void Reflect(
|
||||||
TVisitor& visitor,
|
TVisitor& visitor,
|
||||||
FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Position, Range>& value) {
|
FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>& value) {
|
||||||
REFLECT_MEMBER_START();
|
REFLECT_MEMBER_START();
|
||||||
REFLECT_MEMBER(usr);
|
REFLECT_MEMBER(usr);
|
||||||
REFLECT_MEMBER(short_name);
|
REFLECT_MEMBER(short_name);
|
||||||
@ -286,7 +273,7 @@ void Reflect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct IndexedFuncDef {
|
struct IndexedFuncDef {
|
||||||
using Def = FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range, Range>;
|
using Def = FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>;
|
||||||
Def def;
|
Def def;
|
||||||
|
|
||||||
FuncId id;
|
FuncId id;
|
||||||
@ -333,7 +320,6 @@ MAKE_HASHABLE(IndexedFuncDef, t.def.usr);
|
|||||||
template <typename TypeId,
|
template <typename TypeId,
|
||||||
typename FuncId,
|
typename FuncId,
|
||||||
typename VarId,
|
typename VarId,
|
||||||
typename Position,
|
|
||||||
typename Range>
|
typename Range>
|
||||||
struct VarDefDefinitionData {
|
struct VarDefDefinitionData {
|
||||||
// General metadata.
|
// General metadata.
|
||||||
@ -343,7 +329,7 @@ struct VarDefDefinitionData {
|
|||||||
optional<Range> declaration;
|
optional<Range> declaration;
|
||||||
// TODO: definitions should be a list of ranges, since there can be more
|
// TODO: definitions should be a list of ranges, since there can be more
|
||||||
// than one - when??
|
// than one - when??
|
||||||
optional<Position> definition_spelling;
|
optional<Range> definition_spelling;
|
||||||
optional<Range> definition_extent;
|
optional<Range> definition_extent;
|
||||||
|
|
||||||
// Type of the variable.
|
// Type of the variable.
|
||||||
@ -355,7 +341,7 @@ struct VarDefDefinitionData {
|
|||||||
VarDefDefinitionData() {} // For reflection.
|
VarDefDefinitionData() {} // For reflection.
|
||||||
VarDefDefinitionData(const std::string& usr) : usr(usr) {}
|
VarDefDefinitionData(const std::string& usr) : usr(usr) {}
|
||||||
|
|
||||||
bool operator==(const VarDefDefinitionData<TypeId, FuncId, VarId, Position, Range>&
|
bool operator==(const VarDefDefinitionData<TypeId, FuncId, VarId, Range>&
|
||||||
other) const {
|
other) const {
|
||||||
return usr == other.usr && short_name == other.short_name &&
|
return usr == other.usr && short_name == other.short_name &&
|
||||||
qualified_name == other.qualified_name &&
|
qualified_name == other.qualified_name &&
|
||||||
@ -365,7 +351,7 @@ struct VarDefDefinitionData {
|
|||||||
variable_type == other.variable_type &&
|
variable_type == other.variable_type &&
|
||||||
declaring_type == other.declaring_type;
|
declaring_type == other.declaring_type;
|
||||||
}
|
}
|
||||||
bool operator!=(const VarDefDefinitionData<TypeId, FuncId, VarId, Position, Range>&
|
bool operator!=(const VarDefDefinitionData<TypeId, FuncId, VarId, Range>&
|
||||||
other) const {
|
other) const {
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
@ -375,10 +361,9 @@ template <typename TVisitor,
|
|||||||
typename TypeId,
|
typename TypeId,
|
||||||
typename FuncId,
|
typename FuncId,
|
||||||
typename VarId,
|
typename VarId,
|
||||||
typename Position,
|
|
||||||
typename Range>
|
typename Range>
|
||||||
void Reflect(TVisitor& visitor,
|
void Reflect(TVisitor& visitor,
|
||||||
VarDefDefinitionData<TypeId, FuncId, VarId, Position, Range>& value) {
|
VarDefDefinitionData<TypeId, FuncId, VarId, Range>& value) {
|
||||||
REFLECT_MEMBER_START();
|
REFLECT_MEMBER_START();
|
||||||
REFLECT_MEMBER(usr);
|
REFLECT_MEMBER(usr);
|
||||||
REFLECT_MEMBER(short_name);
|
REFLECT_MEMBER(short_name);
|
||||||
@ -391,7 +376,7 @@ void Reflect(TVisitor& visitor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct IndexedVarDef {
|
struct IndexedVarDef {
|
||||||
using Def = VarDefDefinitionData<TypeId, FuncId, VarId, Range, Range>;
|
using Def = VarDefDefinitionData<TypeId, FuncId, VarId, Range>;
|
||||||
Def def;
|
Def def;
|
||||||
|
|
||||||
VarId id;
|
VarId id;
|
||||||
|
@ -106,7 +106,7 @@ struct QueryableFile {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct QueryableTypeDef {
|
struct QueryableTypeDef {
|
||||||
using DefUpdate = TypeDefDefinitionData<Usr, Usr, Usr, QueryableLocation, QueryableLocation>;
|
using DefUpdate = TypeDefDefinitionData<Usr, Usr, Usr, QueryableLocation>;
|
||||||
using DerivedUpdate = MergeableUpdate<Usr>;
|
using DerivedUpdate = MergeableUpdate<Usr>;
|
||||||
using InstantiationsUpdate = MergeableUpdate<Usr>;
|
using InstantiationsUpdate = MergeableUpdate<Usr>;
|
||||||
using UsesUpdate = MergeableUpdate<QueryableLocation>;
|
using UsesUpdate = MergeableUpdate<QueryableLocation>;
|
||||||
@ -121,7 +121,7 @@ struct QueryableTypeDef {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct QueryableFuncDef {
|
struct QueryableFuncDef {
|
||||||
using DefUpdate = FuncDefDefinitionData<Usr, Usr, Usr, UsrRef, QueryableLocation, QueryableLocation>;
|
using DefUpdate = FuncDefDefinitionData<Usr, Usr, Usr, UsrRef, QueryableLocation>;
|
||||||
using DeclarationsUpdate = MergeableUpdate<QueryableLocation>;
|
using DeclarationsUpdate = MergeableUpdate<QueryableLocation>;
|
||||||
using DerivedUpdate = MergeableUpdate<Usr>;
|
using DerivedUpdate = MergeableUpdate<Usr>;
|
||||||
using CallersUpdate = MergeableUpdate<UsrRef>;
|
using CallersUpdate = MergeableUpdate<UsrRef>;
|
||||||
@ -138,7 +138,7 @@ struct QueryableFuncDef {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct QueryableVarDef {
|
struct QueryableVarDef {
|
||||||
using DefUpdate = VarDefDefinitionData<Usr, Usr, Usr, QueryableLocation, QueryableLocation>;
|
using DefUpdate = VarDefDefinitionData<Usr, Usr, Usr, QueryableLocation>;
|
||||||
using UsesUpdate = MergeableUpdate<QueryableLocation>;
|
using UsesUpdate = MergeableUpdate<QueryableLocation>;
|
||||||
|
|
||||||
DefUpdate def;
|
DefUpdate def;
|
||||||
|
Loading…
Reference in New Issue
Block a user