mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-31 18:00:26 +00:00
Add optional<IndexFuncId> semantic_container to VarDefDefinitionData and cleanup
This commit is contained in:
parent
cf54cc9f26
commit
c3136122ad
@ -425,6 +425,10 @@ struct VarDefDefinitionData {
|
|||||||
// Type which declares this one.
|
// Type which declares this one.
|
||||||
optional<TypeId> declaring_type;
|
optional<TypeId> declaring_type;
|
||||||
|
|
||||||
|
// Function which declares this one.
|
||||||
|
// TODO Accept other container types.
|
||||||
|
optional<IndexFuncId> semantic_container;
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
bool is_local() const { return kind == ClangSymbolKind::Variable; }
|
bool is_local() const { return kind == ClangSymbolKind::Variable; }
|
||||||
bool is_macro() const { return kind == ClangSymbolKind::Macro; }
|
bool is_macro() const { return kind == ClangSymbolKind::Macro; }
|
||||||
|
30
src/query.h
30
src/query.h
@ -34,16 +34,15 @@ struct QueryLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const QueryLocation& other) const {
|
bool operator==(const QueryLocation& other) const {
|
||||||
// Note: We ignore |is_interesting|.
|
|
||||||
return path == other.path && range == other.range;
|
return path == other.path && range == other.range;
|
||||||
}
|
}
|
||||||
bool operator!=(const QueryLocation& other) const {
|
bool operator!=(const QueryLocation& other) const {
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
bool operator<(const QueryLocation& o) const {
|
bool operator<(const QueryLocation& o) const {
|
||||||
if (path < o.path)
|
if (path != o.path)
|
||||||
return true;
|
return path < o.path;
|
||||||
return path == o.path && range < o.range;
|
return range < o.range;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(QueryLocation, path, range);
|
MAKE_REFLECT_STRUCT(QueryLocation, path, range);
|
||||||
@ -77,9 +76,9 @@ struct SymbolIdx {
|
|||||||
}
|
}
|
||||||
bool operator!=(const SymbolIdx& that) const { return !(*this == that); }
|
bool operator!=(const SymbolIdx& that) const { return !(*this == that); }
|
||||||
bool operator<(const SymbolIdx& that) const {
|
bool operator<(const SymbolIdx& that) const {
|
||||||
if (kind < that.kind)
|
if (kind != that.kind)
|
||||||
return true;
|
return kind < that.kind;
|
||||||
return kind == that.kind && idx < that.idx;
|
return idx < that.idx;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(SymbolIdx, kind, idx);
|
MAKE_REFLECT_STRUCT(SymbolIdx, kind, idx);
|
||||||
@ -97,9 +96,9 @@ struct SymbolRef {
|
|||||||
}
|
}
|
||||||
bool operator!=(const SymbolRef& that) const { return !(*this == that); }
|
bool operator!=(const SymbolRef& that) const { return !(*this == that); }
|
||||||
bool operator<(const SymbolRef& that) const {
|
bool operator<(const SymbolRef& that) const {
|
||||||
if (idx < that.idx)
|
if (idx != that.idx)
|
||||||
return true;
|
return idx < that.idx;
|
||||||
return idx == that.idx && loc.range.start < that.loc.range.start;
|
return loc < that.loc;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(SymbolRef, idx, loc);
|
MAKE_REFLECT_STRUCT(SymbolRef, idx, loc);
|
||||||
@ -122,12 +121,11 @@ struct QueryFuncRef {
|
|||||||
}
|
}
|
||||||
bool operator!=(const QueryFuncRef& that) const { return !(*this == that); }
|
bool operator!=(const QueryFuncRef& that) const { return !(*this == that); }
|
||||||
bool operator<(const QueryFuncRef& that) const {
|
bool operator<(const QueryFuncRef& that) const {
|
||||||
if (id_ < that.id_)
|
if (id_ != that.id_)
|
||||||
return true;
|
return id_ < that.id_;
|
||||||
if (id_ == that.id_ && loc.range.start < that.loc.range.start)
|
if (loc != that.loc)
|
||||||
return true;
|
return loc < that.loc;
|
||||||
return id_ == that.id_ && loc.range.start == that.loc.range.start &&
|
return is_implicit < that.is_implicit;
|
||||||
is_implicit < that.is_implicit;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(QueryFuncRef, id_, loc, is_implicit);
|
MAKE_REFLECT_STRUCT(QueryFuncRef, id_, loc, is_implicit);
|
||||||
|
Loading…
Reference in New Issue
Block a user