cp-tree.h (permanent_p): New function.

* cp-tree.h (permanent_p): New function.
	* init.c (build_new_1): Use mapcar, not copy_node, to copy a
	possibly complex tree node.
	* tree.c (mapcar): Adjust comments, and follow coding standards in
	conditional.
	(permanent_p): New function.

From-SVN: r26951
This commit is contained in:
Mark Mitchell 1999-05-16 19:31:51 +00:00 committed by Mark Mitchell
parent 31146a60e7
commit 88b117b740
4 changed files with 29 additions and 7 deletions

View File

@ -1,3 +1,12 @@
1999-05-16 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (permanent_p): New function.
* init.c (build_new_1): Use mapcar, not copy_node, to copy a
possibly complex tree node.
* tree.c (mapcar): Adjust comments, and follow coding standards in
conditional.
(permanent_p): New function.
1999-05-13 Per Bothner <bothner@cygnus.com>
* class.c (push_lang_context): Turn off DECL_IGNORED_P for

View File

@ -3357,6 +3357,7 @@ extern char *lang_printable_name PROTO((tree, int));
extern tree build_exception_variant PROTO((tree, tree));
extern tree copy_template_template_parm PROTO((tree));
extern tree copy_to_permanent PROTO((tree));
extern tree permanent_p PROTO((tree));
extern void print_lang_statistics PROTO((void));
extern void __eprintf
PROTO((const char *, const char *, unsigned, const char *));

View File

@ -2430,7 +2430,7 @@ build_new_1 (exp)
}
/* Copy size to the saveable obstack. */
size = copy_node (size);
size = mapcar (size, permanent_p);
cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn);

View File

@ -1724,10 +1724,8 @@ no_linkage_check (t)
}
/* Subroutine of copy_to_permanent
Assuming T is a node build bottom-up, make it all exist on
permanent obstack, if it is not permanent already. */
/* Make copies of all the nodes below T. If FUNC is non-NULL, call it
for each node. */
tree
mapcar (t, func)
@ -1739,8 +1737,12 @@ mapcar (t, func)
if (t == NULL_TREE)
return t;
if (tmp = func (t), tmp != NULL_TREE)
return tmp;
if (func)
{
tmp = func (t);
if (tmp)
return tmp;
}
switch (TREE_CODE (t))
{
@ -1984,6 +1986,16 @@ mapcar (t, func)
return NULL_TREE;
}
/* Returns T if T is allocated on the permanent obstack, NULL_TREE
otherwise. */
tree
permanent_p (t)
tree t;
{
return TREE_PERMANENT (t) ? t : NULL_TREE;
}
static tree
perm_manip (t)
tree t;