aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-07-19 15:45:53 +0000
committerNathan Sidwell <nathan@codesourcery.com>2004-07-19 15:45:53 +0000
commitad67bdf078eb5079ec23fd5928c0724cdfd7744d (patch)
tree46c29242b882c33b8a12977fcf57e4b3cd23ce78 /gcc/cp/init.c
parent5d0ceec007329d462efadb6e005bbf120add90d9 (diff)
.:
* vec.h: Propagate location information properly. (VEC_T_iterate): Add result pointer parameter. (VEC_T_space): New. (VEC_T_reserve): Use it. cp: * class.c (add_method): Delay adding the slot until the end. (determine_primary_base): Adjust VEC_iterate invokation. (resort_type_method_vec, finish_struct_methods, warn_hidden, walk_subobject_offsets, end_of_class, warn_about_ambiguous_bases, build_vtbl_initializer): Likewise. * init.c (sort_mem_initializers, build_delete, push_base_cleanups, build_vbase_delete): Likewise. * method.c (do_build_copy_constructor): Likewise. * name-lookup.c (new_class_binding, print_binding_level, poplevel_class, store_class_bindings, push_to_top_level, pop_from_top_level): Likewise. * pt.c (check_explicit_specialization): Likewise. * search.c (lookup_conversion_operator, lookup_fnfields_1, get_pure_virtuals, add_conversions, dfs_check_overlap, binfo_for_vbase): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@84924 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 926dfcd9c89..988bfba1cd0 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -460,6 +460,7 @@ sort_mem_initializers (tree t, tree mem_inits)
tree base;
tree sorted_inits;
tree next_subobject;
+ VEC (tree) *vbases;
int i;
int uses_unions_p;
@@ -470,8 +471,8 @@ sort_mem_initializers (tree t, tree mem_inits)
sorted_inits = NULL_TREE;
/* Process the virtual bases. */
- for (i = 0; (base = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (t), i)); i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
+ VEC_iterate (tree, vbases, i, base); i++)
sorted_inits = tree_cons (base, NULL_TREE, sorted_inits);
/* Process the direct bases. */
@@ -2857,10 +2858,11 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
void
push_base_cleanups (void)
{
- tree binfos;
+ tree binfos, base_binfo;
int i, n_baseclasses;
tree member;
tree expr;
+ VEC (tree) *vbases;
/* Run destructors for all virtual baseclasses. */
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
@@ -2872,16 +2874,15 @@ push_base_cleanups (void)
/* The CLASSTYPE_VBASECLASSES vector is in initialization
order, which is also the right order for pushing cleanups. */
- for (i = 0; (binfos = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (current_class_type), i));
- i++)
+ for (vbases = CLASSTYPE_VBASECLASSES (current_class_type), i = 0;
+ VEC_iterate (tree, vbases, i, base_binfo); i++)
{
- if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (BINFO_TYPE (binfos)))
+ if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo)))
{
expr = build_special_member_call (current_class_ref,
base_dtor_identifier,
NULL_TREE,
- binfos,
+ base_binfo,
(LOOKUP_NORMAL
| LOOKUP_NONVIRTUAL));
expr = build (COND_EXPR, void_type_node, cond,
@@ -2938,13 +2939,14 @@ build_vbase_delete (tree type, tree decl)
unsigned ix;
tree binfo;
tree result;
+ VEC (tree) *vbases;
tree addr = build_unary_op (ADDR_EXPR, decl, 0);
my_friendly_assert (addr != error_mark_node, 222);
result = convert_to_void (integer_zero_node, NULL);
- for (ix = 0; (binfo = VEC_iterate
- (tree, CLASSTYPE_VBASECLASSES (type), ix)); ix++)
+ for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
+ VEC_iterate (tree, vbases, ix, binfo); ix++)
{
tree base_addr = convert_force
(build_pointer_type (BINFO_TYPE (binfo)), addr, 0);