Commit 2028883f authored by Matthias Braun's avatar Matthias Braun
Browse files

unify compound type code

parent 87fe2cba
......@@ -44,7 +44,7 @@ static const tp_op_ops
/** tpop operations for class types */
class_ops = {
.free_attrs = free_class_attrs,
.free_entities = free_class_entities,
.free_entities = free_compound_entities,
.set_type_mode = set_class_mode,
.set_type_size = set_default_size,
.get_n_members = get_class_n_members,
......@@ -54,7 +54,7 @@ static const tp_op_ops
/** tpop operations for struct types */
struct_ops = {
.free_attrs = free_struct_attrs,
.free_entities = free_struct_entities,
.free_entities = free_compound_entities,
.set_type_mode = set_struct_mode,
.set_type_size = set_default_size,
.get_n_members = get_struct_n_members,
......@@ -68,7 +68,7 @@ static const tp_op_ops
/** tpop operations for union types */
union_ops = {
.free_attrs = free_union_attrs,
.free_entities = free_union_entities,
.free_entities = free_compound_entities,
.set_type_size = set_default_size,
.get_n_members = get_union_n_members,
.get_member = get_union_member,
......
......@@ -365,7 +365,7 @@ static void compound_add_member(ir_type *type, ir_entity *entity)
ARR_APP1(ir_entity *, type->attr.ca.members, entity);
}
static void compound_free_entities(ir_type *type)
void free_compound_entities(ir_type *type)
{
for (size_t i = compound_get_n_members(type); i-- > 0; )
free_entity(compound_get_member(type, i));
......@@ -403,12 +403,6 @@ ir_type *new_type_class(ident *name)
return res;
}
void free_class_entities(ir_type *clss)
{
assert(is_Class_type(clss));
compound_free_entities(clss);
}
void free_class_attrs(ir_type *clss)
{
assert(is_Class_type(clss));
......@@ -595,12 +589,6 @@ ir_type *new_type_struct(ident *name)
return res;
}
void free_struct_entities(ir_type *strct)
{
assert(is_Struct_type(strct));
compound_free_entities(strct);
}
void free_struct_attrs(ir_type *strct)
{
assert(is_Struct_type(strct));
......@@ -823,12 +811,6 @@ ir_type *new_type_union(ident *name)
return res;
}
void free_union_entities(ir_type *uni)
{
assert(is_Union_type(uni));
compound_free_entities(uni);
}
void free_union_attrs(ir_type *uni)
{
assert(is_Union_type(uni));
......
......@@ -153,9 +153,7 @@ struct ir_type {
void free_type_entities(ir_type *tp);
void free_class_entities(ir_type *clss);
void free_struct_entities(ir_type *strct);
void free_union_entities(ir_type *uni);
void free_compound_entities(ir_type *type);
void free_class_attrs(ir_type *clss);
void free_struct_attrs(ir_type *strct);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment