diff options
author | Dodji Seketeli <dodji@redhat.com> | 2008-10-05 21:29:32 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2008-10-05 23:29:32 +0200 |
commit | d19c0f4b4cdf4bdffa313283207aab6d2518f34c (patch) | |
tree | d5227fd86e64dffe3a143d3c68ad3f1e06dab6a5 /gcc/cp/cp-gimplify.c | |
parent | ebb479cd4d397e829eed460bd7ac9040204f8b5a (diff) | |
download | gcc-d19c0f4b4cdf4bdffa313283207aab6d2518f34c.zip gcc-d19c0f4b4cdf4bdffa313283207aab6d2518f34c.tar.gz gcc-d19c0f4b4cdf4bdffa313283207aab6d2518f34c.tar.bz2 |
re PR debug/37410 (DW_TAG_imported_module is not in its DW_TAG_lexical_block)
2008-09-30 Dodji Seketeli <dodji@redhat.com>
gcc/ChangeLog:
PR c++/37410
* dwarf2out.c (dwarf2out_imported_module_or_decl): Split this
function in two, making it call a new and reusable
dwarf2out_imported_module_or_decl() that takes the containing
BLOCK of the declaration in argument.
(dwarf2out_imported_module_or_decl_real): New function.
(decls_for_scope, gen_decl_die, dwarf2out_decl): Take
IMPORTED_DECL in account.
* tree.def: Added IMPORTED_DECL node type.
* tree.h: Added accessors for IMPORTED_DECL nodes.
* tree.c (init_ttree): Initialise IMPORTED_DECL node type.
gcc/cp/ChangeLog:
PR c++/37410
* cp-gimplify.c (cp_gimplify_expr): For each USING_STMT
make sure an IMPORTED_DECL node is added to the BLOCK_VARS list
of the innermost containing BLOCK.
gcc/testsuite/ChangeLog:
PR c++/37410
* g++.dg/debug/dwarf2/imported-module.C: New test.
From-SVN: r140895
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r-- | gcc/cp/cp-gimplify.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 243b1c6..a1542b9 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -508,6 +508,8 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) int saved_stmts_are_full_exprs_p = 0; enum tree_code code = TREE_CODE (*expr_p); enum gimplify_status ret; + tree block = NULL; + VEC(gimple, heap) *bind_expr_stack = NULL; if (STATEMENT_CODE_P (code)) { @@ -574,8 +576,37 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) break; case USING_STMT: - /* Just ignore for now. Eventually we will want to pass this on to - the debugger. */ + /* Get the innermost inclosing GIMPLE_BIND that has a non NULL + BLOCK, and append an IMPORTED_DECL to its + BLOCK_VARS chained list. */ + + bind_expr_stack = gimple_bind_expr_stack (); + if (bind_expr_stack) + { + int i; + for (i = VEC_length (gimple, bind_expr_stack) - 1; i >= 0; i--) + if ((block = gimple_bind_block (VEC_index (gimple, + bind_expr_stack, + i)))) + break; + } + if (block) + { + tree using_directive; + gcc_assert (TREE_OPERAND (*expr_p,0) + && NAMESPACE_DECL_CHECK (TREE_OPERAND (*expr_p, 0))); + + using_directive = make_node (IMPORTED_DECL); + TREE_TYPE (using_directive) = void_type_node; + + IMPORTED_DECL_ASSOCIATED_DECL (using_directive) + = TREE_OPERAND (*expr_p, 0); + DECL_NAME (using_directive) + = DECL_NAME (TREE_OPERAND (*expr_p, 0)); + TREE_CHAIN (using_directive) = BLOCK_VARS (block); + BLOCK_VARS (block) = using_directive; + } + /* The USING_STMT won't appear in GIMPLE. */ *expr_p = NULL; ret = GS_ALL_DONE; break; |