// Class Thunk_statement. This is the base class for go and defer
// statements.
+Unordered_set(const Struct_type*) Thunk_statement::thunk_types;
+
// Constructor.
Thunk_statement::Thunk_statement(Statement_classification classification,
}
}
- return Type::make_struct_type(fields, location);
+ Struct_type *st = Type::make_struct_type(fields, location);
+
+ Thunk_statement::thunk_types.insert(st);
+
+ return st;
+}
+
+// Return whether ST is a type created to hold thunk parameters.
+
+bool
+Thunk_statement::is_thunk_struct(const Struct_type* st)
+{
+ return (Thunk_statement::thunk_types.find(st)
+ != Thunk_statement::thunk_types.end());
}
// Build the thunk we are going to call. This is a brand new, albeit
bool
simplify_statement(Gogo*, Named_object*, Block*);
+ // Return whether ST is a type created to hold thunk parameters.
+ static bool
+ is_thunk_struct(const Struct_type *st);
+
protected:
int
do_traverse(Traverse* traverse);
void
thunk_field_param(int n, char* buf, size_t buflen);
+ // A list of all the struct types created for thunk statements.
+ static Unordered_set(const Struct_type*) thunk_types;
+
// The function call to be executed in a separate thread (go) or
// later (defer).
Expression* call_;
hash_fnname = "__go_type_hash_identity";
equal_fnname = "__go_type_equal_identity";
}
- else if (!this->is_comparable())
+ else if (!this->is_comparable() ||
+ (this->struct_type() != NULL
+ && Thunk_statement::is_thunk_struct(this->struct_type())))
{
hash_fnname = "__go_type_hash_error";
equal_fnname = "__go_type_equal_error";