Add warnings for oversized subtypes

This commit is contained in:
a3d4
2020-07-03 15:18:02 +02:00
parent c2e1273ff4
commit 1c7a0dcbea
4 changed files with 101 additions and 14 deletions
+15 -1
View File
@@ -73,8 +73,22 @@ private:
bool visit(BinaryOperation const& _operation) override;
bool visit(FunctionCall const& _functionCall) override;
struct TypeComp
{
bool operator()(Type const* lhs, Type const* rhs) const
{
solAssert(lhs && rhs, "");
return lhs->richIdentifier() < rhs->richIdentifier();
}
};
using TypeSet = std::set<Type const*, TypeComp>;
/// @returns the size of this type in storage, including all sub-types.
static bigint structureSizeEstimate(Type const& _type, std::set<StructDefinition const*>& _structsSeen);
static bigint structureSizeEstimate(
Type const& _type,
std::set<StructDefinition const*>& _structsSeen,
TypeSet& _oversizedSubTypes
);
langutil::ErrorReporter& m_errorReporter;