Commit 61a3e629 by Jason Merrill Committed by Jason Merrill

dwarf2out.c (is_unit_die): New.

	* dwarf2out.c (is_unit_die): New.
	(copy_declaration_context, copy_ancestor_tree): Use it.
	(copy_decls_walk): Likewise.

From-SVN: r188209
parent a67cfde8
2012-06-04 Jason Merrill <jason@redhat.com>
* dwarf2out.c (is_unit_die): New.
(copy_declaration_context, copy_ancestor_tree): Use it.
(copy_decls_walk): Likewise.
2012-06-04 Paolo Carlini <paolo.carlini@oracle.com> 2012-06-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53524 PR c++/53524
......
...@@ -5972,6 +5972,16 @@ is_cu_die (dw_die_ref c) ...@@ -5972,6 +5972,16 @@ is_cu_die (dw_die_ref c)
return c && c->die_tag == DW_TAG_compile_unit; return c && c->die_tag == DW_TAG_compile_unit;
} }
/* Returns true iff C is a unit DIE of some sort. */
static inline bool
is_unit_die (dw_die_ref c)
{
return c && (c->die_tag == DW_TAG_compile_unit
|| c->die_tag == DW_TAG_partial_unit
|| c->die_tag == DW_TAG_type_unit);
}
static char * static char *
gen_internal_sym (const char *prefix) gen_internal_sym (const char *prefix)
{ {
...@@ -6379,8 +6389,7 @@ copy_declaration_context (dw_die_ref unit, dw_die_ref die) ...@@ -6379,8 +6389,7 @@ copy_declaration_context (dw_die_ref unit, dw_die_ref die)
} }
if (decl->die_parent != NULL if (decl->die_parent != NULL
&& decl->die_parent->die_tag != DW_TAG_compile_unit && !is_unit_die (decl->die_parent))
&& decl->die_parent->die_tag != DW_TAG_type_unit)
{ {
new_decl = copy_ancestor_tree (unit, decl, NULL); new_decl = copy_ancestor_tree (unit, decl, NULL);
if (new_decl != NULL) if (new_decl != NULL)
...@@ -6654,8 +6663,7 @@ copy_ancestor_tree (dw_die_ref unit, dw_die_ref die, htab_t decl_table) ...@@ -6654,8 +6663,7 @@ copy_ancestor_tree (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
dw_die_ref spec = get_AT_ref (parent, DW_AT_specification); dw_die_ref spec = get_AT_ref (parent, DW_AT_specification);
if (spec != NULL) if (spec != NULL)
parent = spec; parent = spec;
if (parent->die_tag != DW_TAG_compile_unit if (!is_unit_die (parent))
&& parent->die_tag != DW_TAG_type_unit)
new_parent = copy_ancestor_tree (unit, parent, decl_table); new_parent = copy_ancestor_tree (unit, parent, decl_table);
} }
...@@ -6754,8 +6762,7 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table) ...@@ -6754,8 +6762,7 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
/* If TARG has surrounding context, copy its ancestor tree /* If TARG has surrounding context, copy its ancestor tree
into the new type unit. */ into the new type unit. */
if (targ->die_parent != NULL if (targ->die_parent != NULL
&& targ->die_parent->die_tag != DW_TAG_compile_unit && !is_unit_die (targ->die_parent))
&& targ->die_parent->die_tag != DW_TAG_type_unit)
parent = copy_ancestor_tree (unit, targ->die_parent, parent = copy_ancestor_tree (unit, targ->die_parent,
decl_table); decl_table);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment