summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c173
1 files changed, 85 insertions, 88 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index cdc02ae7d7a..56fe1d1073c 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -79,13 +79,13 @@ typedef struct vtbl_init_data_s
tree rtti_binfo;
/* The negative-index vtable initializers built up so far. These
are in order from least negative index to most negative index. */
- VEC(constructor_elt,gc) *inits;
+ vec<constructor_elt, va_gc> *inits;
/* The binfo for the virtual base for which we're building
vcall offset initializers. */
tree vbase;
/* The functions in vbase for which we have already provided vcall
offsets. */
- VEC(tree,gc) *fns;
+ vec<tree, va_gc> *fns;
/* The vtable index of the next vcall or vbase offset. */
tree index;
/* Nonzero if we are building the initializer for the primary
@@ -112,7 +112,7 @@ static GTY (()) tree sizeof_biggest_empty_class;
/* An array of all local classes present in this translation unit, in
declaration order. */
-VEC(tree,gc) *local_classes;
+vec<tree, va_gc> *local_classes;
static tree get_vfield_name (tree);
static void finish_struct_anon (tree);
@@ -137,7 +137,7 @@ static tree fixed_type_or_null (tree, int *, int *);
static tree build_simple_base_path (tree expr, tree binfo);
static tree build_vtbl_ref_1 (tree, tree);
static void build_vtbl_initializer (tree, tree, tree, tree, int *,
- VEC(constructor_elt,gc) **);
+ vec<constructor_elt, va_gc> **);
static int count_fields (tree);
static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
static void insert_into_classtype_sorted_fields (tree, tree, int);
@@ -175,15 +175,15 @@ static void dump_vtable (tree, tree, tree);
static void dump_vtt (tree, tree);
static void dump_thunk (FILE *, int, tree);
static tree build_vtable (tree, tree, tree);
-static void initialize_vtable (tree, VEC(constructor_elt,gc) *);
+static void initialize_vtable (tree, vec<constructor_elt, va_gc> *);
static void layout_nonempty_base_or_field (record_layout_info,
tree, tree, splay_tree);
static tree end_of_class (tree, int);
static bool layout_empty_base (record_layout_info, tree, tree, splay_tree);
static void accumulate_vtbl_inits (tree, tree, tree, tree, tree,
- VEC(constructor_elt,gc) **);
+ vec<constructor_elt, va_gc> **);
static void dfs_accumulate_vtbl_inits (tree, tree, tree, tree, tree,
- VEC(constructor_elt,gc) **);
+ vec<constructor_elt, va_gc> **);
static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
static void build_vcall_and_vbase_vtbl_entries (tree, vtbl_init_data *);
static void clone_constructors_and_destructors (tree);
@@ -192,7 +192,8 @@ static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
static void build_ctor_vtbl_group (tree, tree);
static void build_vtt (tree);
static tree binfo_ctor_vtable (tree);
-static void build_vtt_inits (tree, tree, VEC(constructor_elt,gc) **, tree *);
+static void build_vtt_inits (tree, tree, vec<constructor_elt, va_gc> **,
+ tree *);
static tree dfs_build_secondary_vptr_vtt_inits (tree, void *);
static tree dfs_fixup_binfo_vtbls (tree, void *);
static int record_subobject_offset (tree, tree, splay_tree);
@@ -948,7 +949,7 @@ add_method (tree type, tree method, tree using_decl)
tree overload;
bool template_conv_p = false;
bool conv_p;
- VEC(tree,gc) *method_vec;
+ vec<tree, va_gc> *method_vec;
bool complete_p;
bool insert_p = false;
tree current_fns;
@@ -970,10 +971,10 @@ add_method (tree type, tree method, tree using_decl)
allocate at least two (for constructors and destructors), and
we're going to end up with an assignment operator at some
point as well. */
- method_vec = VEC_alloc (tree, gc, 8);
+ vec_alloc (method_vec, 8);
/* Create slots for constructors and destructors. */
- VEC_quick_push (tree, method_vec, NULL_TREE);
- VEC_quick_push (tree, method_vec, NULL_TREE);
+ method_vec->quick_push (NULL_TREE);
+ method_vec->quick_push (NULL_TREE);
CLASSTYPE_METHOD_VEC (type) = method_vec;
}
@@ -1004,7 +1005,7 @@ add_method (tree type, tree method, tree using_decl)
insert_p = true;
/* See if we already have an entry with this name. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
- VEC_iterate (tree, method_vec, slot, m);
+ vec_safe_iterate (method_vec, slot, &m);
++slot)
{
m = OVL_CURRENT (m);
@@ -1028,7 +1029,7 @@ add_method (tree type, tree method, tree using_decl)
break;
}
}
- current_fns = insert_p ? NULL_TREE : VEC_index (tree, method_vec, slot);
+ current_fns = insert_p ? NULL_TREE : (*method_vec)[slot];
/* Check to see if we've already got this method. */
for (fns = current_fns; fns; fns = OVL_NEXT (fns))
@@ -1175,19 +1176,19 @@ add_method (tree type, tree method, tree using_decl)
/* We only expect to add few methods in the COMPLETE_P case, so
just make room for one more method in that case. */
if (complete_p)
- reallocated = VEC_reserve_exact (tree, gc, method_vec, 1);
+ reallocated = vec_safe_reserve_exact (method_vec, 1);
else
- reallocated = VEC_reserve (tree, gc, method_vec, 1);
+ reallocated = vec_safe_reserve (method_vec, 1);
if (reallocated)
CLASSTYPE_METHOD_VEC (type) = method_vec;
- if (slot == VEC_length (tree, method_vec))
- VEC_quick_push (tree, method_vec, overload);
+ if (slot == method_vec->length ())
+ method_vec->quick_push (overload);
else
- VEC_quick_insert (tree, method_vec, slot, overload);
+ method_vec->quick_insert (slot, overload);
}
else
/* Replace the current slot. */
- VEC_replace (tree, method_vec, slot, overload);
+ (*method_vec)[slot] = overload;
return true;
}
@@ -1953,15 +1954,15 @@ resort_type_method_vec (void* obj,
gt_pointer_operator new_value,
void* cookie)
{
- VEC(tree,gc) *method_vec = (VEC(tree,gc) *) obj;
- int len = VEC_length (tree, method_vec);
+ vec<tree, va_gc> *method_vec = (vec<tree, va_gc> *) obj;
+ int len = vec_safe_length (method_vec);
size_t slot;
tree fn;
/* The type conversion ops have to live at the front of the vec, so we
can't sort them. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
- VEC_iterate (tree, method_vec, slot, fn);
+ vec_safe_iterate (method_vec, slot, &fn);
++slot)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
break;
@@ -1970,7 +1971,7 @@ resort_type_method_vec (void* obj,
{
resort_data.new_value = new_value;
resort_data.cookie = cookie;
- qsort (VEC_address (tree, method_vec) + slot, len - slot, sizeof (tree),
+ qsort (method_vec->address () + slot, len - slot, sizeof (tree),
resort_method_name_cmp);
}
}
@@ -1985,14 +1986,14 @@ static void
finish_struct_methods (tree t)
{
tree fn_fields;
- VEC(tree,gc) *method_vec;
+ vec<tree, va_gc> *method_vec;
int slot, len;
method_vec = CLASSTYPE_METHOD_VEC (t);
if (!method_vec)
return;
- len = VEC_length (tree, method_vec);
+ len = method_vec->length ();
/* Clear DECL_IN_AGGR_P for all functions. */
for (fn_fields = TYPE_METHODS (t); fn_fields;
@@ -2006,12 +2007,12 @@ finish_struct_methods (tree t)
/* The type conversion ops have to live at the front of the vec, so we
can't sort them. */
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
- VEC_iterate (tree, method_vec, slot, fn_fields);
+ method_vec->iterate (slot, &fn_fields);
++slot)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn_fields)))
break;
if (len - slot > 1)
- qsort (VEC_address (tree, method_vec) + slot,
+ qsort (method_vec->address () + slot,
len-slot, sizeof (tree), method_name_cmp);
}
@@ -2103,7 +2104,7 @@ typedef struct find_final_overrider_data_s {
/* The candidate overriders. */
tree candidates;
/* Path to most derived. */
- VEC(tree,heap) *path;
+ vec<tree> path;
} find_final_overrider_data;
/* Add the overrider along the current path to FFOD->CANDIDATES.
@@ -2122,7 +2123,7 @@ dfs_find_final_overrider_1 (tree binfo,
{
depth--;
if (dfs_find_final_overrider_1
- (VEC_index (tree, ffod->path, depth), ffod, depth))
+ (ffod->path[depth], ffod, depth))
return true;
}
@@ -2161,8 +2162,8 @@ dfs_find_final_overrider_pre (tree binfo, void *data)
find_final_overrider_data *ffod = (find_final_overrider_data *) data;
if (binfo == ffod->declaring_base)
- dfs_find_final_overrider_1 (binfo, ffod, VEC_length (tree, ffod->path));
- VEC_safe_push (tree, heap, ffod->path, binfo);
+ dfs_find_final_overrider_1 (binfo, ffod, ffod->path.length ());
+ ffod->path.safe_push (binfo);
return NULL_TREE;
}
@@ -2171,7 +2172,7 @@ static tree
dfs_find_final_overrider_post (tree /*binfo*/, void *data)
{
find_final_overrider_data *ffod = (find_final_overrider_data *) data;
- VEC_pop (tree, ffod->path);
+ ffod->path.pop ();
return NULL_TREE;
}
@@ -2211,12 +2212,12 @@ find_final_overrider (tree derived, tree binfo, tree fn)
ffod.fn = fn;
ffod.declaring_base = binfo;
ffod.candidates = NULL_TREE;
- ffod.path = VEC_alloc (tree, heap, 30);
+ ffod.path.create (30);
dfs_walk_all (derived, dfs_find_final_overrider_pre,
dfs_find_final_overrider_post, &ffod);
- VEC_free (tree, heap, ffod.path);
+ ffod.path.release ();
/* If there was no winner, issue an error message. */
if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
@@ -2231,11 +2232,11 @@ find_final_overrider (tree derived, tree binfo, tree fn)
static tree
get_vcall_index (tree fn, tree type)
{
- VEC(tree_pair_s,gc) *indices = CLASSTYPE_VCALL_INDICES (type);
+ vec<tree_pair_s, va_gc> *indices = CLASSTYPE_VCALL_INDICES (type);
tree_pair_p p;
unsigned ix;
- FOR_EACH_VEC_ELT (tree_pair_s, indices, ix, p)
+ FOR_EACH_VEC_SAFE_ELT (indices, ix, p)
if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (p->purpose))
|| same_signature_p (fn, p->purpose))
return p->value;
@@ -2589,7 +2590,7 @@ get_basefndecls (tree name, tree t)
/* Find virtual functions in T with the indicated NAME. */
i = lookup_fnfields_1 (t, name);
if (i != -1)
- for (methods = VEC_index (tree, CLASSTYPE_METHOD_VEC (t), i);
+ for (methods = (*CLASSTYPE_METHOD_VEC (t))[i];
methods;
methods = OVL_NEXT (methods))
{
@@ -2660,13 +2661,13 @@ check_for_override (tree decl, tree ctype)
static void
warn_hidden (tree t)
{
- VEC(tree,gc) *method_vec = CLASSTYPE_METHOD_VEC (t);
+ vec<tree, va_gc> *method_vec = CLASSTYPE_METHOD_VEC (t);
tree fns;
size_t i;
/* We go through each separately named virtual function. */
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
- VEC_iterate (tree, method_vec, i, fns);
+ vec_safe_iterate (method_vec, i, &fns);
++i)
{
tree fn;
@@ -3704,7 +3705,7 @@ walk_subobject_offsets (tree type,
if (abi_version_at_least (2) && CLASSTYPE_VBASECLASSES (type))
{
unsigned ix;
- VEC(tree,gc) *vbases;
+ vec<tree, va_gc> *vbases;
/* Iterate through the virtual base classes of TYPE. In G++
3.2, we included virtual bases in the direct base class
@@ -3713,7 +3714,7 @@ walk_subobject_offsets (tree type,
working with the most derived type. */
if (vbases_p)
for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0;
- VEC_iterate (tree, vbases, ix, binfo); ix++)
+ vec_safe_iterate (vbases, ix, &binfo); ix++)
{
r = walk_subobject_offsets (binfo,
f,
@@ -4221,7 +4222,7 @@ check_methods (tree t)
{
TYPE_POLYMORPHIC_P (t) = 1;
if (DECL_PURE_VIRTUAL_P (x))
- VEC_safe_push (tree, gc, CLASSTYPE_PURE_VIRTUALS (t), x);
+ vec_safe_push (CLASSTYPE_PURE_VIRTUALS (t), x);
}
/* All user-provided destructors are non-trivial.
Constructors and assignment ops are handled in
@@ -5620,7 +5621,7 @@ static tree
end_of_class (tree t, int include_virtuals_p)
{
tree result = size_zero_node;
- VEC(tree,gc) *vbases;
+ vec<tree, va_gc> *vbases;
tree binfo;
tree base_binfo;
tree offset;
@@ -5643,7 +5644,7 @@ end_of_class (tree t, int include_virtuals_p)
/* G++ 3.2 did not check indirect virtual bases. */
if (abi_version_at_least (2) && include_virtuals_p)
for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
- VEC_iterate (tree, vbases, i, base_binfo); i++)
+ vec_safe_iterate (vbases, i, &base_binfo); i++)
{
offset = end_of_base (base_binfo);
if (INT_CST_LT_UNSIGNED (result, offset))
@@ -5667,7 +5668,7 @@ static void
warn_about_ambiguous_bases (tree t)
{
int i;
- VEC(tree,gc) *vbases;
+ vec<tree, va_gc> *vbases;
tree basetype;
tree binfo;
tree base_binfo;
@@ -5690,7 +5691,7 @@ warn_about_ambiguous_bases (tree t)
/* Check for ambiguous virtual bases. */
if (extra_warnings)
for (vbases = CLASSTYPE_VBASECLASSES (t), i = 0;
- VEC_iterate (tree, vbases, i, binfo); i++)
+ vec_safe_iterate (vbases, i, &binfo); i++)
{
basetype = BINFO_TYPE (binfo);
@@ -6520,7 +6521,7 @@ finish_struct (tree t, tree attributes)
CLASSTYPE_PURE_VIRTUALS (t) = NULL;
for (x = TYPE_METHODS (t); x; x = DECL_CHAIN (x))
if (DECL_PURE_VIRTUAL_P (x))
- VEC_safe_push (tree, gc, CLASSTYPE_PURE_VIRTUALS (t), x);
+ vec_safe_push (CLASSTYPE_PURE_VIRTUALS (t), x);
complete_vars (t);
/* We need to add the target functions to the CLASSTYPE_METHOD_VEC if
an enclosing scope is a template class, so that this function be
@@ -6766,7 +6767,7 @@ init_class_processing (void)
current_class_stack_size = 10;
current_class_stack
= XNEWVEC (struct class_stack_node, current_class_stack_size);
- local_classes = VEC_alloc (tree, gc, 8);
+ vec_alloc (local_classes, 8);
sizeof_biggest_empty_class = size_zero_node;
ridpointers[(int) RID_PUBLIC] = access_public_node;
@@ -7028,7 +7029,7 @@ pop_nested_class (void)
int
current_lang_depth (void)
{
- return VEC_length (tree, current_lang_base);
+ return vec_safe_length (current_lang_base);
}
/* Set global variables CURRENT_LANG_NAME to appropriate value
@@ -7037,7 +7038,7 @@ current_lang_depth (void)
void
push_lang_context (tree name)
{
- VEC_safe_push (tree, gc, current_lang_base, current_lang_name);
+ vec_safe_push (current_lang_base, current_lang_name);
if (name == lang_name_cplusplus)
{
@@ -7072,7 +7073,7 @@ push_lang_context (tree name)
void
pop_lang_context (void)
{
- current_lang_name = VEC_pop (tree, current_lang_base);
+ current_lang_name = current_lang_base->pop ();
}
/* Type instantiation routines. */
@@ -8051,7 +8052,7 @@ static void
finish_vtbls (tree t)
{
tree vbase;
- VEC(constructor_elt,gc) *v = NULL;
+ vec<constructor_elt, va_gc> *v = NULL;
tree vtable = BINFO_VTABLE (TYPE_BINFO (t));
/* We lay out the primary and secondary vtables in one contiguous
@@ -8075,11 +8076,11 @@ finish_vtbls (tree t)
/* Initialize the vtable for BINFO with the INITS. */
static void
-initialize_vtable (tree binfo, VEC(constructor_elt,gc) *inits)
+initialize_vtable (tree binfo, vec<constructor_elt, va_gc> *inits)
{
tree decl;
- layout_vtable_decl (binfo, VEC_length (constructor_elt, inits));
+ layout_vtable_decl (binfo, vec_safe_length (inits));
decl = get_vtbl_decl_for_binfo (binfo);
initialize_artificial_var (decl, inits);
dump_vtable (BINFO_TYPE (binfo), binfo, decl);
@@ -8104,7 +8105,7 @@ build_vtt (tree t)
tree type;
tree vtt;
tree index;
- VEC(constructor_elt,gc) *inits;
+ vec<constructor_elt, va_gc> *inits;
/* Build up the initializers for the VTT. */
inits = NULL;
@@ -8117,7 +8118,7 @@ build_vtt (tree t)
/* Figure out the type of the VTT. */
type = build_array_of_n_type (const_ptr_type_node,
- VEC_length (constructor_elt, inits));
+ inits->length ());
/* Now, build the VTT object itself. */
vtt = build_vtable (t, mangle_vtt_for_type (t), type);
@@ -8163,7 +8164,7 @@ typedef struct secondary_vptr_vtt_init_data_s
tree index;
/* Vector of initializers built up. */
- VEC(constructor_elt,gc) *inits;
+ vec<constructor_elt, va_gc> *inits;
/* The type being constructed by this secondary VTT. */
tree type_being_constructed;
@@ -8178,7 +8179,8 @@ typedef struct secondary_vptr_vtt_init_data_s
vtables for the BINFO-in-T variant. */
static void
-build_vtt_inits (tree binfo, tree t, VEC(constructor_elt,gc) **inits, tree *index)
+build_vtt_inits (tree binfo, tree t, vec<constructor_elt, va_gc> **inits,
+ tree *index)
{
int i;
tree b;
@@ -8338,7 +8340,7 @@ build_ctor_vtbl_group (tree binfo, tree t)
tree vtbl;
tree id;
tree vbase;
- VEC(constructor_elt,gc) *v;
+ vec<constructor_elt, va_gc> *v;
/* See if we've already created this construction vtable group. */
id = mangle_ctor_vtbl_for_type (t, binfo);
@@ -8372,8 +8374,7 @@ build_ctor_vtbl_group (tree binfo, tree t)
}
/* Figure out the type of the construction vtable. */
- type = build_array_of_n_type (vtable_entry_type,
- VEC_length (constructor_elt, v));
+ type = build_array_of_n_type (vtable_entry_type, v->length ());
layout_type (type);
TREE_TYPE (vtbl) = type;
DECL_SIZE (vtbl) = DECL_SIZE_UNIT (vtbl) = NULL_TREE;
@@ -8401,7 +8402,7 @@ accumulate_vtbl_inits (tree binfo,
tree rtti_binfo,
tree vtbl,
tree t,
- VEC(constructor_elt,gc) **inits)
+ vec<constructor_elt, va_gc> **inits)
{
int i;
tree base_binfo;
@@ -8449,7 +8450,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
tree rtti_binfo,
tree orig_vtbl,
tree t,
- VEC(constructor_elt,gc) **l)
+ vec<constructor_elt, va_gc> **l)
{
tree vtbl = NULL_TREE;
int ctor_vtbl_p = !SAME_BINFO_TYPE_P (BINFO_TYPE (rtti_binfo), t);
@@ -8509,7 +8510,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
else if (!BINFO_NEW_VTABLE_MARKED (orig_binfo))
return;
- n_inits = VEC_length (constructor_elt, *l);
+ n_inits = vec_safe_length (*l);
if (!vtbl)
{
@@ -8535,7 +8536,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
BINFO_VTABLE (binfo) = tree_cons (rtti_binfo, vtbl, BINFO_VTABLE (binfo));
else if (BINFO_PRIMARY_P (binfo) && BINFO_VIRTUAL_P (binfo))
/* Throw away any unneeded intializers. */
- VEC_truncate (constructor_elt, *l, n_inits);
+ (*l)->truncate (n_inits);
else
/* For an ordinary vtable, set BINFO_VTABLE. */
BINFO_VTABLE (binfo) = vtbl;
@@ -8572,13 +8573,13 @@ build_vtbl_initializer (tree binfo,
tree t,
tree rtti_binfo,
int* non_fn_entries_p,
- VEC(constructor_elt,gc) **inits)
+ vec<constructor_elt, va_gc> **inits)
{
tree v;
vtbl_init_data vid;
unsigned ix, jx;
tree vbinfo;
- VEC(tree,gc) *vbases;
+ vec<tree, va_gc> *vbases;
constructor_elt *e;
/* Initialize VID. */
@@ -8598,41 +8599,39 @@ build_vtbl_initializer (tree binfo,
/* Create an array for keeping track of the functions we've
processed. When we see multiple functions with the same
signature, we share the vcall offsets. */
- vid.fns = VEC_alloc (tree, gc, 32);
+ vec_alloc (vid.fns, 32);
/* Add the vcall and vbase offset entries. */
build_vcall_and_vbase_vtbl_entries (binfo, &vid);
/* Clear BINFO_VTABLE_PATH_MARKED; it's set by
build_vbase_offset_vtbl_entries. */
for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
- VEC_iterate (tree, vbases, ix, vbinfo); ix++)
+ vec_safe_iterate (vbases, ix, &vbinfo); ix++)
BINFO_VTABLE_PATH_MARKED (vbinfo) = 0;
/* If the target requires padding between data entries, add that now. */
if (TARGET_VTABLE_DATA_ENTRY_DISTANCE > 1)
{
- int n_entries = VEC_length (constructor_elt, vid.inits);
+ int n_entries = vec_safe_length (vid.inits);
- VEC_safe_grow (constructor_elt, gc, vid.inits,
- TARGET_VTABLE_DATA_ENTRY_DISTANCE * n_entries);
+ vec_safe_grow (vid.inits, TARGET_VTABLE_DATA_ENTRY_DISTANCE * n_entries);
/* Move data entries into their new positions and add padding
after the new positions. Iterate backwards so we don't
overwrite entries that we would need to process later. */
for (ix = n_entries - 1;
- VEC_iterate (constructor_elt, vid.inits, ix, e);
+ vid.inits->iterate (ix, &e);
ix--)
{
int j;
int new_position = (TARGET_VTABLE_DATA_ENTRY_DISTANCE * ix
+ (TARGET_VTABLE_DATA_ENTRY_DISTANCE - 1));
- VEC_replace (constructor_elt, vid.inits, new_position, *e);
+ (*vid.inits)[new_position] = *e;
for (j = 1; j < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++j)
{
- constructor_elt *f = &VEC_index (constructor_elt, vid.inits,
- new_position - j);
+ constructor_elt *f = &(*vid.inits)[new_position - j];
f->index = NULL_TREE;
f->value = build1 (NOP_EXPR, vtable_entry_type,
null_pointer_node);
@@ -8641,19 +8640,18 @@ build_vtbl_initializer (tree binfo,
}
if (non_fn_entries_p)
- *non_fn_entries_p = VEC_length (constructor_elt, vid.inits);
+ *non_fn_entries_p = vec_safe_length (vid.inits);
/* The initializers for virtual functions were built up in reverse
order. Straighten them out and add them to the running list in one
step. */
- jx = VEC_length (constructor_elt, *inits);
- VEC_safe_grow (constructor_elt, gc, *inits,
- (jx + VEC_length (constructor_elt, vid.inits)));
+ jx = vec_safe_length (*inits);
+ vec_safe_grow (*inits, jx + vid.inits->length ());
- for (ix = VEC_length (constructor_elt, vid.inits) - 1;
- VEC_iterate (constructor_elt, vid.inits, ix, e);
+ for (ix = vid.inits->length () - 1;
+ vid.inits->iterate (ix, &e);
ix--, jx++)
- VEC_replace (constructor_elt, *inits, jx, *e);
+ (**inits)[jx] = *e;
/* Go through all the ordinary virtual functions, building up
initializers. */
@@ -9053,7 +9051,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
signature as FN, then we do not need a second vcall offset.
Check the list of functions already present in the derived
class vtable. */
- FOR_EACH_VEC_ELT (tree, vid->fns, i, derived_entry)
+ FOR_EACH_VEC_SAFE_ELT (vid->fns, i, derived_entry)
{
if (same_signature_p (derived_entry, orig_fn)
/* We only use one vcall offset for virtual destructors,
@@ -9069,8 +9067,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
if (vid->binfo == TYPE_BINFO (vid->derived))
{
tree_pair_s elt = {orig_fn, vid->index};
- VEC_safe_push (tree_pair_s, gc, CLASSTYPE_VCALL_INDICES (vid->derived),
- elt);
+ vec_safe_push (CLASSTYPE_VCALL_INDICES (vid->derived), elt);
}
/* The next vcall offset will be found at a more negative
@@ -9079,7 +9076,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
ssize_int (TARGET_VTABLE_DATA_ENTRY_DISTANCE));
/* Keep track of this function. */
- VEC_safe_push (tree, gc, vid->fns, orig_fn);
+ vec_safe_push (vid->fns, orig_fn);
if (vid->generate_vcall_entries)
{