* 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
+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
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 *));
}
/* 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);
}
-/* 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)
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))
{
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;