Commit 6e75c1a9 by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/37890 (Incorrect nesting for DW_TAG_imported_declaration)

	PR debug/37890
	* dwarf2out.c (gen_namespace_die): Add context_die argument and use
	it for block local namespace aliases.
	(gen_decl_die): Pass context_die to gen_namespace_die.

From-SVN: r144978
parent e471a70a
2009-03-20 Jakub Jelinek <jakub@redhat.com>
PR debug/37890
* dwarf2out.c (gen_namespace_die): Add context_die argument and use
it for block local namespace aliases.
(gen_decl_die): Pass context_die to gen_namespace_die.
2009-03-19 Jakub Jelinek <jakub@redhat.com> 2009-03-19 Jakub Jelinek <jakub@redhat.com>
PR c/39495 PR c/39495
......
...@@ -5172,7 +5172,7 @@ static void gen_type_die (tree, dw_die_ref); ...@@ -5172,7 +5172,7 @@ static void gen_type_die (tree, dw_die_ref);
static void gen_block_die (tree, dw_die_ref, int); static void gen_block_die (tree, dw_die_ref, int);
static void decls_for_scope (tree, dw_die_ref, int); static void decls_for_scope (tree, dw_die_ref, int);
static int is_redundant_typedef (const_tree); static int is_redundant_typedef (const_tree);
static void gen_namespace_die (tree); static void gen_namespace_die (tree, dw_die_ref);
static void gen_decl_die (tree, tree, dw_die_ref); static void gen_decl_die (tree, tree, dw_die_ref);
static dw_die_ref force_decl_die (tree); static dw_die_ref force_decl_die (tree);
static dw_die_ref force_type_die (tree); static dw_die_ref force_type_die (tree);
...@@ -15093,18 +15093,19 @@ declare_in_namespace (tree thing, dw_die_ref context_die) ...@@ -15093,18 +15093,19 @@ declare_in_namespace (tree thing, dw_die_ref context_die)
/* Generate a DIE for a namespace or namespace alias. */ /* Generate a DIE for a namespace or namespace alias. */
static void static void
gen_namespace_die (tree decl) gen_namespace_die (tree decl, dw_die_ref context_die)
{ {
dw_die_ref context_die = setup_namespace_context (decl, comp_unit_die); dw_die_ref namespace_die;
/* Namespace aliases have a DECL_ABSTRACT_ORIGIN of the namespace /* Namespace aliases have a DECL_ABSTRACT_ORIGIN of the namespace
they are an alias of. */ they are an alias of. */
if (DECL_ABSTRACT_ORIGIN (decl) == NULL) if (DECL_ABSTRACT_ORIGIN (decl) == NULL)
{ {
/* Output a real namespace or module. */ /* Output a real namespace or module. */
dw_die_ref namespace_die context_die = setup_namespace_context (decl, comp_unit_die);
= new_die (is_fortran () ? DW_TAG_module : DW_TAG_namespace, namespace_die = new_die (is_fortran ()
context_die, decl); ? DW_TAG_module : DW_TAG_namespace,
context_die, decl);
/* For Fortran modules defined in different CU don't add src coords. */ /* For Fortran modules defined in different CU don't add src coords. */
if (namespace_die->die_tag == DW_TAG_module && DECL_EXTERNAL (decl)) if (namespace_die->die_tag == DW_TAG_module && DECL_EXTERNAL (decl))
add_name_attribute (namespace_die, dwarf2_name (decl, 0)); add_name_attribute (namespace_die, dwarf2_name (decl, 0));
...@@ -15122,9 +15123,11 @@ gen_namespace_die (tree decl) ...@@ -15122,9 +15123,11 @@ gen_namespace_die (tree decl)
dw_die_ref origin_die dw_die_ref origin_die
= force_decl_die (DECL_ABSTRACT_ORIGIN (decl)); = force_decl_die (DECL_ABSTRACT_ORIGIN (decl));
if (DECL_CONTEXT (decl) == NULL_TREE
|| TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)
context_die = setup_namespace_context (decl, comp_unit_die);
/* Now create the namespace alias DIE. */ /* Now create the namespace alias DIE. */
dw_die_ref namespace_die namespace_die = new_die (DW_TAG_imported_declaration, context_die, decl);
= new_die (DW_TAG_imported_declaration, context_die, decl);
add_name_and_src_coords_attributes (namespace_die, decl); add_name_and_src_coords_attributes (namespace_die, decl);
add_AT_die_ref (namespace_die, DW_AT_import, origin_die); add_AT_die_ref (namespace_die, DW_AT_import, origin_die);
equate_decl_number_to_die (decl, namespace_die); equate_decl_number_to_die (decl, namespace_die);
...@@ -15313,7 +15316,7 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die) ...@@ -15313,7 +15316,7 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die)
case NAMESPACE_DECL: case NAMESPACE_DECL:
case IMPORTED_DECL: case IMPORTED_DECL:
gen_namespace_die (decl); gen_namespace_die (decl, context_die);
break; break;
default: default:
......
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