freeing types, otehr stuff i don't remember
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 7 Aug 2002 13:24:34 +0000 (13:24 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 7 Aug 2002 13:24:34 +0000 (13:24 +0000)
[r458]

ir/tr/entity.c
ir/tr/entity.h
ir/tr/type.c

index 337db51..ef73a54 100644 (file)
@@ -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);
index 5581b75..f084074 100644 (file)
@@ -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);
index 47abbb2..b536ea2 100644 (file)
 
 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 *