summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2008-10-05 21:29:32 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2008-10-05 23:29:32 +0200
commitd19c0f4b4cdf4bdffa313283207aab6d2518f34c (patch)
treed5227fd86e64dffe3a143d3c68ad3f1e06dab6a5 /gcc/cp
parentebb479cd4d397e829eed460bd7ac9040204f8b5a (diff)
downloadgcc-d19c0f4b4cdf4bdffa313283207aab6d2518f34c.tar.gz
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')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-gimplify.c35
-rw-r--r--gcc/cp/name-lookup.c11
3 files changed, 45 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index acb766f7124..eeeb239b720 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-05 Dodji Seketeli <dodji@redhat.com>
+
+ 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.
+
2008-10-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37719
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 243b1c61bfb..a1542b9f804 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;
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index a04d7312216..0da373ce2a6 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3484,7 +3484,6 @@ do_using_directive (tree name_space)
if (!toplevel_bindings_p ())
{
push_using_directive (name_space);
- context = current_scope ();
}
else
{
@@ -3492,12 +3491,12 @@ do_using_directive (tree name_space)
add_using_namespace (current_namespace, name_space, 0);
if (current_namespace != global_namespace)
context = current_namespace;
- }
- /* Emit debugging info. */
- if (!processing_template_decl)
- (*debug_hooks->imported_module_or_decl) (name_space, NULL_TREE,
- context, false);
+ /* Emit debugging info. */
+ if (!processing_template_decl)
+ (*debug_hooks->imported_module_or_decl) (name_space, NULL_TREE,
+ context, false);
+ }
}
/* Deal with a using-directive seen by the parser. Currently we only