diff options
author | Cary Coutant <ccoutant@google.com> | 2011-05-06 17:34:01 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@gcc.gnu.org> | 2011-05-06 10:34:01 -0700 |
commit | 80bde45b083facc3f141c29c8c71d38619b1d9cb (patch) | |
tree | dc95f4e5bf0dcdc9a1a460b9efc473c3c4bad617 | |
parent | 7e1352fe55aa8c9573c9a3e9e3d6d8eed3e879d6 (diff) | |
download | gcc-80bde45b083facc3f141c29c8c71d38619b1d9cb.zip gcc-80bde45b083facc3f141c29c8c71d38619b1d9cb.tar.gz gcc-80bde45b083facc3f141c29c8c71d38619b1d9cb.tar.bz2 |
dwarf2out.c (contains_subprogram_definition): New function.
* dwarf2out.c (contains_subprogram_definition): New function.
(should_move_die_to_comdat): Call it.
From-SVN: r173497
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 22f103e..9d0294e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-05-06 Cary Coutant <ccoutant@google.com> + + * dwarf2out.c (contains_subprogram_definition): New function. + (should_move_die_to_comdat): Call it. + 2011-05-06 Jeff Law <law@redhat.com> * tree-ssa-threadupdate.c (create_block_for_threading): Do not call diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e20b01b..c08f5aa 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: |