OSDN Git Service

* cp-tree.h (remap_save_expr): Add walk_subtrees parameter.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Dec 1999 18:52:40 +0000 (18:52 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Dec 1999 18:52:40 +0000 (18:52 +0000)
* optimize.c (copy_body_r): Pass it.
* tree.c (remap_save_expr): Clear walk_subtrees for an
already-handled SAVE_EXPR.
(cp_unsave_r): Pass walk_subtrees to remap_save_expr.

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

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/optimize.c
gcc/cp/tree.c
gcc/testsuite/g++.old-deja/g++.other/inline3.C [new file with mode: 0644]

index 3f44c78..31b963e 100644 (file)
@@ -1,5 +1,11 @@
 1999-12-14  Mark Mitchell  <mark@codesourcery.com>
 
+       * cp-tree.h (remap_save_expr): Add walk_subtrees parameter.
+       * optimize.c (copy_body_r): Pass it.
+       * tree.c (remap_save_expr): Clear walk_subtrees for an
+       already-handled SAVE_EXPR.
+       (cp_unsave_r): Pass walk_subtrees to remap_save_expr.
+
        * dump.c (dequeue_and_dump): Dump DECL_NAMESPACE_ALIAS.
        * ir.texi (DECL_NAMESPACE_ALIAS): Document it.
 
index 90f652f..99b2580 100644 (file)
@@ -4064,7 +4064,7 @@ extern tree copy_tree_r                         PROTO((tree *, int *, void *));
 extern int cp_valid_lang_attribute             PROTO((tree, tree, tree, tree));
 extern tree make_ptrmem_cst                     PROTO((tree, tree));
 extern tree cp_build_qualified_type_real        PROTO((tree, int, int));
-extern void remap_save_expr                     PROTO((tree *, splay_tree, tree));
+extern void remap_save_expr                     PROTO((tree *, splay_tree, tree, int *));
 #define cp_build_qualified_type(TYPE, QUALS) \
   cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1)
 
index ee33886..50ee83e 100644 (file)
@@ -296,7 +296,8 @@ copy_body_r (tp, walk_subtrees, data)
       *tp = new_decl;
     }
   else if (TREE_CODE (*tp) == SAVE_EXPR)
-    remap_save_expr (tp, id->decl_map, VARRAY_TREE (id->fns, 0));
+    remap_save_expr (tp, id->decl_map, VARRAY_TREE (id->fns, 0), 
+                    walk_subtrees);
   else if (TREE_CODE (*tp) == UNSAVE_EXPR)
     my_friendly_abort (19991113);
   /* For a SCOPE_STMT, we must copy the associated block so that we
index 31fbec0..c66d2fb 100644 (file)
@@ -2659,10 +2659,11 @@ init_tree ()
    ST.  FN is the function into which the copy will be placed.  */
 
 void
-remap_save_expr (tp, st, fn)
+remap_save_expr (tp, st, fn, walk_subtrees)
      tree *tp;
      splay_tree st;
      tree fn;
+     int *walk_subtrees;
 {
   splay_tree_node n;
 
@@ -2684,6 +2685,10 @@ remap_save_expr (tp, st, fn)
                             (splay_tree_key) *tp,
                             (splay_tree_value) t);
     }
+  else
+    /* We've already walked into this SAVE_EXPR, so we needn't do it
+       again.  */
+    *walk_subtrees = 0;
 
   /* Replace this SAVE_EXPR with the copy.  */
   *tp = (tree) n->value;
@@ -2751,7 +2756,7 @@ cp_unsave_r (tp, walk_subtrees, data)
        *tp = (tree) n->value;
     }
   else if (TREE_CODE (*tp) == SAVE_EXPR)
-    remap_save_expr (tp, st, current_function_decl);
+    remap_save_expr (tp, st, current_function_decl, walk_subtrees);
   else
     {
       copy_tree_r (tp, walk_subtrees, NULL);
diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline3.C b/gcc/testsuite/g++.old-deja/g++.other/inline3.C
new file mode 100644 (file)
index 0000000..ec3b33a
--- /dev/null
@@ -0,0 +1,51 @@
+// Build don't link: 
+// Origin: Mark Mitchell <mark@codesourcery.com>
+// Special g++ Options: -O3
+
+class ostream;
+
+struct S
+{
+  virtual void print(ostream&) const = 0;
+};
+
+template <class _Tp>
+class vector
+{
+public:
+  _Tp& operator[](unsigned __n) const { return *(_M_start + __n); }
+  _Tp* _M_start;
+};
+
+class T
+{
+public:
+
+  void print(ostream&) const;
+
+  vector<S*> bcList_m;
+};
+
+void T::print(ostream& o) const
+{
+  int n = 3;
+
+  for (int i = 0; i < n; ++i)
+    bcList_m[i]->print(o);
+  return;
+}
+
+ostream&
+operator<<(ostream& o, const T& bcList)
+{
+  bcList.print(o);
+  return o;
+}
+
+