]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2out.c (dwarf2out_imported_module_or_decl_1): Allow non-NAMESPACE_DECL IMPORTED_...
authorJakub Jelinek <jakub@redhat.com>
Tue, 17 Mar 2009 17:51:10 +0000 (18:51 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 17 Mar 2009 17:51:10 +0000 (18:51 +0100)
* dwarf2out.c (dwarf2out_imported_module_or_decl_1): Allow
non-NAMESPACE_DECL IMPORTED_DECL_ASSOCIATED_DECL.

* name-lookup.c (cp_emit_debug_info_for_using): Emit USING_STMTs
instead of calling imported_module_or_decl debug hook if
building_stmt_tree ().
* cp-gimplify.c (cp_gimplify_expr): Don't assert the first operand
is a NAMESPACE_DECL.

From-SVN: r144912

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/name-lookup.c
gcc/dwarf2out.c

index f758952095f8c74f6316b8dd05faa1d66a256616..fae65dbabcbce4e63ffb42363206409a90ea3335 100644 (file)
@@ -1,5 +1,8 @@
 2009-03-17  Jakub Jelinek  <jakub@redhat.com>
 
+       * dwarf2out.c (dwarf2out_imported_module_or_decl_1): Allow
+       non-NAMESPACE_DECL IMPORTED_DECL_ASSOCIATED_DECL.
+
        PR debug/39471
        * dwarf2out.c (dwarf2out_imported_module_or_decl_1): Emit
        DW_TAG_imported_module even if decl is IMPORTED_DECL with
index b015dfa14c4f5507792b5f612cc79d5900a92f96..b25d19be7cbe613a81f8494ab94ba93d014036e4 100644 (file)
@@ -1,5 +1,11 @@
 2009-03-17  Jakub Jelinek  <jakub@redhat.com>
 
+       * name-lookup.c (cp_emit_debug_info_for_using): Emit USING_STMTs
+       instead of calling imported_module_or_decl debug hook if
+       building_stmt_tree ().
+       * cp-gimplify.c (cp_gimplify_expr): Don't assert the first operand
+       is a NAMESPACE_DECL.
+
        PR debug/39471
        * cp-gimplify.c (cp_gimplify_expr): Don't set DECL_NAME
        on IMPORTED_DECL.
index 12d632bdc4b44f07af015e6e4c643ee1c6f80536..bb12988d1faa37ff6596ed656578b4d4ed9c67ce 100644 (file)
@@ -585,8 +585,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
       if (block)
        {
          tree using_directive;
-         gcc_assert (TREE_OPERAND (*expr_p,0)
-                     && NAMESPACE_DECL_CHECK (TREE_OPERAND (*expr_p, 0)));
+         gcc_assert (TREE_OPERAND (*expr_p, 0));
 
          using_directive = make_node (IMPORTED_DECL);
          TREE_TYPE (using_directive) = void_type_node;
index b31742c669cd38cef4f0fd2818b5b31798fed712..eec7c44cbd9e9f593e2e30a9111bbdb205c34ab4 100644 (file)
@@ -5386,7 +5386,12 @@ cp_emit_debug_info_for_using (tree t, tree context)
   /* FIXME: Handle TEMPLATE_DECLs.  */
   for (t = OVL_CURRENT (t); t; t = OVL_NEXT (t))
     if (TREE_CODE (t) != TEMPLATE_DECL)
-      (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false);
+      {
+       if (building_stmt_tree ())
+         add_stmt (build_stmt (USING_STMT, t));
+       else
+         (*debug_hooks->imported_module_or_decl) (t, NULL_TREE, context, false);
+      }
 }
 
 #include "gt-cp-name-lookup.h"
index 79651e135a00049dbfa43dad591cf4c4430bb27f..3ea146881dce4bba549198977148e508d8e07562 100644 (file)
@@ -15361,6 +15361,15 @@ dwarf2out_imported_module_or_decl_1 (tree decl,
   dw_die_ref imported_die = NULL;
   dw_die_ref at_import_die;
 
+  if (TREE_CODE (decl) == IMPORTED_DECL)
+    {
+      xloc = expand_location (DECL_SOURCE_LOCATION (decl));
+      decl = IMPORTED_DECL_ASSOCIATED_DECL (decl);
+      gcc_assert (decl);
+    }
+  else
+    xloc = expand_location (input_location);
+
   if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONST_DECL)
     {
       if (is_base_type (TREE_TYPE (decl)))
@@ -15378,18 +15387,6 @@ dwarf2out_imported_module_or_decl_1 (tree decl,
          gcc_assert (at_import_die);
        }
     }
-  else if (TREE_CODE (decl) == IMPORTED_DECL)
-    {
-      tree imported_ns_decl = IMPORTED_DECL_ASSOCIATED_DECL (decl);
-      /* IMPORTED_DECL nodes that are not imported namespace are just not
-         supported yet.  */
-      gcc_assert (imported_ns_decl
-                 && TREE_CODE (imported_ns_decl) == NAMESPACE_DECL);
-      at_import_die = lookup_decl_die (imported_ns_decl);
-      if (!at_import_die)
-       at_import_die = force_decl_die (imported_ns_decl);
-      gcc_assert (at_import_die);
-    }
   else
     {
       at_import_die = lookup_decl_die (decl);
@@ -15413,10 +15410,7 @@ dwarf2out_imported_module_or_decl_1 (tree decl,
        }
     }
 
-  if (TREE_CODE (decl) == NAMESPACE_DECL
-      || (TREE_CODE (decl) == IMPORTED_DECL
-         && (TREE_CODE (IMPORTED_DECL_ASSOCIATED_DECL (decl))
-             == NAMESPACE_DECL)))
+  if (TREE_CODE (decl) == NAMESPACE_DECL)
     imported_die = new_die (DW_TAG_imported_module,
                            lexical_block_die,
                            lexical_block);
@@ -15425,10 +15419,6 @@ dwarf2out_imported_module_or_decl_1 (tree decl,
                            lexical_block_die,
                            lexical_block);
 
-  if (TREE_CODE (decl) == IMPORTED_DECL)
-    xloc = expand_location (DECL_SOURCE_LOCATION (decl));
-  else
-    xloc = expand_location (input_location);
   add_AT_file (imported_die, DW_AT_decl_file, lookup_filename (xloc.file));
   add_AT_unsigned (imported_die, DW_AT_decl_line, xloc.line);
   if (name)