mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 17:11:59 +00:00
Compare hover & comments in {Func,Type,Var}DefDefinitionData::operator==
So that the changes populate to querydb. Also expand two std::set_difference calls to save one scan
This commit is contained in:
parent
0539e4249b
commit
6fa92f7968
@ -183,7 +183,8 @@ struct TypeDefDefinitionData {
|
||||
definition_spelling == other.definition_spelling &&
|
||||
definition_extent == other.definition_extent &&
|
||||
alias_of == other.alias_of && parents == other.parents &&
|
||||
types == other.types && funcs == other.funcs && vars == other.vars;
|
||||
types == other.types && funcs == other.funcs && vars == other.vars &&
|
||||
hover == other.hover && comments == other.comments;
|
||||
}
|
||||
|
||||
bool operator!=(
|
||||
@ -276,7 +277,8 @@ struct FuncDefDefinitionData {
|
||||
definition_spelling == other.definition_spelling &&
|
||||
definition_extent == other.definition_extent &&
|
||||
declaring_type == other.declaring_type && base == other.base &&
|
||||
locals == other.locals && callees == other.callees;
|
||||
locals == other.locals && callees == other.callees &&
|
||||
hover == other.hover && comments == other.comments;
|
||||
}
|
||||
bool operator!=(
|
||||
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>& other)
|
||||
@ -405,7 +407,8 @@ struct VarDefDefinitionData {
|
||||
definition_spelling == other.definition_spelling &&
|
||||
definition_extent == other.definition_extent &&
|
||||
variable_type == other.variable_type &&
|
||||
declaring_type == other.declaring_type;
|
||||
declaring_type == other.declaring_type && hover == other.hover &&
|
||||
comments == other.comments;
|
||||
}
|
||||
bool operator!=(
|
||||
const VarDefDefinitionData<TypeId, FuncId, VarId, Range>& other) const {
|
||||
|
21
src/query.cc
21
src/query.cc
@ -118,12 +118,21 @@ bool ComputeDifferenceForUpdate(std::vector<T>& previous,
|
||||
std::sort(previous.begin(), previous.end());
|
||||
std::sort(current.begin(), current.end());
|
||||
|
||||
// Returns the elements in |previous| that are not in |current|.
|
||||
std::set_difference(previous.begin(), previous.end(), current.begin(),
|
||||
current.end(), std::back_inserter(*removed));
|
||||
// Returns the elements in |current| that are not in |previous|.
|
||||
std::set_difference(current.begin(), current.end(), previous.begin(),
|
||||
previous.end(), std::back_inserter(*added));
|
||||
auto it0 = previous.begin(), it1 = current.begin();
|
||||
while (it0 != previous.end() && it1 != current.end()) {
|
||||
// Elements in |previous| that are not in |current|.
|
||||
if (*it0 < *it1)
|
||||
removed->push_back(*it0++);
|
||||
// Elements in |current| that are not in |previous|.
|
||||
else if (*it1 < *it0)
|
||||
added->push_back(*it1++);
|
||||
else
|
||||
++it0, ++it1;
|
||||
}
|
||||
while (it0 != previous.end())
|
||||
removed->push_back(*it0++);
|
||||
while (it1 != current.end())
|
||||
added->push_back(*it1++);
|
||||
|
||||
return !removed->empty() || !added->empty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user