diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-05-16 19:31:51 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-05-16 19:31:51 +0000 |
commit | 88b117b74048dfb8fab4ba46a44da3ac995f597b (patch) | |
tree | 819488c8eacd22461ed28f5c6d61d39a67dc28ae /gcc | |
parent | 31146a60e716aa679e2049091805bc007b057ade (diff) | |
download | gcc-88b117b74048dfb8fab4ba46a44da3ac995f597b.zip gcc-88b117b74048dfb8fab4ba46a44da3ac995f597b.tar.gz gcc-88b117b74048dfb8fab4ba46a44da3ac995f597b.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/init.c | 2 | ||||
-rw-r--r-- | gcc/cp/tree.c | 24 |
4 files changed, 29 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ceb0df7..2a16a39 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 955bf0a..7c517c0 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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 *)); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 39736ce..7fb2030 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 9012810..bf16fe2 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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; |