OSDN Git Service

* dbxout.c: Include expr.h.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Sep 2005 21:00:49 +0000 (21:00 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Sep 2005 21:00:49 +0000 (21:00 +0000)
        (dbxout_global_decl): Don't suppress for DECL_RTL unset.
        (dbxout_symbol): Handle DECL_VALUE_EXPR.
        * Makefile.in (dbxout.o): Add EXPR_H.
cp/
        * cp-tree.def (ALIAS_DECL): Remove.
        * cp-lang.c (cp_init_ts): Remove support for it.
        * error.c (dump_decl): Likewise.
        * name-lookup.c (pushdecl): Likewise.
        * semantics.c (finish_id_expression): Likewise.
        * decl2.c (build_anon_union_vars): Use a VAR_DECL with
        DECL_VALUE_EXPR instead.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104106 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/cp-tree.def
gcc/cp/decl2.c
gcc/cp/error.c
gcc/cp/name-lookup.c
gcc/cp/semantics.c
gcc/dbxout.c

index 549a9b7..1672806 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-09  Richard Henderson  <rth@redhat.com>
+
+       PR debug/20998
+       * dbxout.c: Include expr.h.
+       (dbxout_global_decl): Don't suppress for DECL_RTL unset.
+       (dbxout_symbol): Handle DECL_VALUE_EXPR.
+       * Makefile.in (dbxout.o): Add EXPR_H.
+
 2005-09-09  Zdenek Dvorak  <dvorakz@suse.cz>
 
        PR tree-optimization/23509
index 3ed7186..f260f37 100644 (file)
@@ -2103,10 +2103,10 @@ optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
    $(TREE_H) $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) libfuncs.h \
    $(RECOG_H) reload.h toplev.h $(GGC_H) real.h $(TM_P_H) except.h \
    gt-optabs.h $(BASIC_BLOCK_H) $(TARGET_H) function.h
-dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
-   $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h langhooks.h \
-   insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h toplev.h \
-   $(GGC_H) $(OBSTACK_H) gt-dbxout.h
+dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+   $(RTL_H) $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) function.h \
+   langhooks.h insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h \
+   toplev.h $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
 debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
 sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
    $(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
index ae12c20..7aa392f 100644 (file)
@@ -1,3 +1,14 @@
+2005-09-09  Richard Henderson  <rth@redhat.com>
+
+       PR debug/20998
+       * cp-tree.def (ALIAS_DECL): Remove.
+       * cp-lang.c (cp_init_ts): Remove support for it.
+       * error.c (dump_decl): Likewise.
+       * name-lookup.c (pushdecl): Likewise.
+       * semantics.c (finish_id_expression): Likewise.
+       * decl2.c (build_anon_union_vars): Use a VAR_DECL with
+       DECL_VALUE_EXPR instead.
+
 2005-09-09  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/22252
index c79486a..38e2e5a 100644 (file)
@@ -117,27 +117,22 @@ cp_init_ts (void)
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_NON_COMMON] = 1;
 
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_WITH_VIS] = 1;
 
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_WRTL] = 1;
   
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_COMMON] = 1;
  
   tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
   tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1;
   tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1;
-  tree_contains_struct[ALIAS_DECL][TS_DECL_MINIMAL] = 1;
 
   init_shadowed_var_for_decl ();
 
index 7f0c1fc..096d00a 100644 (file)
@@ -87,10 +87,6 @@ DEFTREECODE (THROW_EXPR, "throw_expr", tcc_expression, 1)
    these to avoid actually creating instances of the empty classes.  */
 DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", tcc_expression, 0)
 
-/* A DECL which is really just a placeholder for an expression.  Used to
-   implement non-class scope anonymous unions.  */
-DEFTREECODE (ALIAS_DECL, "alias_decl", tcc_declaration, 0)
-
 /* A reference to a member function or member functions from a base
    class.  BASELINK_FUNCTIONS gives the FUNCTION_DECL,
    TEMPLATE_DECL, OVERLOAD, or TEMPLATE_ID_EXPR corresponding to the
index 8a7d7d6..8ef6fa8 100644 (file)
@@ -1057,7 +1057,7 @@ cplus_decl_attributes (tree *decl, tree attributes, int flags)
 }
 \f
 /* Walks through the namespace- or function-scope anonymous union
-   OBJECT, with the indicated TYPE, building appropriate ALIAS_DECLs.
+   OBJECT, with the indicated TYPE, building appropriate VAR_DECLs.
    Returns one of the fields for use in the mangled name.  */
 
 static tree
@@ -1101,11 +1101,12 @@ build_anon_union_vars (tree type, tree object)
 
       if (DECL_NAME (field))
        {
-         decl = build_decl (ALIAS_DECL, DECL_NAME (field), TREE_TYPE (field));
-         DECL_INITIAL (decl) = ref;
-         TREE_PUBLIC (decl) = 0;
-         TREE_STATIC (decl) = 0;
-         DECL_EXTERNAL (decl) = 1;
+         decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
+         TREE_PUBLIC (decl) = TREE_PUBLIC (object);
+         TREE_STATIC (decl) = TREE_PUBLIC (object);
+         DECL_EXTERNAL (decl) = DECL_EXTERNAL (object);
+         SET_DECL_VALUE_EXPR (decl, ref);
+         DECL_HAS_VALUE_EXPR_P (decl) = 1;
          decl = pushdecl (decl);
        }
       else if (ANON_AGGR_TYPE_P (TREE_TYPE (field)))
index 9905e25..1220119 100644 (file)
@@ -744,7 +744,6 @@ dump_decl (tree t, int flags)
       /* Else fall through.  */
     case FIELD_DECL:
     case PARM_DECL:
-    case ALIAS_DECL:
       dump_simple_decl (t, TREE_TYPE (t), flags);
       break;
 
index f936a86..cba9393 100644 (file)
@@ -831,7 +831,6 @@ pushdecl (tree x)
                && t != NULL_TREE)
              && (TREE_CODE (x) == TYPE_DECL
                  || TREE_CODE (x) == VAR_DECL
-                 || TREE_CODE (x) == ALIAS_DECL
                  || TREE_CODE (x) == NAMESPACE_DECL
                  || TREE_CODE (x) == CONST_DECL
                  || TREE_CODE (x) == TEMPLATE_DECL))
index 3691457..0e926bf 100644 (file)
@@ -2747,11 +2747,6 @@ finish_id_expression (tree id_expression,
 
          decl = convert_from_reference (decl);
        }
-
-      /* Resolve references to variables of anonymous unions
-        into COMPONENT_REFs.  */
-      if (TREE_CODE (decl) == ALIAS_DECL)
-       decl = unshare_expr (DECL_INITIAL (decl));
     }
 
   if (TREE_DEPRECATED (decl))
index caff4f2..48c00b5 100644 (file)
@@ -89,6 +89,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #include "target.h"
 #include "langhooks.h"
 #include "obstack.h"
+#include "expr.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"
@@ -1319,9 +1320,7 @@ dbxout_function_decl (tree decl)
 static void
 dbxout_global_decl (tree decl)
 {
-  if (TREE_CODE (decl) == VAR_DECL
-      && ! DECL_EXTERNAL (decl)
-      && DECL_RTL_SET_P (decl))        /* Not necessary?  */
+  if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
     {
       int saved_tree_used = TREE_USED (decl);
       TREE_USED (decl) = 1;
@@ -2337,6 +2336,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
   tree type = TREE_TYPE (decl);
   tree context = NULL_TREE;
   int result = 0;
+  rtx decl_rtl;
 
   /* "Intercept" dbxout_symbol() calls like we do all debug_hooks.  */
   ++debug_nesting;
@@ -2421,7 +2421,8 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
       break;
 
     case FUNCTION_DECL:
-      if (DECL_RTL (decl) == 0)
+      decl_rtl = DECL_RTL_IF_SET (decl);
+      if (!decl_rtl)
        DBXOUT_DECR_NESTING_AND_RETURN (0);
       if (DECL_EXTERNAL (decl))
        break;
@@ -2432,8 +2433,8 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
       /* Don't mention an inline instance of a nested function.  */
       if (context && DECL_FROM_INLINE (decl))
        break;
-      if (!MEM_P (DECL_RTL (decl))
-         || GET_CODE (XEXP (DECL_RTL (decl), 0)) != SYMBOL_REF)
+      if (!MEM_P (decl_rtl)
+         || GET_CODE (XEXP (decl_rtl, 0)) != SYMBOL_REF)
        break;
 
       dbxout_begin_complex_stabs ();
@@ -2457,8 +2458,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
          stabstr_I (DECL_NAME (context));
        }
 
-      dbxout_finish_complex_stabs (decl, N_FUN, XEXP (DECL_RTL (decl), 0),
-                                  0, 0);
+      dbxout_finish_complex_stabs (decl, N_FUN, XEXP (decl_rtl, 0), 0, 0);
       break;
 
     case TYPE_DECL:
@@ -2609,14 +2609,25 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
 
     case RESULT_DECL:
       /* Named return value, treat like a VAR_DECL.  */
+      decl_rtl = DECL_RTL_IF_SET (decl);
+      goto do_var_decl;
+
     case VAR_DECL:
-      if (! DECL_RTL_SET_P (decl))
-       DBXOUT_DECR_NESTING_AND_RETURN (0);
       /* Don't mention a variable that is external.
         Let the file that defines it describe it.  */
       if (DECL_EXTERNAL (decl))
        break;
 
+      if (DECL_HAS_VALUE_EXPR_P (decl))
+       decl_rtl = expand_expr (DECL_VALUE_EXPR (decl), NULL_RTX, VOIDmode,
+                               EXPAND_INITIALIZER);
+      else
+       decl_rtl = DECL_RTL_IF_SET (decl);
+
+    do_var_decl:
+      if (!decl_rtl)
+       DBXOUT_DECR_NESTING_AND_RETURN (0);
+
       /* If the variable is really a constant
         and not written in memory, inform the debugger.
 
@@ -2649,13 +2660,13 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
        }
       /* else it is something we handle like a normal variable.  */
 
-      SET_DECL_RTL (decl, eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
+      decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX);
 #ifdef LEAF_REG_REMAP
       if (current_function_uses_only_leaf_regs)
-       leaf_renumber_regs_insn (DECL_RTL (decl));
+       leaf_renumber_regs_insn (decl_rtl);
 #endif
 
-      result = dbxout_symbol_location (decl, type, 0, DECL_RTL (decl));
+      result = dbxout_symbol_location (decl, type, 0, decl_rtl);
       break;
 
     default: