Commit de2b6550 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Remove the unnecessary functions 'get_{class,segment,struct,union}_{ident,name}()'.

Just use 'get_compound_{ident,name}()' instead.
parent 5f1aec8f
......@@ -1014,12 +1014,6 @@ FIRM_API long get_type_nr(const ir_type *tp);
/** Creates a new class type. */
FIRM_API ir_type *new_type_class(ident *name);
/** Returns identifier of the class type */
FIRM_API ident *get_class_ident(const ir_type *clss);
/** Returns identifier of the class type */
FIRM_API const char *get_class_name(const ir_type *clss);
/** Returns the number of members of this class. */
FIRM_API size_t get_class_n_members(const ir_type *clss);
......@@ -1118,12 +1112,6 @@ FIRM_API int is_Class_type(const ir_type *clss);
/** Creates a new type struct */
FIRM_API ir_type *new_type_struct(ident *name);
/** Returns struct identifier */
FIRM_API ident *get_struct_ident(const ir_type *strct);
/** Returns struct identifier as c-string*/
FIRM_API const char *get_struct_name(const ir_type *strct);
/** Returns the number of members of this struct. */
FIRM_API size_t get_struct_n_members(const ir_type *strct);
......@@ -1156,12 +1144,6 @@ FIRM_API int is_Struct_type(const ir_type *strct);
/** Creates a new type union. */
FIRM_API ir_type *new_type_union(ident *name);
/** Returns union identifier */
FIRM_API ident *get_union_ident(const ir_type *uni);
/** Returns union identifier as c-string */
FIRM_API const char *get_union_name(const ir_type *uni);
/** Returns the number of unioned types of this union */
FIRM_API size_t get_union_n_members(const ir_type *uni);
......@@ -1530,9 +1512,6 @@ FIRM_API ir_type *clone_frame_type(ir_type *type);
/** Checks, whether a type is a frame type. */
FIRM_API int is_segment_type(const ir_type *tp);
/** Returns segment identifier. */
FIRM_API ident *get_segment_ident(ir_type const *type);
/** @} */
/**
......
......@@ -366,12 +366,12 @@ static bool verify_info_member(ir_type const *const segment,
ident *const ld_ident = get_entity_ld_ident(entity);
if (ld_ident[0] != '\0') {
report_error("entity %+F in %s segment must not have an ld_name",
entity, get_id_str(get_segment_ident(segment)));
entity, get_compound_name(segment));
fine = false;
}
if ((get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER) == 0) {
report_error("entity %+F in segment %s without LINKAGE_HIDDEN_USER",
entity, get_id_str(get_segment_ident(segment)));
entity, get_compound_name(segment));
fine = false;
}
return fine;
......
......@@ -350,19 +350,6 @@ void free_class_attrs(ir_type *clss)
DEL_ARR_F(clss->attr.cls.supertypes);
}
ident *get_class_ident(const ir_type *clss)
{
assert(is_Class_type(clss));
return clss->name;
}
const char *get_class_name(const ir_type *clss)
{
if (get_class_ident(clss) == NULL)
return NULL;
return get_id_str(get_class_ident(clss));
}
size_t get_class_n_members(const ir_type *clss)
{
assert(is_Class_type(clss));
......@@ -509,20 +496,6 @@ ir_type *new_type_struct(ident *name)
return res;
}
ident *get_struct_ident(const ir_type *strct)
{
assert(is_Struct_type(strct));
return strct->name;
}
const char *get_struct_name(const ir_type *strct)
{
ident *id = get_struct_ident(strct);
if (id == NULL)
return NULL;
return get_id_str(id);
}
size_t get_struct_n_members(const ir_type *strct)
{
assert(is_Struct_type(strct));
......@@ -697,20 +670,6 @@ ir_type *new_type_union(ident *name)
return res;
}
ident *get_union_ident(const ir_type *uni)
{
assert(is_Union_type(uni));
return uni->name;
}
const char *get_union_name(const ir_type *uni)
{
ident *id = get_union_ident(uni);
if (id == NULL)
return NULL;
return get_id_str(id);
}
size_t get_union_n_members(const ir_type *uni)
{
assert(is_Union_type(uni));
......@@ -747,12 +706,6 @@ int (is_segment_type)(ir_type const *const type)
return is_segment_type_(type);
}
ident *get_segment_ident(ir_type const *type)
{
assert(is_segment_type(type));
return type->name;
}
ir_type *new_type_array(ir_type *const element_type, unsigned const n_elements)
{
assert(!is_Method_type(element_type));
......@@ -1024,27 +977,14 @@ void ir_print_type(char *buffer, size_t buffer_size, const ir_type *type)
snprintf(buffer, buffer_size, "code");
return;
case tpo_class: {
ident *id = get_class_ident(type);
snprintf(buffer, buffer_size, "class '%s'", get_id_str(id));
return;
}
case tpo_struct: {
ident *id = get_struct_ident(type);
snprintf(buffer, buffer_size, "struct '%s'", get_id_str(id));
return;
}
case tpo_union: {
ident *id = get_union_ident(type);
snprintf(buffer, buffer_size, "union '%s'", get_id_str(id));
return;
}
case tpo_segment: {
ident *id = get_segment_ident(type);
snprintf(buffer, buffer_size, "segment '%s'", get_id_str(id));
{
char const *kind_name;
case tpo_class: kind_name = "class"; goto compound;
case tpo_struct: kind_name = "struct"; goto compound;
case tpo_union: kind_name = "union"; goto compound;
case tpo_segment: kind_name = "segment"; goto compound;
compound:
snprintf(buffer, buffer_size, "%s '%s'", kind_name, get_compound_name(type));
return;
}
......
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