summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-07-11 12:35:17 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-07-11 13:57:18 +0200
commitde2b65502520d41d387c386877e07fdd2b398adc (patch)
tree7d145099adaa061bfe085153201ec907ac9cc02d /ir/tr
parent5f1aec8f25a1c981047a595235cbb9b4b4fd2d1d (diff)
Remove the unnecessary functions 'get_{class,segment,struct,union}_{ident,name}()'.
Just use 'get_compound_{ident,name}()' instead.
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/trverify.c4
-rw-r--r--ir/tr/type.c76
2 files changed, 10 insertions, 70 deletions
diff --git a/ir/tr/trverify.c b/ir/tr/trverify.c
index 3183db6..83b981f 100644
--- a/ir/tr/trverify.c
+++ b/ir/tr/trverify.c
@@ -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;
diff --git a/ir/tr/type.c b/ir/tr/type.c
index bf3e800..0ef2ec3 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -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;
}