From: Götz Lindenmaier Date: Wed, 7 Aug 2002 13:24:34 +0000 (+0000) Subject: freeing types, otehr stuff i don't remember X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=abab55455758d17de51d901c92d488acc8b824ad;p=libfirm freeing types, otehr stuff i don't remember [r458] --- diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 337db517c..ef73a5478 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -136,6 +136,11 @@ copy_entity_name (entity *old, ident *new_name) { return new; } +void +free_entity (entity *ent) { + /* @@@ */ +} + INLINE const char * get_entity_name (entity *ent) { assert (ent); diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 5581b75f4..f084074d0 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -133,6 +133,9 @@ entity *copy_entity_own (entity *old, type *new_owner); Automatically inserts the new entity as a member of owner. The mangled name ld_name is set to NULL. */ entity *copy_entity_name (entity *old, ident *new_name); +/* Frees the entity. The owner will still contain the pointer to this + entity, as well as all other references! */ +void free_entity (entity *ent); /** manipulate fields of entity **/ const char *get_entity_name (entity *ent); diff --git a/ir/tr/type.c b/ir/tr/type.c index 47abbb269..b536ea2a7 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -48,10 +48,16 @@ unsigned long type_visited; -void -free_type(type *tp) { - /* @@@ not implemented */ +void free_type(type *tp) { + /* Remove from list of all types */ remove_irp_type(tp); + /* Free the attributes of the type. */ + free_type_attrs(tp); + /* Free entities automatically allocated with the type */ + if (is_array_type(tp)) + free_entity(get_array_element_entity(tp)); + /* And now the type itself... */ + free(tp); } INLINE type *