cp-tree.h (remap_save_expr): Add walk_subtrees parameter.

* 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.

From-SVN: r30926
This commit is contained in:
Mark Mitchell 1999-12-14 18:52:40 +00:00 committed by Mark Mitchell
parent 89c6e7ac34
commit d7d5e42f2d
5 changed files with 67 additions and 4 deletions

View 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.

View 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)

View 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

View 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);

View File

@ -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;
}