From: Cary Coutant Date: Fri, 6 May 2011 17:34:01 +0000 (+0000) Subject: dwarf2out.c (contains_subprogram_definition): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80bde45b083facc3f141c29c8c71d38619b1d9cb;p=gcc.git dwarf2out.c (contains_subprogram_definition): New function. * dwarf2out.c (contains_subprogram_definition): New function. (should_move_die_to_comdat): Call it. From-SVN: r173497 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 22f103ed76d..9d0294e369c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-05-06 Cary Coutant + + * dwarf2out.c (contains_subprogram_definition): New function. + (should_move_die_to_comdat): Call it. + 2011-05-06 Jeff Law * tree-ssa-threadupdate.c (create_block_for_threading): Do not call diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e20b01b7479..c08f5aac614 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10170,6 +10170,20 @@ is_nested_in_subprogram (dw_die_ref die) return local_scope_p (decl); } +/* Return non-zero if this DIE contains a defining declaration of a + subprogram. */ + +static int +contains_subprogram_definition (dw_die_ref die) +{ + dw_die_ref c; + + if (die->die_tag == DW_TAG_subprogram && ! is_declaration_die (die)) + return 1; + FOR_EACH_CHILD (die, c, if (contains_subprogram_definition(c)) return 1); + return 0; +} + /* Return non-zero if this is a type DIE that should be moved to a COMDAT .debug_types section. */ @@ -10188,6 +10202,8 @@ should_move_die_to_comdat (dw_die_ref die) || get_AT (die, DW_AT_abstract_origin) || is_nested_in_subprogram (die)) return 0; + /* A type definition should never contain a subprogram definition. */ + gcc_assert (!contains_subprogram_definition (die)); return 1; case DW_TAG_array_type: case DW_TAG_interface_type: