]> gcc.gnu.org Git - gcc.git/commitdiff
dwarf2out.c (add_incomplete_type): New fn.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 3 Jun 1999 02:31:22 +0000 (02:31 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 3 Jun 1999 02:31:22 +0000 (22:31 -0400)
* dwarf2out.c (add_incomplete_type): New fn.
(gen_struct_or_union_type_die): Call it.
(retry_incomplete_types): New fn.
(dwarf2out_finish): Call it.

From-SVN: r27325

gcc/ChangeLog
gcc/dwarf2out.c

index 8543d0a1e102d5926c864d204f98f01d0abf59ac..935980a89e493e1aa1dd6a0466489b040bd82047 100644 (file)
@@ -1,3 +1,10 @@
+Thu Jun  3 02:15:07 1999  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * dwarf2out.c (add_incomplete_type): New fn.
+       (gen_struct_or_union_type_die): Call it.
+       (retry_incomplete_types): New fn.
+       (dwarf2out_finish): Call it.
+
 Thu Jun  3 01:19:03 1999  Jeffrey A Law  (law@cygnus.com)
 
        * gcse.c (insert_insn_end_bb): Correct placement of insns when the
index 58cf338e72c9c563ed00dbb0db1b1ea5bda6da44..f75d2c1e4b72dc00920b9a8bcf4ecdc2ae07cf5d 100644 (file)
@@ -2426,6 +2426,22 @@ static unsigned pending_types;
    be enough for most typical programs.         */
 #define PENDING_TYPES_INCREMENT 64
 
+/* A pointer to the base of a list of incomplete types which might be
+   completed at some later time.  */
+
+static tree *incomplete_types_list;
+
+/* Number of elements currently allocated for the incomplete_types_list.  */
+static unsigned incomplete_types_allocated;
+
+/* Number of elements of incomplete_types_list currently in use.  */
+static unsigned incomplete_types;
+
+/* Size (in elements) of increments by which we may expand the incomplete
+   types list.  Actually, a single hunk of space of this size should
+   be enough for most typical programs.         */
+#define INCOMPLETE_TYPES_INCREMENT 64
+
 /* Record whether the function being analyzed contains inlined functions.  */
 static int current_function_has_inlines;
 #if 0 && defined (MIPS_DEBUGGING_INFO)
@@ -8035,6 +8051,39 @@ output_pending_types_for_scope (context_die)
     }
 }
 
+/* Remember a type in the incomplete_types_list.  */
+
+static void
+add_incomplete_type (type)
+     tree type;
+{
+  if (incomplete_types == incomplete_types_allocated)
+    {
+      incomplete_types_allocated += INCOMPLETE_TYPES_INCREMENT;
+      incomplete_types_list
+       = (tree *) xrealloc (incomplete_types_list,
+                            sizeof (tree) * incomplete_types_allocated);
+    }
+
+  incomplete_types_list[incomplete_types++] = type;
+}
+
+/* Walk through the list of incomplete types again, trying once more to
+   emit full debugging info for them.  */
+
+static void
+retry_incomplete_types ()
+{
+  register tree type;
+
+  while (incomplete_types)
+    {
+      --incomplete_types;
+      type = incomplete_types_list[incomplete_types];
+      gen_type_die (type, comp_unit_die);
+    }
+}
+
 /* Generate a DIE to represent an inlined instance of an enumeration type.  */
 
 static void
@@ -9026,7 +9075,10 @@ gen_struct_or_union_type_die (type, context_die)
        }
     }
   else
-    add_AT_flag (type_die, DW_AT_declaration, 1);
+    {
+      add_AT_flag (type_die, DW_AT_declaration, 1);
+      add_incomplete_type (type);
+    }
 }
 
 /* Generate a DIE for a subroutine _type_.  */
@@ -9995,6 +10047,10 @@ dwarf2out_finish ()
       free (node);
     }
 
+  /* Walk through the list of incomplete types again, trying once more to
+     emit full debugging info for them.  */
+  retry_incomplete_types ();
+
   /* Traverse the DIE tree and add sibling attributes to those DIE's
      that have children.  */
   add_sibling_attributes (comp_unit_die);
This page took 0.069651 seconds and 5 git commands to generate.