From cd50eb9e358d2653853a855f0c5999611d4549dd Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Tue, 18 Apr 2017 22:38:39 -0700 Subject: [PATCH] Positions are now 32 bits (down from 96ish) --- src/indexer.cc | 11 +++++------ src/position.h | 5 +++-- src/serializer.cc | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/indexer.cc b/src/indexer.cc index 8f1c6b42..b86864e2 100644 --- a/src/indexer.cc +++ b/src/indexer.cc @@ -1378,32 +1378,31 @@ std::vector> Parse(IndexerConfig* config, FileConsu entry->id_cache.primary_file = entry->path; } - /* - TODO: Fix interesting checks. + // TODO: Fix interesting checks. for (auto& entry : result) { for (auto& type : entry->types) { if (!type.HasInterestingState()) { - std::cerr << "!!!! NO INTERSETING STATE FOR " << entry->path << " of !!! " << filename << std::endl; + std::cerr << "!!!! NO INTERESTING STATE FOR " << entry->path << " of !!! " << filename << std::endl; std::cerr << "!!!! USR " << type.def.usr << std::endl; assert(false); } } for (auto& func : entry->funcs) { if (!func.HasInterestingState()) { - std::cerr << "!!!! NO INTERSETING STATE FOR " << entry->path << " of !!! " << filename << std::endl; + std::cerr << "!!!! NO INTERESTING STATE FOR " << entry->path << " of !!! " << filename << std::endl; std::cerr << "!!!! USR " << func.def.usr << std::endl; assert(false); } } for (auto& var : entry->vars) { if (!var.HasInterestingState()) { - std::cerr << "!!!! NO INTERSETING STATE FOR " << entry->path << " of !!! " << filename << std::endl; + std::cerr << "!!!! NO INTERESTING STATE FOR " << entry->path << " of !!! " << filename << std::endl; std::cerr << "!!!! USR " << var.def.usr << std::endl; assert(false); } } } - */ + return result; } diff --git a/src/position.h b/src/position.h index 03535424..fd3d576d 100644 --- a/src/position.h +++ b/src/position.h @@ -5,8 +5,8 @@ #include struct Position { - int32_t line = -1; - int32_t column = -1; + int16_t line = -1; + int16_t column = -1; Position(); Position(int32_t line, int32_t column); @@ -21,6 +21,7 @@ struct Position { bool operator!=(const Position& that) const; bool operator<(const Position& that) const; }; +static_assert(sizeof(Position) == 4, "Investigate, Position should be 32-bits for indexer size reasons"); struct Range { Position start; diff --git a/src/serializer.cc b/src/serializer.cc index 6a5b7400..63ba2a99 100644 --- a/src/serializer.cc +++ b/src/serializer.cc @@ -22,7 +22,7 @@ void Reflect(Reader& visitor, std::string& value) { value = visitor.GetString(); } void Reflect(Writer& visitor, std::string& value) { - visitor.String(value.c_str(), value.size()); + visitor.String(value.c_str(), (rapidjson::SizeType)value.size()); } @@ -41,7 +41,7 @@ void Reflect(Reader& visitor, Position& value) { } void Reflect(Writer& visitor, Position& value) { std::string output = value.ToString(); - visitor.String(output.c_str(), output.size()); + visitor.String(output.c_str(), (rapidjson::SizeType)output.size()); } @@ -51,7 +51,7 @@ void Reflect(Reader& visitor, Range& value) { } void Reflect(Writer& visitor, Range& value) { std::string output = value.ToString(); - visitor.String(output.c_str(), output.size()); + visitor.String(output.c_str(), (rapidjson::SizeType)output.size()); } // Id