From 8a8c36562fddd1dcaf5ebc8dee47d7cb20bc7a88 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 3 Jun 1999 02:31:22 +0000 Subject: [PATCH] dwarf2out.c (add_incomplete_type): New fn. * 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 | 7 ++++++ gcc/dwarf2out.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8543d0a1e10..935980a89e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Thu Jun 3 02:15:07 1999 Jason Merrill + + * 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 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 58cf338e72c..f75d2c1e4b7 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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);