cp-tree.h (scratchalloc): Remove.

* cp-tree.h (scratchalloc): Remove.
	(build_scratch_list): Likewise.
	* call.c (convert_class_to_reference): Replace build_scratch_list
	and build_expr_list with build_tree_list.
	(add_candidate): Replace scratchalloc with expralloc.  Note memory
	leak.
	(build_user_type_conversion_1):  Replace build_scratch_list
	and build_expr_list with build_tree_list.
	(build_new_op): Likewise.
	(build_op_delete_call): Likewise.
	(convert_like): Likewise.
	* cvt.c (ocp_convert): Likewise.
	* decl.c (start_decl): Likewise.
	(start_function): Likewise.
	(finish_destructor_body): Likewise.
	(maybe_build_cleanup_1): Likewise.
	* decl2.c (reparse_decl_as_expr): Likewise.
	* init.c (perform_member_init): Likewise.
	(expand_cleanup_for_base): Likewise.
	(build_builtin_delete_call): Likewise.
	(build_new_1): Likewise.
	(build_delete): Likewise.
	* method.c (do_build_assign_ref): Likewise.
	* parse.y (already_scoped_stmt): Likewise.
	(nontrivial_exprlist): Likewise.
	(net_initializer): Likewise.
	(initlist): Likewise.
	* parse.c: Regenerated.
	* rtti.c (build_x_typeid): Likewise.
	(build_dynamic_cast_1): Likewise.
	* typeck.c (build_x_compound_expr): Likewise.
	(build_static_cast): Likewise.
	(build_modify_expr): Likewise.

	* cp-tree.h (DECL_VINDEX): Add documentation.
	* class.c (build_vtable_entry): Likewise.
	(start_vtable): Add comment.
	(add_virtual_function): Replace pending_hard_virtuals with
	overridden_virtuals and pending_virtuals with new_virtuals.
	Replace redundant assignments with assertions.
	(check_for_override): Add comment.
	(check_bases_and_members): Replace pending_hard_virtuals with
	overridden_virtuals and pending_virtuals with new_virtuals.
	(create_vtbl_ptr): Likewise.
	(layout_class_type): Likewise.
	(finish_struct_1): Likewise.  Add comments.

From-SVN: r31473
This commit is contained in:
Mark Mitchell 2000-01-17 20:18:43 +00:00 committed by Mark Mitchell
parent 7af8555855
commit 051e6fd745
13 changed files with 187 additions and 120 deletions

View File

@ -1,3 +1,52 @@
2000-01-17 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (scratchalloc): Remove.
(build_scratch_list): Likewise.
* call.c (convert_class_to_reference): Replace build_scratch_list
and build_expr_list with build_tree_list.
(add_candidate): Replace scratchalloc with expralloc. Note memory
leak.
(build_user_type_conversion_1): Replace build_scratch_list
and build_expr_list with build_tree_list.
(build_new_op): Likewise.
(build_op_delete_call): Likewise.
(convert_like): Likewise.
* cvt.c (ocp_convert): Likewise.
* decl.c (start_decl): Likewise.
(start_function): Likewise.
(finish_destructor_body): Likewise.
(maybe_build_cleanup_1): Likewise.
* decl2.c (reparse_decl_as_expr): Likewise.
* init.c (perform_member_init): Likewise.
(expand_cleanup_for_base): Likewise.
(build_builtin_delete_call): Likewise.
(build_new_1): Likewise.
(build_delete): Likewise.
* method.c (do_build_assign_ref): Likewise.
* parse.y (already_scoped_stmt): Likewise.
(nontrivial_exprlist): Likewise.
(net_initializer): Likewise.
(initlist): Likewise.
* parse.c: Regenerated.
* rtti.c (build_x_typeid): Likewise.
(build_dynamic_cast_1): Likewise.
* typeck.c (build_x_compound_expr): Likewise.
(build_static_cast): Likewise.
(build_modify_expr): Likewise.
* cp-tree.h (DECL_VINDEX): Add documentation.
* class.c (build_vtable_entry): Likewise.
(start_vtable): Add comment.
(add_virtual_function): Replace pending_hard_virtuals with
overridden_virtuals and pending_virtuals with new_virtuals.
Replace redundant assignments with assertions.
(check_for_override): Add comment.
(check_bases_and_members): Replace pending_hard_virtuals with
overridden_virtuals and pending_virtuals with new_virtuals.
(create_vtbl_ptr): Likewise.
(layout_class_type): Likewise.
(finish_struct_1): Likewise. Add comments.
2000-01-16 Mark Mitchell <mark@codesourcery.com> 2000-01-16 Mark Mitchell <mark@codesourcery.com>
* class.c (finish_struct_1): Replace redundant code with * class.c (finish_struct_1): Replace redundant code with

View File

@ -869,7 +869,7 @@ convert_class_to_reference (t, s, expr)
cast to the appropriate type. */ cast to the appropriate type. */
arglist = build_int_2 (0, 0); arglist = build_int_2 (0, 0);
TREE_TYPE (arglist) = build_pointer_type (s); TREE_TYPE (arglist) = build_pointer_type (s);
arglist = build_scratch_list (NULL_TREE, arglist); arglist = build_tree_list (NULL_TREE, arglist);
for (conversions = lookup_conversions (s); for (conversions = lookup_conversions (s);
conversions; conversions;
@ -1214,8 +1214,10 @@ add_candidate (candidates, fn, convs, viable)
tree fn, convs; tree fn, convs;
int viable; int viable;
{ {
/* FIXME: This is a memory leak. Presumably, we should use
ggc_alloc instead. */
struct z_candidate *cand struct z_candidate *cand
= (struct z_candidate *) scratchalloc (sizeof (struct z_candidate)); = (struct z_candidate *) expralloc (sizeof (struct z_candidate));
cand->fn = fn; cand->fn = fn;
cand->convs = convs; cand->convs = convs;
@ -2269,7 +2271,7 @@ build_user_type_conversion_1 (totype, expr, flags)
{ {
tree t = build_int_2 (0, 0); tree t = build_int_2 (0, 0);
TREE_TYPE (t) = build_pointer_type (totype); TREE_TYPE (t) = build_pointer_type (totype);
args = build_scratch_list (NULL_TREE, expr); args = build_tree_list (NULL_TREE, expr);
if (TYPE_USES_VIRTUAL_BASECLASSES (totype)) if (TYPE_USES_VIRTUAL_BASECLASSES (totype))
args = tree_cons (NULL_TREE, integer_one_node, args); args = tree_cons (NULL_TREE, integer_one_node, args);
args = tree_cons (NULL_TREE, t, args); args = tree_cons (NULL_TREE, t, args);
@ -2302,7 +2304,7 @@ build_user_type_conversion_1 (totype, expr, flags)
} }
if (convs) if (convs)
args = build_scratch_list (NULL_TREE, build_this (expr)); args = build_tree_list (NULL_TREE, build_this (expr));
for (; convs; convs = TREE_CHAIN (convs)) for (; convs; convs = TREE_CHAIN (convs))
{ {
@ -3164,11 +3166,11 @@ build_new_op (code, flags, arg1, arg2, arg3)
if (arg2 && arg3) if (arg2 && arg3)
arglist = tree_cons (NULL_TREE, arg1, tree_cons arglist = tree_cons (NULL_TREE, arg1, tree_cons
(NULL_TREE, arg2, build_scratch_list (NULL_TREE, arg3))); (NULL_TREE, arg2, build_tree_list (NULL_TREE, arg3)));
else if (arg2) else if (arg2)
arglist = tree_cons (NULL_TREE, arg1, build_scratch_list (NULL_TREE, arg2)); arglist = tree_cons (NULL_TREE, arg1, build_tree_list (NULL_TREE, arg2));
else else
arglist = build_scratch_list (NULL_TREE, arg1); arglist = build_tree_list (NULL_TREE, arg1);
fns = lookup_function_nonclass (fnname, arglist); fns = lookup_function_nonclass (fnname, arglist);
@ -3567,7 +3569,7 @@ build_op_delete_call (code, addr, size, flags, placement)
enforce_access (TREE_PURPOSE (fns), fn); enforce_access (TREE_PURPOSE (fns), fn);
return build_function_call return build_function_call
(fn, tree_cons (NULL_TREE, addr, (fn, tree_cons (NULL_TREE, addr,
build_expr_list (NULL_TREE, size))); build_tree_list (NULL_TREE, size)));
} }
/* finish_function passes LOOKUP_SPECULATIVELY if we're in a /* finish_function passes LOOKUP_SPECULATIVELY if we're in a
@ -3650,7 +3652,7 @@ convert_like (convs, expr)
tree t = build_int_2 (0, 0); tree t = build_int_2 (0, 0);
TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn)); TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn));
args = build_scratch_list (NULL_TREE, expr); args = build_tree_list (NULL_TREE, expr);
if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn))) if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
args = tree_cons (NULL_TREE, integer_one_node, args); args = tree_cons (NULL_TREE, integer_one_node, args);
args = tree_cons (NULL_TREE, t, args); args = tree_cons (NULL_TREE, t, args);
@ -3911,7 +3913,7 @@ build_over_call (cand, args, flags)
enforce_access (cand->basetype_path, fn); enforce_access (cand->basetype_path, fn);
if (args && TREE_CODE (args) != TREE_LIST) if (args && TREE_CODE (args) != TREE_LIST)
args = build_scratch_list (NULL_TREE, args); args = build_tree_list (NULL_TREE, args);
arg = args; arg = args;
/* The implicit parameters to a constructor are not considered by overload /* The implicit parameters to a constructor are not considered by overload

View File

@ -573,7 +573,7 @@ build_vtable_entry (delta, pfn)
extern int flag_huge_objects; extern int flag_huge_objects;
tree elems = tree_cons (NULL_TREE, delta, tree elems = tree_cons (NULL_TREE, delta,
tree_cons (NULL_TREE, integer_zero_node, tree_cons (NULL_TREE, integer_zero_node,
build_expr_list (NULL_TREE, pfn))); build_tree_list (NULL_TREE, pfn)));
tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems); tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems);
/* DELTA used to be constructed by `size_int' and/or size_binop, /* DELTA used to be constructed by `size_int' and/or size_binop,
@ -1139,6 +1139,9 @@ start_vtable (t, has_virtual_p)
{ {
if (*has_virtual_p == 0 && ! CLASSTYPE_COM_INTERFACE (t)) if (*has_virtual_p == 0 && ! CLASSTYPE_COM_INTERFACE (t))
{ {
/* If we are using thunks, use two slots at the front, one
for the offset pointer, one for the tdesc pointer.
For ARM-style vtables, use the same slot for both. */
if (flag_vtable_thunks) if (flag_vtable_thunks)
*has_virtual_p = 2; *has_virtual_p = 2;
else else
@ -1151,40 +1154,35 @@ start_vtable (t, has_virtual_p)
allocate a new slot in our table. If it is error_mark_node, we allocate a new slot in our table. If it is error_mark_node, we
know that no other function from another vtable is overridden by X. know that no other function from another vtable is overridden by X.
HAS_VIRTUAL keeps track of how many virtuals there are in our main HAS_VIRTUAL keeps track of how many virtuals there are in our main
vtable for the type, and we build upon the PENDING_VIRTUALS list vtable for the type, and we build upon the NEW_VIRTUALS list
and return it. */ and return it. */
static void static void
add_virtual_function (pv, phv, has_virtual, fndecl, t) add_virtual_function (new_virtuals_p, overridden_virtuals_p,
tree *pv, *phv; has_virtual, fndecl, t)
tree *new_virtuals_p;
tree *overridden_virtuals_p;
int *has_virtual; int *has_virtual;
tree fndecl; tree fndecl;
tree t; /* Structure type. */ tree t; /* Structure type. */
{ {
tree pending_virtuals = *pv; my_friendly_assert (DECL_CONTEXT (fndecl) == t, 20000116);
tree pending_hard_virtuals = *phv;
#ifndef DUMB_USER /* If this function doesn't override anything from a base class, we
if (current_class_type == 0) can just assign it a new DECL_VINDEX now. Otherwise, if it does
cp_warning ("internal problem, current_class_type is zero when adding `%D', please report", override something, we keep it around and assign its DECL_VINDEX
fndecl); later, in modify_all_vtables. */
if (current_class_type && t != current_class_type) if (TREE_CODE (DECL_VINDEX (fndecl)) == INTEGER_CST)
cp_warning ("internal problem, current_class_type differs when adding `%D', please report", /* We've already dealt with this function. */
fndecl); ;
#endif else if (DECL_VINDEX (fndecl) == error_mark_node)
/* If the virtual function is a redefinition of a prior one,
figure out in which base class the new definition goes,
and if necessary, make a fresh virtual function table
to hold that entry. */
if (DECL_VINDEX (fndecl) == error_mark_node)
{ {
/* FNDECL is a new virtual function; it doesn't override any
virtual function in a base class. */
/* We remember that this was the base sub-object for rtti. */ /* We remember that this was the base sub-object for rtti. */
CLASSTYPE_RTTI (t) = t; CLASSTYPE_RTTI (t) = t;
/* If we are using thunks, use two slots at the front, one
for the offset pointer, one for the tdesc pointer.
For ARM-style vtables, use the same slot for both. */
start_vtable (t, has_virtual); start_vtable (t, has_virtual);
/* Build a new INT_CST for this DECL_VINDEX. */ /* Build a new INT_CST for this DECL_VINDEX. */
@ -1205,25 +1203,17 @@ add_virtual_function (pv, phv, has_virtual, fndecl, t)
/* Now assign virtual dispatch information. */ /* Now assign virtual dispatch information. */
DECL_VINDEX (fndecl) = idx; DECL_VINDEX (fndecl) = idx;
DECL_CONTEXT (fndecl) = t;
} }
/* Save the state we've computed on the PENDING_VIRTUALS list. */ /* Save the state we've computed on the NEW_VIRTUALS list. */
pending_virtuals = tree_cons (integer_zero_node, *new_virtuals_p = tree_cons (integer_zero_node,
fndecl, fndecl,
pending_virtuals); *new_virtuals_p);
} }
/* Might already be INTEGER_CST if declared twice in class. We will
give error later or we've already given it. */
else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST) else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
{ /* FNDECL overrides a function from a base class. */
/* Need an entry in some other virtual function table. *overridden_virtuals_p = tree_cons (NULL_TREE,
Deal with this after we have laid out our virtual base classes. */ fndecl,
pending_hard_virtuals = tree_cons (NULL_TREE, *overridden_virtuals_p);
fndecl,
pending_hard_virtuals);
}
*pv = pending_virtuals;
*phv = pending_hard_virtuals;
} }
extern struct obstack *current_obstack; extern struct obstack *current_obstack;
@ -3126,8 +3116,12 @@ check_for_override (decl, ctype)
} }
virtualp = 1; virtualp = 1;
/* Set DECL_VINDEX to a value that is neither an
INTEGER_CST nor the error_mark_node so that
add_virtual_function will realize this is an
overridden function. */
DECL_VINDEX (decl) DECL_VINDEX (decl)
= tree_cons (NULL_TREE, tmp, DECL_VINDEX (decl)); = tree_cons (tmp, NULL_TREE, DECL_VINDEX (decl));
/* We now know that DECL overrides something, /* We now know that DECL overrides something,
which is all that is important. But, we must which is all that is important. But, we must
@ -4202,12 +4196,12 @@ check_bases_and_members (t, empty_p)
static void static void
create_vtable_ptr (t, empty_p, has_virtual_p, create_vtable_ptr (t, empty_p, has_virtual_p,
pending_virtuals_p, pending_hard_virtuals_p) new_virtuals_p, overridden_virtuals_p)
tree t; tree t;
int *empty_p; int *empty_p;
int *has_virtual_p; int *has_virtual_p;
tree *pending_virtuals_p; tree *new_virtuals_p;
tree *pending_hard_virtuals_p; tree *overridden_virtuals_p;
{ {
tree fn; tree fn;
@ -4215,7 +4209,7 @@ create_vtable_ptr (t, empty_p, has_virtual_p,
vtables. */ vtables. */
for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn)) for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
if (DECL_VINDEX (fn)) if (DECL_VINDEX (fn))
add_virtual_function (pending_virtuals_p, pending_hard_virtuals_p, add_virtual_function (new_virtuals_p, overridden_virtuals_p,
has_virtual_p, fn, t); has_virtual_p, fn, t);
/* Even if there weren't any new virtual functions, we might need a /* Even if there weren't any new virtual functions, we might need a
@ -4609,12 +4603,12 @@ layout_basetypes (rec)
static void static void
layout_class_type (t, empty_p, has_virtual_p, layout_class_type (t, empty_p, has_virtual_p,
pending_virtuals_p, pending_hard_virtuals_p) new_virtuals_p, overridden_virtuals_p)
tree t; tree t;
int *empty_p; int *empty_p;
int *has_virtual_p; int *has_virtual_p;
tree *pending_virtuals_p; tree *new_virtuals_p;
tree *pending_hard_virtuals_p; tree *overridden_virtuals_p;
{ {
/* If possible, we reuse the virtual function table pointer from one /* If possible, we reuse the virtual function table pointer from one
of our base classes. */ of our base classes. */
@ -4629,7 +4623,7 @@ layout_class_type (t, empty_p, has_virtual_p,
/* Create a pointer to our virtual function table. */ /* Create a pointer to our virtual function table. */
create_vtable_ptr (t, empty_p, has_virtual_p, create_vtable_ptr (t, empty_p, has_virtual_p,
pending_virtuals_p, pending_hard_virtuals_p); new_virtuals_p, overridden_virtuals_p);
/* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS. Thus, /* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS. Thus,
we have to save this before we start modifying we have to save this before we start modifying
@ -4725,8 +4719,15 @@ finish_struct_1 (t)
{ {
tree x; tree x;
int has_virtual; int has_virtual;
tree pending_virtuals = NULL_TREE; /* The NEW_VIRTUALS is a TREE_LIST. The TREE_VALUE of each node is
tree pending_hard_virtuals = NULL_TREE; a FUNCTION_DECL. Each of these functions is a virtual function
declared in T that does not override any virtual function from a
base class. */
tree new_virtuals = NULL_TREE;
/* The OVERRIDDEN_VIRTUALS list is like the NEW_VIRTUALS list,
except that each declaration here overrides the declaration from
a base class. */
tree overridden_virtuals = NULL_TREE;
int n_fields = 0; int n_fields = 0;
tree vfield; tree vfield;
int empty = 1; int empty = 1;
@ -4745,7 +4746,6 @@ finish_struct_1 (t)
/* If this type was previously laid out as a forward reference, /* If this type was previously laid out as a forward reference,
make sure we lay it out again. */ make sure we lay it out again. */
TYPE_SIZE (t) = NULL_TREE; TYPE_SIZE (t) = NULL_TREE;
CLASSTYPE_GOT_SEMICOLON (t) = 0; CLASSTYPE_GOT_SEMICOLON (t) = 0;
CLASSTYPE_VFIELD_PARENT (t) = -1; CLASSTYPE_VFIELD_PARENT (t) = -1;
@ -4758,7 +4758,7 @@ finish_struct_1 (t)
/* Layout the class itself. */ /* Layout the class itself. */
layout_class_type (t, &empty, &has_virtual, layout_class_type (t, &empty, &has_virtual,
&pending_virtuals, &pending_hard_virtuals); &new_virtuals, &overridden_virtuals);
if (TYPE_USES_VIRTUAL_BASECLASSES (t)) if (TYPE_USES_VIRTUAL_BASECLASSES (t))
{ {
@ -4818,13 +4818,13 @@ finish_struct_1 (t)
TYPE_VFIELD (t) = vfield; TYPE_VFIELD (t) = vfield;
} }
if (flag_rtti && TYPE_CONTAINS_VPTR_P (t) && !pending_hard_virtuals) if (flag_rtti && TYPE_CONTAINS_VPTR_P (t) && !overridden_virtuals)
modify_all_vtables (t, NULL_TREE); modify_all_vtables (t, NULL_TREE);
for (pending_hard_virtuals = nreverse (pending_hard_virtuals); for (overridden_virtuals = nreverse (overridden_virtuals);
pending_hard_virtuals; overridden_virtuals;
pending_hard_virtuals = TREE_CHAIN (pending_hard_virtuals)) overridden_virtuals = TREE_CHAIN (overridden_virtuals))
modify_all_vtables (t, TREE_VALUE (pending_hard_virtuals)); modify_all_vtables (t, TREE_VALUE (overridden_virtuals));
if (TYPE_USES_VIRTUAL_BASECLASSES (t)) if (TYPE_USES_VIRTUAL_BASECLASSES (t))
{ {
@ -4850,10 +4850,10 @@ finish_struct_1 (t)
} }
/* If necessary, create the vtable for this class. */ /* If necessary, create the vtable for this class. */
if (pending_virtuals if (new_virtuals
|| (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ())) || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ()))
{ {
pending_virtuals = nreverse (pending_virtuals); new_virtuals = nreverse (new_virtuals);
/* We must enter these virtuals into the table. */ /* We must enter these virtuals into the table. */
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
{ {
@ -4861,12 +4861,12 @@ finish_struct_1 (t)
{ {
/* The second slot is for the tdesc pointer when thunks are used. */ /* The second slot is for the tdesc pointer when thunks are used. */
if (flag_vtable_thunks) if (flag_vtable_thunks)
pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals); new_virtuals = tree_cons (NULL_TREE, NULL_TREE, new_virtuals);
/* The first slot is for the rtti offset. */ /* The first slot is for the rtti offset. */
pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals); new_virtuals = tree_cons (NULL_TREE, NULL_TREE, new_virtuals);
set_rtti_entry (pending_virtuals, set_rtti_entry (new_virtuals,
convert (ssizetype, integer_zero_node), t); convert (ssizetype, integer_zero_node), t);
} }
build_vtable (NULL_TREE, t); build_vtable (NULL_TREE, t);
@ -4917,7 +4917,7 @@ finish_struct_1 (t)
/* Entries for virtual functions defined in the primary base are /* Entries for virtual functions defined in the primary base are
followed by entries for new functions unique to this class. */ followed by entries for new functions unique to this class. */
TYPE_BINFO_VIRTUALS (t) TYPE_BINFO_VIRTUALS (t)
= chainon (TYPE_BINFO_VIRTUALS (t), pending_virtuals); = chainon (TYPE_BINFO_VIRTUALS (t), new_virtuals);
} }
/* Now lay out the virtual function table. */ /* Now lay out the virtual function table. */

View File

@ -126,7 +126,18 @@ Boston, MA 02111-1307, USA. */
entry does not have a TREE_VALUE; it is just an offset. entry does not have a TREE_VALUE; it is just an offset.
DECL_ARGUMENTS DECL_ARGUMENTS
For a VAR_DECL this is DECL_ANON_UNION_ELEMS. */ For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
DECL_VINDEX
This field is NULL for a non-virtual function. For a virtual
function, it is eventually set to an INTEGER_CST indicating the
index in the vtable at which this function can be found. When
a virtual function is declared, but before it is known what
function is overriden, this field is the error_mark_node.
Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
the virtual function this one overrides, and whose TREE_CHAIN is
the old DECL_VINDEX. */
/* Language-specific tree checkers. */ /* Language-specific tree checkers. */
@ -214,6 +225,14 @@ extern int flag_rtti;
alternative; otherwise, we choose the former. */ alternative; otherwise, we choose the former. */
#define vptrs_present_everywhere_p() (flag_new_abi) #define vptrs_present_everywhere_p() (flag_new_abi)
/* Nonzero if the vtable for a derived class should contain the
virtual functions from the primary base and all virtual functions
present in the class itself. Zero if, instead, it should contain
only those virtual functions from the primary base together with
the functions declared in the derived class (but not in any base
class). */
#define all_overridden_vfuns_in_vtables_p() (flag_new_abi)
/* Language-dependent contents of an identifier. */ /* Language-dependent contents of an identifier. */
@ -4181,9 +4200,6 @@ extern void remap_save_expr PROTO((tree *, splay_tree, tree,
#define cp_build_qualified_type(TYPE, QUALS) \ #define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1) cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1)
#define scratchalloc expralloc
#define build_scratch_list build_expr_list
/* in typeck.c */ /* in typeck.c */
extern int string_conv_p PROTO((tree, tree, int)); extern int string_conv_p PROTO((tree, tree, int));
extern tree condition_conversion PROTO((tree)); extern tree condition_conversion PROTO((tree));

View File

@ -807,7 +807,7 @@ ocp_convert (type, expr, convtype, flags)
ctor = build_user_type_conversion (type, ctor, flags); ctor = build_user_type_conversion (type, ctor, flags);
if (ctor) if (ctor)
ctor = build_method_call (NULL_TREE, ctor_identifier, ctor = build_method_call (NULL_TREE, ctor_identifier,
build_expr_list (NULL_TREE, ctor), build_tree_list (NULL_TREE, ctor),
TYPE_BINFO (type), flags); TYPE_BINFO (type), flags);
if (ctor) if (ctor)
return build_cplus_new (type, ctor); return build_cplus_new (type, ctor);

View File

@ -6668,7 +6668,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
} }
if (attributes || prefix_attributes) if (attributes || prefix_attributes)
attrlist = build_scratch_list (attributes, prefix_attributes); attrlist = build_tree_list (attributes, prefix_attributes);
else else
attrlist = NULL_TREE; attrlist = NULL_TREE;
@ -12968,7 +12968,7 @@ start_function (declspecs, declarator, attrs, flags)
if (CLASS_TYPE_P (restype) && !CLASSTYPE_GOT_SEMICOLON (restype)) if (CLASS_TYPE_P (restype) && !CLASSTYPE_GOT_SEMICOLON (restype))
{ {
cp_error ("semicolon missing after declaration of `%#T'", restype); cp_error ("semicolon missing after declaration of `%#T'", restype);
shadow_tag (build_expr_list (NULL_TREE, restype)); shadow_tag (build_tree_list (NULL_TREE, restype));
CLASSTYPE_GOT_SEMICOLON (restype) = 1; CLASSTYPE_GOT_SEMICOLON (restype) = 1;
if (TREE_CODE (fntype) == FUNCTION_TYPE) if (TREE_CODE (fntype) == FUNCTION_TYPE)
fntype = build_function_type (integer_type_node, fntype = build_function_type (integer_type_node,
@ -13600,7 +13600,7 @@ finish_destructor_body ()
finish_expr_stmt finish_expr_stmt
(build_scoped_method_call (build_scoped_method_call
(current_class_ref, vb, dtor_identifier, (current_class_ref, vb, dtor_identifier,
build_expr_list (NULL_TREE, integer_zero_node))); build_tree_list (NULL_TREE, integer_zero_node)));
} }
vbases = TREE_CHAIN (vbases); vbases = TREE_CHAIN (vbases);
} }
@ -14276,7 +14276,7 @@ maybe_build_cleanup_1 (decl, auto_delete)
if (TYPE_USES_VIRTUAL_BASECLASSES (type) if (TYPE_USES_VIRTUAL_BASECLASSES (type)
&& ! TYPE_HAS_DESTRUCTOR (type)) && ! TYPE_HAS_DESTRUCTOR (type))
rval = build_compound_expr (tree_cons (NULL_TREE, rval, rval = build_compound_expr (tree_cons (NULL_TREE, rval,
build_expr_list (NULL_TREE, build_vbase_delete (type, decl)))); build_tree_list (NULL_TREE, build_vbase_delete (type, decl))));
return rval; return rval;
} }

View File

@ -4026,7 +4026,7 @@ reparse_decl_as_expr (type, decl)
{ {
decl = build_expr_from_tree (decl); decl = build_expr_from_tree (decl);
if (type) if (type)
return build_functional_cast (type, build_expr_list (NULL_TREE, decl)); return build_functional_cast (type, build_tree_list (NULL_TREE, decl));
else else
return decl; return decl;
} }

View File

@ -162,7 +162,7 @@ perform_member_init (member, name, init, explicit)
/* Since `init' is already a TREE_LIST on the current_member_init_list, /* Since `init' is already a TREE_LIST on the current_member_init_list,
only build it into one if we aren't already a list. */ only build it into one if we aren't already a list. */
if (init != NULL_TREE && TREE_CODE (init) != TREE_LIST) if (init != NULL_TREE && TREE_CODE (init) != TREE_LIST)
init = build_expr_list (NULL_TREE, init); init = build_tree_list (NULL_TREE, init);
if (explicit if (explicit
&& TREE_CODE (type) == ARRAY_TYPE && TREE_CODE (type) == ARRAY_TYPE
@ -695,7 +695,7 @@ expand_cleanup_for_base (binfo, flag)
/* Call the destructor. */ /* Call the destructor. */
expr = (build_scoped_method_call expr = (build_scoped_method_call
(current_class_ref, binfo, dtor_identifier, (current_class_ref, binfo, dtor_identifier,
build_expr_list (NULL_TREE, integer_zero_node))); build_tree_list (NULL_TREE, integer_zero_node)));
if (flag) if (flag)
expr = fold (build (COND_EXPR, void_type_node, expr = fold (build (COND_EXPR, void_type_node,
truthvalue_conversion (flag), truthvalue_conversion (flag),
@ -1186,7 +1186,7 @@ expand_default_init (binfo, true_exp, exp, init, flags)
init = TREE_VALUE (parms); init = TREE_VALUE (parms);
} }
else else
parms = build_expr_list (NULL_TREE, init); parms = build_tree_list (NULL_TREE, init);
if (TYPE_USES_VIRTUAL_BASECLASSES (type)) if (TYPE_USES_VIRTUAL_BASECLASSES (type))
{ {
@ -1861,7 +1861,7 @@ build_builtin_delete_call (addr)
{ {
mark_used (global_delete_fndecl); mark_used (global_delete_fndecl);
return build_call (global_delete_fndecl, return build_call (global_delete_fndecl,
void_type_node, build_expr_list (NULL_TREE, addr)); void_type_node, build_tree_list (NULL_TREE, addr));
} }
/* Generate a C++ "new" expression. DECL is either a TREE_LIST /* Generate a C++ "new" expression. DECL is either a TREE_LIST
@ -2258,7 +2258,7 @@ build_new_1 (exp)
rval = cp_convert (build_pointer_type (true_type), rval); rval = cp_convert (build_pointer_type (true_type), rval);
rval = build_compound_expr rval = build_compound_expr
(tree_cons (NULL_TREE, exp1, (tree_cons (NULL_TREE, exp1,
build_expr_list (NULL_TREE, rval))); build_tree_list (NULL_TREE, rval)));
} }
if (rval == error_mark_node) if (rval == error_mark_node)
@ -3059,7 +3059,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
passed_auto_delete = auto_delete; passed_auto_delete = auto_delete;
expr = build_method_call expr = build_method_call
(ref, dtor_identifier, build_expr_list (NULL_TREE, passed_auto_delete), (ref, dtor_identifier, build_tree_list (NULL_TREE, passed_auto_delete),
NULL_TREE, flags); NULL_TREE, flags);
if (do_delete) if (do_delete)
@ -3108,7 +3108,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
cond = NULL_TREE; cond = NULL_TREE;
if (cond) if (cond)
exprstmt = build_expr_list (NULL_TREE, cond); exprstmt = build_tree_list (NULL_TREE, cond);
if (base_binfo if (base_binfo
&& ! TREE_VIA_VIRTUAL (base_binfo) && ! TREE_VIA_VIRTUAL (base_binfo)
@ -3123,7 +3123,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
expr = build_scoped_method_call expr = build_scoped_method_call
(ref, base_binfo, dtor_identifier, (ref, base_binfo, dtor_identifier,
build_expr_list (NULL_TREE, this_auto_delete)); build_tree_list (NULL_TREE, this_auto_delete));
exprstmt = tree_cons (NULL_TREE, expr, exprstmt); exprstmt = tree_cons (NULL_TREE, expr, exprstmt);
} }
@ -3137,7 +3137,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
expr = build_scoped_method_call expr = build_scoped_method_call
(ref, base_binfo, dtor_identifier, (ref, base_binfo, dtor_identifier,
build_expr_list (NULL_TREE, integer_zero_node)); build_tree_list (NULL_TREE, integer_zero_node));
exprstmt = tree_cons (NULL_TREE, expr, exprstmt); exprstmt = tree_cons (NULL_TREE, expr, exprstmt);
} }

View File

@ -2277,7 +2277,7 @@ do_build_assign_ref (fndecl)
CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE); CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE);
p = convert_from_reference (p); p = convert_from_reference (p);
p = build_member_call (basetype, ansi_opname [MODIFY_EXPR], p = build_member_call (basetype, ansi_opname [MODIFY_EXPR],
build_expr_list (NULL_TREE, p)); build_tree_list (NULL_TREE, p));
finish_expr_stmt (p); finish_expr_stmt (p);
} }
for (; fields; fields = TREE_CHAIN (fields)) for (; fields; fields = TREE_CHAIN (fields))

View File

@ -5252,24 +5252,24 @@ case 208:
case 210: case 210:
#line 1061 "parse.y" #line 1061 "parse.y"
{ yyval.ttype = tree_cons (NULL_TREE, yyval.ttype, { yyval.ttype = tree_cons (NULL_TREE, yyval.ttype,
build_expr_list (NULL_TREE, yyvsp[0].ttype)); ; build_tree_list (NULL_TREE, yyvsp[0].ttype)); ;
break;} break;}
case 211: case 211:
#line 1064 "parse.y" #line 1064 "parse.y"
{ yyval.ttype = tree_cons (NULL_TREE, yyval.ttype, { yyval.ttype = tree_cons (NULL_TREE, yyval.ttype,
build_expr_list (NULL_TREE, error_mark_node)); ; build_tree_list (NULL_TREE, error_mark_node)); ;
break;} break;}
case 212: case 212:
#line 1067 "parse.y" #line 1067 "parse.y"
{ chainon (yyval.ttype, build_expr_list (NULL_TREE, yyvsp[0].ttype)); ; { chainon (yyval.ttype, build_tree_list (NULL_TREE, yyvsp[0].ttype)); ;
break;} break;}
case 213: case 213:
#line 1069 "parse.y" #line 1069 "parse.y"
{ chainon (yyval.ttype, build_expr_list (NULL_TREE, error_mark_node)); ; { chainon (yyval.ttype, build_tree_list (NULL_TREE, error_mark_node)); ;
break;} break;}
case 214: case 214:
#line 1074 "parse.y" #line 1074 "parse.y"
{ yyval.ttype = build_expr_list (NULL_TREE, yyval.ttype); ; { yyval.ttype = build_tree_list (NULL_TREE, yyval.ttype); ;
break;} break;}
case 216: case 216:
#line 1080 "parse.y" #line 1080 "parse.y"
@ -5421,7 +5421,7 @@ case 246:
pedwarn ("ANSI C++ forbids initialization of new expression with `='"); pedwarn ("ANSI C++ forbids initialization of new expression with `='");
if (TREE_CODE (yyvsp[0].ttype) != TREE_LIST if (TREE_CODE (yyvsp[0].ttype) != TREE_LIST
&& TREE_CODE (yyvsp[0].ttype) != CONSTRUCTOR) && TREE_CODE (yyvsp[0].ttype) != CONSTRUCTOR)
yyval.ttype = build_expr_list (NULL_TREE, yyvsp[0].ttype); yyval.ttype = build_tree_list (NULL_TREE, yyvsp[0].ttype);
else else
yyval.ttype = yyvsp[0].ttype; yyval.ttype = yyvsp[0].ttype;
; ;
@ -6297,11 +6297,11 @@ case 454:
break;} break;}
case 455: case 455:
#line 2007 "parse.y" #line 2007 "parse.y"
{ yyval.ttype = build_expr_list (yyvsp[-2].ttype, yyvsp[0].ttype); ; { yyval.ttype = build_tree_list (yyvsp[-2].ttype, yyvsp[0].ttype); ;
break;} break;}
case 456: case 456:
#line 2009 "parse.y" #line 2009 "parse.y"
{ yyval.ttype = build_expr_list (yyval.ttype, yyvsp[0].ttype); ; { yyval.ttype = build_tree_list (yyval.ttype, yyvsp[0].ttype); ;
break;} break;}
case 457: case 457:
#line 2011 "parse.y" #line 2011 "parse.y"

View File

@ -1059,19 +1059,19 @@ already_scoped_stmt:
nontrivial_exprlist: nontrivial_exprlist:
expr_no_commas ',' expr_no_commas expr_no_commas ',' expr_no_commas
{ $$ = tree_cons (NULL_TREE, $$, { $$ = tree_cons (NULL_TREE, $$,
build_expr_list (NULL_TREE, $3)); } build_tree_list (NULL_TREE, $3)); }
| expr_no_commas ',' error | expr_no_commas ',' error
{ $$ = tree_cons (NULL_TREE, $$, { $$ = tree_cons (NULL_TREE, $$,
build_expr_list (NULL_TREE, error_mark_node)); } build_tree_list (NULL_TREE, error_mark_node)); }
| nontrivial_exprlist ',' expr_no_commas | nontrivial_exprlist ',' expr_no_commas
{ chainon ($$, build_expr_list (NULL_TREE, $3)); } { chainon ($$, build_tree_list (NULL_TREE, $3)); }
| nontrivial_exprlist ',' error | nontrivial_exprlist ',' error
{ chainon ($$, build_expr_list (NULL_TREE, error_mark_node)); } { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
; ;
nonnull_exprlist: nonnull_exprlist:
expr_no_commas expr_no_commas
{ $$ = build_expr_list (NULL_TREE, $$); } { $$ = build_tree_list (NULL_TREE, $$); }
| nontrivial_exprlist | nontrivial_exprlist
; ;
@ -1181,7 +1181,7 @@ new_initializer:
pedwarn ("ANSI C++ forbids initialization of new expression with `='"); pedwarn ("ANSI C++ forbids initialization of new expression with `='");
if (TREE_CODE ($2) != TREE_LIST if (TREE_CODE ($2) != TREE_LIST
&& TREE_CODE ($2) != CONSTRUCTOR) && TREE_CODE ($2) != CONSTRUCTOR)
$$ = build_expr_list (NULL_TREE, $2); $$ = build_tree_list (NULL_TREE, $2);
else else
$$ = $2; $$ = $2;
} }
@ -2004,9 +2004,9 @@ initlist:
{ $$ = tree_cons (NULL_TREE, $3, $$); } { $$ = tree_cons (NULL_TREE, $3, $$); }
/* These are for labeled elements. */ /* These are for labeled elements. */
| '[' expr_no_commas ']' init | '[' expr_no_commas ']' init
{ $$ = build_expr_list ($2, $4); } { $$ = build_tree_list ($2, $4); }
| identifier ':' init | identifier ':' init
{ $$ = build_expr_list ($$, $3); } { $$ = build_tree_list ($$, $3); }
| initlist ',' identifier ':' init | initlist ',' identifier ':' init
{ $$ = tree_cons ($3, $5, $$); } { $$ = tree_cons ($3, $5, $$); }
; ;

View File

@ -295,7 +295,7 @@ build_x_typeid (exp)
tree bad = throw_bad_typeid (); tree bad = throw_bad_typeid ();
bad = build_compound_expr bad = build_compound_expr
(tree_cons (NULL_TREE, bad, build_expr_list (tree_cons (NULL_TREE, bad, build_tree_list
(NULL_TREE, cp_convert (type, integer_zero_node)))); (NULL_TREE, cp_convert (type, integer_zero_node))));
exp = build (COND_EXPR, type, cond, exp, bad); exp = build (COND_EXPR, type, cond, exp, bad);
} }
@ -680,7 +680,7 @@ build_dynamic_cast_1 (type, expr)
expr1 = throw_bad_cast (); expr1 = throw_bad_cast ();
expr1 = build_compound_expr expr1 = build_compound_expr
(tree_cons (NULL_TREE, expr1, (tree_cons (NULL_TREE, expr1,
build_expr_list (NULL_TREE, cp_convert (type, integer_zero_node)))); build_tree_list (NULL_TREE, cp_convert (type, integer_zero_node))));
TREE_TYPE (expr1) = type; TREE_TYPE (expr1) = type;
result = save_expr (result); result = save_expr (result);
return build (COND_EXPR, type, result, result, expr1); return build (COND_EXPR, type, result, result, expr1);

View File

@ -5092,7 +5092,7 @@ build_x_compound_expr (list)
return build_compound_expr return build_compound_expr
(tree_cons (NULL_TREE, TREE_VALUE (list), (tree_cons (NULL_TREE, TREE_VALUE (list),
build_expr_list (NULL_TREE, build_tree_list (NULL_TREE,
build_x_compound_expr (rest)))); build_x_compound_expr (rest))));
} }
@ -5177,7 +5177,7 @@ build_static_cast (type, expr)
if (IS_AGGR_TYPE (type)) if (IS_AGGR_TYPE (type))
return build_cplus_new return build_cplus_new
(type, (build_method_call (type, (build_method_call
(NULL_TREE, ctor_identifier, build_expr_list (NULL_TREE, expr), (NULL_TREE, ctor_identifier, build_tree_list (NULL_TREE, expr),
TYPE_BINFO (type), LOOKUP_NORMAL))); TYPE_BINFO (type), LOOKUP_NORMAL)));
expr = decay_conversion (expr); expr = decay_conversion (expr);
@ -5702,7 +5702,7 @@ build_modify_expr (lhs, modifycode, rhs)
else else
{ {
result = build_method_call (lhs, ctor_identifier, result = build_method_call (lhs, ctor_identifier,
build_expr_list (NULL_TREE, rhs), build_tree_list (NULL_TREE, rhs),
TYPE_BINFO (lhstype), LOOKUP_NORMAL); TYPE_BINFO (lhstype), LOOKUP_NORMAL);
if (result == NULL_TREE) if (result == NULL_TREE)
return error_mark_node; return error_mark_node;
@ -5932,7 +5932,7 @@ build_modify_expr (lhs, modifycode, rhs)
if (TREE_SIDE_EFFECTS (lhs)) if (TREE_SIDE_EFFECTS (lhs))
cond = build_compound_expr (tree_cons cond = build_compound_expr (tree_cons
(NULL_TREE, lhs, (NULL_TREE, lhs,
build_expr_list (NULL_TREE, cond))); build_tree_list (NULL_TREE, cond)));
/* Cannot have two identical lhs on this one tree (result) as preexpand /* Cannot have two identical lhs on this one tree (result) as preexpand
calls will rip them out and fill in RTL for them, but when the calls will rip them out and fill in RTL for them, but when the