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.c207
1 files changed, 104 insertions, 103 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 3f87303be93..6597111955e 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -284,7 +284,7 @@ build_base_path (enum tree_code code,
/* This must happen before the call to save_expr. */
expr = cp_build_unary_op (ADDR_EXPR, expr, 0, tf_warning_or_error);
else
- mark_rvalue_use (expr);
+ expr = mark_rvalue_use (expr);
offset = BINFO_OFFSET (binfo);
fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
@@ -469,7 +469,7 @@ build_simple_base_path (tree expr, tree binfo)
expr = build_simple_base_path (expr, d_binfo);
for (field = TYPE_FIELDS (BINFO_TYPE (d_binfo));
- field; field = TREE_CHAIN (field))
+ field; field = DECL_CHAIN (field))
/* Is this the base field created by build_base_field? */
if (TREE_CODE (field) == FIELD_DECL
&& DECL_FIELD_IS_BASE (field)
@@ -1260,7 +1260,7 @@ check_bases (tree t,
seen_non_virtual_nearly_empty_base_p = 0;
if (!CLASSTYPE_NON_STD_LAYOUT (t))
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL)
break;
@@ -1345,7 +1345,7 @@ check_bases (tree t,
members, or has no base classes with non-static data
members */
for (basefield = TYPE_FIELDS (basetype); basefield;
- basefield = TREE_CHAIN (basefield))
+ basefield = DECL_CHAIN (basefield))
if (TREE_CODE (basefield) == FIELD_DECL)
{
if (field)
@@ -1603,7 +1603,7 @@ maybe_warn_about_overly_private_class (tree t)
functions are private. (Since there are no friends or
non-private statics, we can't ever call any of the private member
functions.) */
- for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
+ for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn))
/* We're not interested in compiler-generated methods; they don't
provide any way to call private members. */
if (!DECL_ARTIFICIAL (fn))
@@ -1808,7 +1808,7 @@ finish_struct_methods (tree t)
/* Clear DECL_IN_AGGR_P for all functions. */
for (fn_fields = TYPE_METHODS (t); fn_fields;
- fn_fields = TREE_CHAIN (fn_fields))
+ fn_fields = DECL_CHAIN (fn_fields))
DECL_IN_AGGR_P (fn_fields) = 0;
/* Issue warnings about private constructors and such. If there are
@@ -2058,8 +2058,9 @@ get_vcall_index (tree fn, tree type)
}
/* Update an entry in the vtable for BINFO, which is in the hierarchy
- dominated by T. FN has been overridden in BINFO; VIRTUALS points to the
- corresponding position in the BINFO_VIRTUALS list. */
+ dominated by T. FN is the old function; VIRTUALS points to the
+ corresponding position in the new BINFO_VIRTUALS list. IX is the index
+ of that entry in the list. */
static void
update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
@@ -2204,6 +2205,40 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
gcc_assert (DECL_INVALID_OVERRIDER_P (overrider_target) ||
!DECL_THUNK_P (fn));
+ /* If we need a covariant thunk, then we may need to adjust first_defn.
+ The ABI specifies that the thunks emitted with a function are
+ determined by which bases the function overrides, so we need to be
+ sure that we're using a thunk for some overridden base; even if we
+ know that the necessary this adjustment is zero, there may not be an
+ appropriate zero-this-adjusment thunk for us to use since thunks for
+ overriding virtual bases always use the vcall offset.
+
+ Furthermore, just choosing any base that overrides this function isn't
+ quite right, as this slot won't be used for calls through a type that
+ puts a covariant thunk here. Calling the function through such a type
+ will use a different slot, and that slot is the one that determines
+ the thunk emitted for that base.
+
+ So, keep looking until we find the base that we're really overriding
+ in this slot: the nearest primary base that doesn't use a covariant
+ thunk in this slot. */
+ if (overrider_target != overrider_fn)
+ {
+ if (BINFO_TYPE (b) == DECL_CONTEXT (overrider_target))
+ /* We already know that the overrider needs a covariant thunk. */
+ b = get_primary_binfo (b);
+ for (; ; b = get_primary_binfo (b))
+ {
+ tree main_binfo = TYPE_BINFO (BINFO_TYPE (b));
+ tree bv = chain_index (ix, BINFO_VIRTUALS (main_binfo));
+ if (BINFO_LOST_PRIMARY_P (b))
+ lost = true;
+ if (!DECL_THUNK_P (TREE_VALUE (bv)))
+ break;
+ }
+ first_defn = b;
+ }
+
/* Assume that we will produce a thunk that convert all the way to
the final overrider, and not to an intermediate virtual base. */
virtual_base = NULL_TREE;
@@ -2228,36 +2263,6 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
}
}
- if (overrider_fn != overrider_target && !virtual_base)
- {
- /* The ABI specifies that a covariant thunk includes a mangling
- for a this pointer adjustment. This-adjusting thunks that
- override a function from a virtual base have a vcall
- adjustment. When the virtual base in question is a primary
- virtual base, we know the adjustments are zero, (and in the
- non-covariant case, we would not use the thunk).
- Unfortunately we didn't notice this could happen, when
- designing the ABI and so never mandated that such a covariant
- thunk should be emitted. Because we must use the ABI mandated
- name, we must continue searching from the binfo where we
- found the most recent definition of the function, towards the
- primary binfo which first introduced the function into the
- vtable. If that enters a virtual base, we must use a vcall
- this-adjusting thunk. Bleah! */
- tree probe = first_defn;
-
- while ((probe = get_primary_binfo (probe))
- && (unsigned) list_length (BINFO_VIRTUALS (probe)) > ix)
- if (BINFO_VIRTUAL_P (probe))
- virtual_base = probe;
-
- if (virtual_base)
- /* Even if we find a virtual base, the correct delta is
- between the overrider and the binfo we're building a vtable
- for. */
- goto virtual_covariant;
- }
-
/* Compute the constant adjustment to the `this' pointer. The
`this' pointer, when this function is called, will point at BINFO
(or one of its primary bases, which are at the same offset). */
@@ -2277,7 +2282,6 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
/* The `this' pointer needs to be adjusted from pointing to
BINFO to pointing at the base where the final overrider
appears. */
- virtual_covariant:
delta = size_diffop_loc (input_location,
convert (ssizetype,
BINFO_OFFSET (TREE_VALUE (overrider))),
@@ -2290,6 +2294,9 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
= get_vcall_index (overrider_target, BINFO_TYPE (virtual_base));
else
BV_VCALL_INDEX (*virtuals) = NULL_TREE;
+
+ if (lost)
+ BV_LOST_PRIMARY (*virtuals) = true;
}
/* Called from modify_all_vtables via dfs_walk. */
@@ -2532,7 +2539,7 @@ finish_struct_anon (tree t)
{
tree field;
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
{
if (TREE_STATIC (field))
continue;
@@ -2544,7 +2551,7 @@ finish_struct_anon (tree t)
{
bool is_union = TREE_CODE (TREE_TYPE (field)) == UNION_TYPE;
tree elt = TYPE_FIELDS (TREE_TYPE (field));
- for (; elt; elt = TREE_CHAIN (elt))
+ for (; elt; elt = DECL_CHAIN (elt))
{
/* We're generally only interested in entities the user
declared, but we also find nested classes by noticing
@@ -2715,7 +2722,7 @@ count_fields (tree fields)
{
tree x;
int n_fields = 0;
- for (x = fields; x; x = TREE_CHAIN (x))
+ for (x = fields; x; x = DECL_CHAIN (x))
{
if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
n_fields += count_fields (TYPE_FIELDS (TREE_TYPE (x)));
@@ -2732,7 +2739,7 @@ static int
add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)
{
tree x;
- for (x = fields; x; x = TREE_CHAIN (x))
+ for (x = fields; x; x = DECL_CHAIN (x))
{
if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
@@ -2827,9 +2834,9 @@ check_field_decl (tree field,
{
tree type = strip_array_types (TREE_TYPE (field));
- /* An anonymous union cannot contain any fields which would change
+ /* In C++98 an anonymous union cannot contain any fields which would change
the settings of CANT_HAVE_CONST_CTOR and friends. */
- if (ANON_UNION_TYPE_P (type))
+ if (ANON_UNION_TYPE_P (type) && cxx_dialect < cxx0x)
;
/* And, we don't set TYPE_HAS_CONST_COPY_CTOR, etc., for anonymous
structs. So, we recurse through their fields here. */
@@ -2837,7 +2844,7 @@ check_field_decl (tree field,
{
tree fields;
- for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
+ for (fields = TYPE_FIELDS (type); fields; fields = DECL_CHAIN (fields))
if (TREE_CODE (fields) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
check_field_decl (fields, t, cant_have_const_ctor,
no_const_asn_ref, any_default_members);
@@ -2850,8 +2857,10 @@ check_field_decl (tree field,
make it through without complaint. */
abstract_virtuals_error (field, type);
- if (TREE_CODE (t) == UNION_TYPE)
+ if (TREE_CODE (t) == UNION_TYPE && cxx_dialect < cxx0x)
{
+ static bool warned;
+ int oldcount = errorcount;
if (TYPE_NEEDS_CONSTRUCTING (type))
error ("member %q+#D with constructor not allowed in union",
field);
@@ -2860,8 +2869,12 @@ check_field_decl (tree field,
if (TYPE_HAS_COMPLEX_COPY_ASSIGN (type))
error ("member %q+#D with copy assignment operator not allowed in union",
field);
- /* Don't bother diagnosing move assop now; C++0x has more
- flexible unions. */
+ if (!warned && errorcount > oldcount)
+ {
+ inform (DECL_SOURCE_LOCATION (field), "unrestricted unions "
+ "only available with -std=c++0x or -std=gnu++0x");
+ warned = true;
+ }
}
else
{
@@ -2948,12 +2961,12 @@ check_field_decls (tree t, tree *access_decls,
tree type = TREE_TYPE (x);
int this_field_access;
- next = &TREE_CHAIN (x);
+ next = &DECL_CHAIN (x);
if (TREE_CODE (x) == USING_DECL)
{
/* Prune the access declaration from the list of fields. */
- *field = TREE_CHAIN (x);
+ *field = DECL_CHAIN (x);
/* Save the access declarations for our caller. */
*access_decls = tree_cons (NULL_TREE, x, *access_decls);
@@ -3386,7 +3399,7 @@ walk_subobject_offsets (tree type,
}
/* Iterate through the fields of TYPE. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL && !DECL_ARTIFICIAL (field))
{
tree field_offset;
@@ -3735,9 +3748,9 @@ build_base_field (record_layout_info rli, tree binfo,
objects of the same type at the same address. */
layout_nonempty_base_or_field (rli, decl, binfo, offsets);
/* Add the new FIELD_DECL to the list of fields for T. */
- TREE_CHAIN (decl) = *next_field;
+ DECL_CHAIN (decl) = *next_field;
*next_field = decl;
- next_field = &TREE_CHAIN (decl);
+ next_field = &DECL_CHAIN (decl);
}
}
else
@@ -3849,7 +3862,7 @@ check_methods (tree t)
{
tree x;
- for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
+ for (x = TYPE_METHODS (t); x; x = DECL_CHAIN (x))
{
check_for_override (x, t);
if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
@@ -3888,8 +3901,8 @@ build_clone (tree fn, tree name)
/* Remember where this function came from. */
DECL_ABSTRACT_ORIGIN (clone) = fn;
/* Make it easy to find the CLONE given the FN. */
- TREE_CHAIN (clone) = TREE_CHAIN (fn);
- TREE_CHAIN (fn) = clone;
+ DECL_CHAIN (clone) = DECL_CHAIN (fn);
+ DECL_CHAIN (fn) = clone;
/* If this is a template, do the rest on the DECL_TEMPLATE_RESULT. */
if (TREE_CODE (clone) == TEMPLATE_DECL)
@@ -3953,8 +3966,8 @@ build_clone (tree fn, tree name)
/* Remove the in-charge parameter. */
if (DECL_HAS_IN_CHARGE_PARM_P (clone))
{
- TREE_CHAIN (DECL_ARGUMENTS (clone))
- = TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (clone)));
+ DECL_CHAIN (DECL_ARGUMENTS (clone))
+ = DECL_CHAIN (DECL_CHAIN (DECL_ARGUMENTS (clone)));
DECL_HAS_IN_CHARGE_PARM_P (clone) = 0;
}
/* And the VTT parm, in a complete [cd]tor. */
@@ -3964,13 +3977,13 @@ build_clone (tree fn, tree name)
DECL_HAS_VTT_PARM_P (clone) = 1;
else
{
- TREE_CHAIN (DECL_ARGUMENTS (clone))
- = TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (clone)));
+ DECL_CHAIN (DECL_ARGUMENTS (clone))
+ = DECL_CHAIN (DECL_CHAIN (DECL_ARGUMENTS (clone)));
DECL_HAS_VTT_PARM_P (clone) = 0;
}
}
- for (parms = DECL_ARGUMENTS (clone); parms; parms = TREE_CHAIN (parms))
+ for (parms = DECL_ARGUMENTS (clone); parms; parms = DECL_CHAIN (parms))
{
DECL_CONTEXT (parms) = clone;
cxx_dup_lang_specific_decl (parms);
@@ -4033,8 +4046,8 @@ clone_function_decl (tree fn, int update_method_vec_p)
tree clone;
/* Avoid inappropriate cloning. */
- if (TREE_CHAIN (fn)
- && DECL_CLONED_FUNCTION_P (TREE_CHAIN (fn)))
+ if (DECL_CHAIN (fn)
+ && DECL_CLONED_FUNCTION_P (DECL_CHAIN (fn)))
return;
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
@@ -4091,8 +4104,8 @@ adjust_clone_args (tree decl)
{
tree clone;
- for (clone = TREE_CHAIN (decl); clone && DECL_CLONED_FUNCTION_P (clone);
- clone = TREE_CHAIN (clone))
+ for (clone = DECL_CHAIN (decl); clone && DECL_CLONED_FUNCTION_P (clone);
+ clone = DECL_CHAIN (clone))
{
tree orig_clone_parms = TYPE_ARG_TYPES (TREE_TYPE (clone));
tree orig_decl_parms = TYPE_ARG_TYPES (TREE_TYPE (decl));
@@ -4363,9 +4376,9 @@ remove_zero_width_bit_fields (tree t)
check_bitfield_decl eventually sets DECL_SIZE (*fieldsp)
to that width. */
&& integer_zerop (DECL_SIZE (*fieldsp)))
- *fieldsp = TREE_CHAIN (*fieldsp);
+ *fieldsp = DECL_CHAIN (*fieldsp);
else
- fieldsp = &TREE_CHAIN (*fieldsp);
+ fieldsp = &DECL_CHAIN (*fieldsp);
}
}
@@ -4519,7 +4532,7 @@ check_bases_and_members (tree t)
{
tree field;
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
{
tree type;
@@ -4545,7 +4558,7 @@ check_bases_and_members (tree t)
/* Check defaulted declarations here so we have cant_have_const_ctor
and don't need to worry about clones. */
- for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
+ for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn))
if (DECL_DEFAULTED_IN_CLASS_P (fn))
{
int copy = copy_fn_p (fn);
@@ -4611,7 +4624,7 @@ create_vtable_ptr (tree t, tree* virtuals_p)
tree fn;
/* Collect the virtual functions declared in T. */
- for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
+ for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn))
if (DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn)
&& TREE_CODE (DECL_VINDEX (fn)) != INTEGER_CST)
{
@@ -4746,7 +4759,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
bases will go after the last extant field to date. */
next_field = &TYPE_FIELDS (t);
while (*next_field)
- next_field = &TREE_CHAIN (*next_field);
+ next_field = &DECL_CHAIN (*next_field);
/* Go through the virtual bases, allocating space for each virtual
base that is not already a primary base class. These are
@@ -4987,9 +5000,9 @@ layout_class_type (tree t, tree *virtuals_p)
/* The vptr is always the first thing in the class. */
if (vptr)
{
- TREE_CHAIN (vptr) = TYPE_FIELDS (t);
+ DECL_CHAIN (vptr) = TYPE_FIELDS (t);
TYPE_FIELDS (t) = vptr;
- next_field = &TREE_CHAIN (vptr);
+ next_field = &DECL_CHAIN (vptr);
place_field (rli, vptr);
}
else
@@ -5001,7 +5014,7 @@ layout_class_type (tree t, tree *virtuals_p)
build_base_fields (rli, empty_base_offsets, next_field);
/* Layout the non-static data members. */
- for (field = non_static_data_members; field; field = TREE_CHAIN (field))
+ for (field = non_static_data_members; field; field = DECL_CHAIN (field))
{
tree type;
tree padding;
@@ -5282,7 +5295,7 @@ layout_class_type (tree t, tree *virtuals_p)
/* Copy the fields from T. */
next_field = &TYPE_FIELDS (base_t);
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL)
{
*next_field = build_decl (input_location,
@@ -5295,7 +5308,7 @@ layout_class_type (tree t, tree *virtuals_p)
= DECL_FIELD_BIT_OFFSET (field);
DECL_SIZE (*next_field) = DECL_SIZE (field);
DECL_MODE (*next_field) = DECL_MODE (field);
- next_field = &TREE_CHAIN (*next_field);
+ next_field = &DECL_CHAIN (*next_field);
}
/* Record the base version of the type. */
@@ -5342,7 +5355,7 @@ layout_class_type (tree t, tree *virtuals_p)
warn_about_ambiguous_bases (t);
/* Now that we're done with layout, give the base fields the real types. */
- for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
if (DECL_ARTIFICIAL (field) && IS_FAKE_BASE_TYPE (TREE_TYPE (field)))
TREE_TYPE (field) = TYPE_CONTEXT (TREE_TYPE (field));
@@ -5374,7 +5387,7 @@ determine_key_method (tree type)
key function may not be inline; those targets should not call
this function until the end of the translation unit. */
for (method = TYPE_METHODS (type); method != NULL_TREE;
- method = TREE_CHAIN (method))
+ method = DECL_CHAIN (method))
if (DECL_VINDEX (method) != NULL_TREE
&& ! DECL_DECLARED_INLINE_P (method)
&& ! DECL_PURE_VIRTUAL_P (method))
@@ -5498,7 +5511,7 @@ finish_struct_1 (tree t)
/* Complete the rtl for any static member objects of the type we're
working on. */
- for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x))
+ for (x = TYPE_FIELDS (t); x; x = DECL_CHAIN (x))
if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
&& TREE_TYPE (x) != error_mark_node
&& same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t))
@@ -5595,13 +5608,13 @@ unreverse_member_declarations (tree t)
x && TREE_CODE (x) != TYPE_DECL;
x = next)
{
- next = TREE_CHAIN (x);
- TREE_CHAIN (x) = prev;
+ next = DECL_CHAIN (x);
+ DECL_CHAIN (x) = prev;
prev = x;
}
if (prev)
{
- TREE_CHAIN (TYPE_FIELDS (t)) = x;
+ DECL_CHAIN (TYPE_FIELDS (t)) = x;
if (prev)
TYPE_FIELDS (t) = prev;
}
@@ -5638,7 +5651,7 @@ finish_struct (tree t, tree attributes)
CLASSTYPE_PURE_VIRTUALS contains the list of the inline friends
(see CLASSTYPE_INLINE_FRIENDS) so we need to clear it. */
CLASSTYPE_PURE_VIRTUALS (t) = NULL;
- for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
+ 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);
complete_vars (t);
@@ -6749,7 +6762,7 @@ is_really_empty_class (tree type)
BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
if (!is_really_empty_class (BINFO_TYPE (base_binfo)))
return false;
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL
&& !DECL_ARTIFICIAL (field)
&& !is_really_empty_class (TREE_TYPE (field)))
@@ -7202,8 +7215,8 @@ build_vtt (tree t)
vtt = build_vtable (t, mangle_vtt_for_type (t), type);
initialize_artificial_var (vtt, inits);
/* Add the VTT to the vtables list. */
- TREE_CHAIN (vtt) = TREE_CHAIN (CLASSTYPE_VTABLES (t));
- TREE_CHAIN (CLASSTYPE_VTABLES (t)) = vtt;
+ DECL_CHAIN (vtt) = DECL_CHAIN (CLASSTYPE_VTABLES (t));
+ DECL_CHAIN (CLASSTYPE_VTABLES (t)) = vtt;
dump_vtt (t, vtt);
}
@@ -7656,7 +7669,7 @@ build_vtbl_initializer (tree binfo,
int* non_fn_entries_p,
VEC(constructor_elt,gc) **inits)
{
- tree v, b;
+ tree v;
vtbl_init_data vid;
unsigned ix, jx;
tree vbinfo;
@@ -7770,20 +7783,8 @@ build_vtbl_initializer (tree binfo,
zero out unused slots in ctor vtables, rather than filling them
with erroneous values (though harmless, apart from relocation
costs). */
- for (b = binfo; ; b = get_primary_binfo (b))
- {
- /* We found a defn before a lost primary; go ahead as normal. */
- if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
- break;
-
- /* The nearest definition is from a lost primary; clear the
- slot. */
- if (BINFO_LOST_PRIMARY_P (b))
- {
- init = size_zero_node;
- break;
- }
- }
+ if (BV_LOST_PRIMARY (v))
+ init = size_zero_node;
if (! init)
{
@@ -8045,7 +8046,7 @@ add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid)
order. G++ 3.2 used the order in the vtable. */
for (orig_fn = TYPE_METHODS (BINFO_TYPE (binfo));
orig_fn;
- orig_fn = TREE_CHAIN (orig_fn))
+ orig_fn = DECL_CHAIN (orig_fn))
if (DECL_VINDEX (orig_fn))
add_vcall_offset (orig_fn, binfo, vid);
}