For gcc:
authorGavin Romig-Koch <gavin@cygnus.com>
Fri, 13 Aug 1999 18:22:59 +0000 (18:22 +0000)
committerGavin Romig-Koch <gavin@gcc.gnu.org>
Fri, 13 Aug 1999 18:22:59 +0000 (18:22 +0000)
tree.c (lang_unsave_expr_now) : New.
(unsave_expr_now): Call lang_unsave_expr_now.
tree.h (lang_unsave_expr_now) : New.

For gcc/cp:
cp-tree.h (init_cplus_unsave): New.
(cplus_unsave_expr_now): New.
lex.c (init_parse): Call init_cplus_unsave.
tree.c (init_cplus_unsave): New.
(cplus_unsave_expr_now): New.

From-SVN: r28705

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/lex.c
gcc/cp/tree.c
gcc/tree.c
gcc/tree.h

index 53067506253b753c241714f58f4c93e7bdbcf6a5..eaed9759e8ebe9d79386851413fa520f21ea0cb4 100644 (file)
@@ -1,3 +1,9 @@
+Fri Aug 13 14:18:27 1999  Gavin Romig-Koch  <gavin@cygnus.com>
+
+       tree.c (lang_unsave_expr_now) : New.
+       (unsave_expr_now): Call lang_unsave_expr_now.
+       tree.h (lang_unsave_expr_now) : New.
+
 Fri Aug 13 00:49:46 1999  Jason Merrill  <jason@yorick.cygnus.com>
 
        * toplev.c (flag_new_exceptions): On by default.
index d3cee0da0a8900806a41709c2853cae5b4b76b21..3653b79b895439fa5ad483635b0abb184a45117a 100644 (file)
@@ -1,3 +1,11 @@
+1999-08-13  Gavin Romig-Koch  <gavin@cygnus.com>
+
+       cp-tree.h (init_cplus_unsave): New.
+       (cplus_unsave_expr_now): New.
+       lex.c (init_parse): Call init_cplus_unsave.
+       tree.c (init_cplus_unsave): New.
+       (cplus_unsave_expr_now): New.
+
 1999-08-11  Jason Merrill  <jason@yorick.cygnus.com>
 
        * lang-options.h: Add -fms-extensions.
index e752fdceced96eb30078f499f680facf46b20bae..2e58406a77e0735654c47c61a297cb6fbdd208bd 100644 (file)
@@ -3350,6 +3350,8 @@ extern int yylex                          PROTO((void));
 extern tree arbitrate_lookup                   PROTO((tree, tree, tree));
 
 /* in tree.c */
+extern void init_cplus_unsave                  PROTO((void));
+extern tree cplus_unsave_expr_now               PROTO((tree));
 extern int pod_type_p                          PROTO((tree));
 extern void unshare_base_binfos                        PROTO((tree));
 extern int member_p                            PROTO((tree));
index 30eaa85e4ab4db38ee75b224cf7ad4c3e54cda8d..a92a4f375a66d372cabb7b89f6fa481ce5c43b28 100644 (file)
@@ -524,6 +524,7 @@ init_parse (filename)
   set_identifier_size (sizeof (struct lang_identifier));
   decl_printable_name = lang_printable_name;
 
+  init_cplus_unsave ();
   init_cplus_expand ();
 
   bcopy (cplus_tree_code_type,
index 592b6023dbc8ae9d9d2ba47e963aecff39d4af54..a6bbbe00afd87c4cf8813b57d935b47d2c868944 100644 (file)
@@ -2859,3 +2859,41 @@ make_ptrmem_cst (type, member)
   return ptrmem_cst;
 }
 
+/* Initialize unsave for C++. */
+void
+init_cplus_unsave ()
+{
+  lang_unsave_expr_now = cplus_unsave_expr_now;
+}
+
+/* The C++ version of unsave_expr_now.
+   See gcc/tree.c:unsave_expr_now for comments. */
+
+tree
+cplus_unsave_expr_now (expr)
+     tree expr;
+{
+  if (expr == NULL)
+    return expr;
+
+  else if (TREE_CODE (expr) == AGGR_INIT_EXPR)
+    {
+      unsave_expr_now (TREE_OPERAND (expr,0));
+      if (TREE_OPERAND (expr, 1)
+         && TREE_CODE (TREE_OPERAND (expr, 1)) == TREE_LIST)
+       {
+         tree exp = TREE_OPERAND (expr, 1);
+         while (exp)
+           {
+             unsave_expr_now (TREE_VALUE (exp));
+             exp = TREE_CHAIN (exp);
+           }
+       }
+      unsave_expr_now (TREE_OPERAND (expr,2));
+      return expr;
+    }
+
+  else
+    return expr;
+}
+
index 9ab2fea4f5478ca0b4a980e7216ad8b57773c647..2516301ba54028fa57d8600a9f55b44daefcc0d6 100644 (file)
@@ -269,6 +269,10 @@ static void build_real_from_int_cst_1 PROTO((PTR));
 extern char *mode_name[];
 
 void gcc_obstack_init ();
+
+/* If non-null, a language specific helper for unsave_expr_now. */
+
+int (*lang_unsave_expr_now) PROTO((tree));
 \f
 /* Init the principal obstacks.  */
 
@@ -2426,7 +2430,11 @@ first_rtl_op (code)
 }
 
 /* Modify a tree in place so that all the evaluate only once things
-   are cleared out.  Return the EXPR given.  */
+   are cleared out.  Return the EXPR given.  
+
+   LANG_UNSAVE_EXPR_NOW, if set, is a pointer to a function to handle
+   language specific nodes.
+*/
 
 tree
 unsave_expr_now (expr)
@@ -2473,6 +2481,8 @@ unsave_expr_now (expr)
       break;
 
     default:
+      if (lang_unsave_expr_now)
+       (*lang_unsave_expr_now) (expr);
       break;
     }
 
index a56b202a26885cd19f5e22a28a6f263b40a122b6..08d457012107890068f67b66b7f328f57fcfa993 100644 (file)
@@ -1714,6 +1714,10 @@ extern tree unsave_expr                  PROTO((tree));
 
 extern tree unsave_expr_now            PROTO((tree));
 
+/* If non-null, a language specific helper for unsave_expr_now. */
+
+extern int (*lang_unsave_expr_now)      PROTO((tree));
+  
 /* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
    or offset that depends on a field within a record.