Remove HasInterestingState().

These don't serve any real purpose since the multi-file indexer tests.
This commit is contained in:
Jacob Dufault 2017-05-27 00:47:03 -07:00
parent 79a4d8ad79
commit 968b6c0966
4 changed files with 2 additions and 131 deletions

View File

@ -3001,10 +3001,12 @@ int main(int argc, char** argv) {
for (int i = 0; i < 1; ++i)
RunTests();
/*
for (int i = 0; i < 1; ++i) {
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cerr << "[POST] Memory usage: " << GetProcessMemoryUsedInMb() << "mb" << std::endl;
}
*/
std::cerr << std::endl << "[Enter] to exit" << std::endl;
std::cin.get();

View File

@ -1596,31 +1596,6 @@ std::vector<std::unique_ptr<IndexFile>> Parse(
entry->args = args;
}
// TODO: Fix interesting checks.
for (auto& entry : result) {
for (auto& type : entry->types) {
if (!type.HasInterestingState()) {
std::cerr << "!!!! NO INTERESTING STATE FOR " << entry->path << " of !!! " << file << std::endl;
std::cerr << "!!!! USR " << type.def.usr << std::endl;
assert(false);
}
}
for (auto& func : entry->funcs) {
if (!func.HasInterestingState()) {
std::cerr << "!!!! NO INTERESTING STATE FOR " << entry->path << " of !!! " << file << std::endl;
std::cerr << "!!!! USR " << func.def.usr << std::endl;
assert(false);
}
}
for (auto& var : entry->vars) {
if (!var.HasInterestingState()) {
std::cerr << "!!!! NO INTERESTING STATE FOR " << entry->path << " of !!! " << file << std::endl;
std::cerr << "!!!! USR " << var.def.usr << std::endl;
assert(false);
}
}
}
return result;
}

View File

@ -177,19 +177,6 @@ struct TypeDefDefinitionData {
TypeDefDefinitionData() {} // For reflection.
TypeDefDefinitionData(const std::string& usr) : usr(usr) {}
bool HasInterestingState() const {
return
!short_name.empty() ||
!detailed_name.empty() ||
definition_spelling ||
definition_extent ||
alias_of ||
!parents.empty() ||
!types.empty() ||
!funcs.empty() ||
!vars.empty();
}
bool operator==(const TypeDefDefinitionData<TypeId, FuncId, VarId, Range>&
other) const {
return usr == other.usr && short_name == other.short_name &&
@ -247,14 +234,6 @@ struct IndexType {
IndexType(IndexTypeId id, const std::string& usr);
bool HasInterestingState() const {
return
def.HasInterestingState() ||
!derived.empty() ||
!instances.empty() ||
!uses.empty();
}
bool operator<(const IndexType& other) const {
return def.usr < other.def.usr;
}
@ -292,18 +271,6 @@ struct FuncDefDefinitionData {
// assert(usr.size() > 0);
}
bool HasInterestingState() const {
return
!short_name.empty() ||
!detailed_name.empty() ||
definition_spelling ||
definition_extent ||
declaring_type ||
base ||
!locals.empty() ||
!callees.empty();
}
bool operator==(
const FuncDefDefinitionData<TypeId, FuncId, VarId, FuncRef, Range>&
other) const {
@ -367,15 +334,6 @@ struct IndexFunc {
// assert(usr.size() > 0);
}
bool HasInterestingState() const {
return
def.HasInterestingState() ||
!def.callees.empty() ||
!declarations.empty() ||
!derived.empty() ||
!callers.empty();
}
bool operator<(const IndexFunc& other) const {
return def.usr < other.def.usr;
}
@ -409,16 +367,6 @@ struct VarDefDefinitionData {
VarDefDefinitionData() {} // For reflection.
VarDefDefinitionData(const std::string& usr) : usr(usr) {}
bool HasInterestingState() const {
return
!short_name.empty() ||
!detailed_name.empty() ||
declaration ||
definition_spelling ||
definition_extent ||
variable_type ||
declaring_type;
}
bool operator==(const VarDefDefinitionData<TypeId, FuncId, VarId, Range>&
other) const {
return usr == other.usr && short_name == other.short_name &&
@ -469,12 +417,6 @@ struct IndexVar {
// assert(usr.size() > 0);
}
bool HasInterestingState() const {
return
def.HasInterestingState() ||
!uses.empty();
}
bool operator<(const IndexVar& other) const {
return def.usr < other.def.usr;
}

View File

@ -71,22 +71,6 @@ void ReflectMember(Writer& visitor, const char* name, std::string& value) {
// TODO: Move this to indexer.cc
// IndexType
bool ReflectMemberStart(Reader& reader, IndexType& value) {
//value.is_bad_def = false;
return true;
}
bool ReflectMemberStart(Writer& writer, IndexType& value) {
// TODO: this is crashing
// if (!value.HasInterestingState())
// std::cerr << "bad";
// assert(value.HasInterestingState());
if (!value.HasInterestingState())
return false;
DefaultReflectMemberStart(writer);
return true;
}
template<typename TVisitor>
void Reflect(TVisitor& visitor, IndexType& value) {
REFLECT_MEMBER_START();
@ -108,22 +92,6 @@ void Reflect(TVisitor& visitor, IndexType& value) {
}
// IndexFunc
bool ReflectMemberStart(Reader& reader, IndexFunc& value) {
//value.is_bad_def = false;
return true;
}
bool ReflectMemberStart(Writer& writer, IndexFunc& value) {
// TODO: this is crashing
// if (!value.HasInterestingState())
// std::cerr << "bad";
// assert(value.HasInterestingState());
if (!value.HasInterestingState())
return false;
DefaultReflectMemberStart(writer);
return true;
}
template<typename TVisitor>
void Reflect(TVisitor& visitor, IndexFunc& value) {
REFLECT_MEMBER_START();
@ -144,22 +112,6 @@ void Reflect(TVisitor& visitor, IndexFunc& value) {
}
// IndexVar
bool ReflectMemberStart(Reader& reader, IndexVar& value) {
//value.is_bad_def = false;
return true;
}
bool ReflectMemberStart(Writer& writer, IndexVar& value) {
// TODO: this is crashing
// if (!value.HasInterestingState())
// std::cerr << "bad";
// assert(value.HasInterestingState());
if (!value.HasInterestingState())
return false;
DefaultReflectMemberStart(writer);
return true;
}
template<typename TVisitor>
void Reflect(TVisitor& visitor, IndexVar& value) {
REFLECT_MEMBER_START();