(integrate_decl_tree): Use copy_node to make a copy of the decl.
authorJason Merrill <merrill@gnu.org>
Sat, 14 May 1994 01:56:51 +0000 (01:56 +0000)
committerJason Merrill <merrill@gnu.org>
Sat, 14 May 1994 01:56:51 +0000 (01:56 +0000)
(integrate_decl_tree): Use copy_node to make a copy
        of the decl.  Also call copy_lang_decl to copy the
        language-specific bits.

From-SVN: r7296

gcc/integrate.c

index e0b6f7a4d01a488a38cb2e46ce5d34093212e8cd..0d03ba85812ded0fcade92120597eb0b8f2e359c 100644 (file)
@@ -1925,9 +1925,13 @@ integrate_decl_tree (let, level, map)
   
   for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
     {
-      tree d = build_decl (TREE_CODE (t), DECL_NAME (t), TREE_TYPE (t));
-      DECL_SOURCE_LINE (d) = DECL_SOURCE_LINE (t);
-      DECL_SOURCE_FILE (d) = DECL_SOURCE_FILE (t);
+      tree d;
+
+      push_obstacks_nochange ();
+      saveable_allocation ();
+      d = copy_node (t);
+      pop_obstacks ();
+
       if (DECL_RTL (t) != 0)
        {
          DECL_RTL (d) = copy_rtx_and_substitute (DECL_RTL (t), map);
@@ -1938,19 +1942,14 @@ integrate_decl_tree (let, level, map)
          subst_constants (&DECL_RTL (d), NULL_RTX, map);
          apply_change_group ();
        }
-      else if (DECL_RTL (t))
-       DECL_RTL (d) = copy_rtx (DECL_RTL (t));
-      DECL_EXTERNAL (d) = DECL_EXTERNAL (t);
-      TREE_STATIC (d) = TREE_STATIC (t);
-      TREE_PUBLIC (d) = TREE_PUBLIC (t);
-      TREE_CONSTANT (d) = TREE_CONSTANT (t);
-      TREE_ADDRESSABLE (d) = TREE_ADDRESSABLE (t);
-      TREE_READONLY (d) = TREE_READONLY (t);
-      TREE_SIDE_EFFECTS (d) = TREE_SIDE_EFFECTS (t);
       /* These args would always appear unused, if not for this.  */
       TREE_USED (d) = 1;
       /* Prevent warning for shadowing with these.  */
       DECL_ABSTRACT_ORIGIN (d) = t;
+
+      if (DECL_LANG_SPECIFIC (d))
+       copy_lang_decl (d);
+
       pushdecl (d);
     }