diff options
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e024249c54e..4c89d95f12e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1,6 +1,6 @@ /* Output Dwarf2 format symbol table information from GCC. Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Gary Funck (gary@intrepid.com). Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com). Extensively modified by Jason Merrill (jason@cygnus.com). @@ -3658,6 +3658,7 @@ static bool is_java (void); static bool is_fortran (void); static bool is_ada (void); static void remove_AT (dw_die_ref, enum dwarf_attribute); +static void remove_child_TAG (dw_die_ref, enum dwarf_tag); static inline void free_die (dw_die_ref); static void remove_children (dw_die_ref); static void add_child_die (dw_die_ref, dw_die_ref); @@ -5064,6 +5065,34 @@ remove_AT (dw_die_ref die, enum dwarf_attribute attr_kind) } } +/* Remove child die whose die_tag is specified tag. */ + +static void +remove_child_TAG (dw_die_ref die, enum dwarf_tag tag) +{ + dw_die_ref current, prev, next; + current = die->die_child; + prev = NULL; + while (current != NULL) + { + if (current->die_tag == tag) + { + next = current->die_sib; + if (prev == NULL) + die->die_child = next; + else + prev->die_sib = next; + free_die (current); + current = next; + } + else + { + prev = current; + current = current->die_sib; + } + } +} + /* Free up the memory used by DIE. */ static inline void @@ -10271,7 +10300,8 @@ scope_die_for (tree t, dw_die_ref context_die) if (containing_scope && TREE_CODE (containing_scope) == FUNCTION_TYPE) containing_scope = NULL_TREE; - if (containing_scope == NULL_TREE) + if (containing_scope == NULL_TREE + || TREE_CODE (containing_scope) == TRANSLATION_UNIT_DECL) scope_die = comp_unit_die; else if (TYPE_P (containing_scope)) { @@ -10908,9 +10938,9 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) { subr_die = old_die; - /* Clear out the declaration attribute and the parm types. */ + /* Clear out the declaration attribute and the formal parameters. */ remove_AT (subr_die, DW_AT_declaration); - remove_children (subr_die); + remove_child_TAG (subr_die, DW_TAG_formal_parameter); } else { |