+2004-07-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.h (TYPE_BINFO_OFFSET, TYPE_BINFO_VTABLE,
+ TYPE_BINFO_VIRTUALS, TYPE_BINFO_BASETYPES,
+ TYPE_BINFO_BASETYPE): Remove.
+ (BINFO_BASETYPES, BINFO_N_BASETYPES, BINFO_BASETYPE): Rename
+ to ...
+ (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): ...
+ here.
+ (BINFO_BASEACCESSES, BINFO_BASEACCESS): Rename to ...
+ (BINFO_BASE_ACCESSES, BINFO_BASE_ACCESS): ... here.
+ (BINFO_INHERITANCE_CHAIN): Redocument as it is actually used.
+ (struct tree_binfo): Rename base_types to base_binfos.
+ * alias.c (record_component_aliases): Adjust BINFO macros.
+ * dbxout.c (dbxout_type): Likewise.
+ * dwarf2out.c (gen_member_die): Likewise.
+ * sdbout.c (sdbout_one_type): Likewise.
+ * tree-dump.c (deque_and_dump): Likewise.
+ * config/i386/i386.c (classify_argument,
+ contains_128bit_aligned_vector_p): Likewise.
+
2004-07-07 Nick Clifton <nickc@redhat.com>
* config/fr30/fr30.c (fr30_setup_incoming_varargs): Change
case UNION_TYPE:
case QUAL_UNION_TYPE:
/* Recursively record aliases for the base classes, if there are any. */
- if (TYPE_BINFO (type) != NULL && TYPE_BINFO_BASETYPES (type) != NULL)
+ if (TYPE_BINFO (type) && BINFO_BASE_BINFOS (TYPE_BINFO (type)))
{
int i;
- for (i = 0; i < TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)); i++)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (type)); i++)
{
- tree binfo = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i);
+ tree binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
record_alias_subset (superset,
get_alias_set (BINFO_TYPE (binfo)));
}
if (TREE_CODE (type) == RECORD_TYPE)
{
/* For classes first merge in the field of the subclasses. */
- if (TYPE_BINFO (type) != NULL && TYPE_BINFO_BASETYPES (type) != NULL)
+ if (TYPE_BINFO (type) && BINFO_BASE_BINFOS (TYPE_BINFO (type)))
{
- tree bases = TYPE_BINFO_BASETYPES (type);
- int n_bases = TREE_VEC_LENGTH (bases);
+ tree bases = BINFO_BASE_BINFOS (TYPE_BINFO (type));
+ int n_bases = BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
int i;
for (i = 0; i < n_bases; ++i)
|| TREE_CODE (type) == QUAL_UNION_TYPE)
{
/* For classes first merge in the field of the subclasses. */
- if (TYPE_BINFO (type) != NULL && TYPE_BINFO_BASETYPES (type) != NULL)
+ if (TYPE_BINFO (type) && BINFO_BASE_BINFOS (TYPE_BINFO (type)))
{
- tree bases = TYPE_BINFO_BASETYPES (type);
- int n_bases = TREE_VEC_LENGTH (bases);
+ tree bases = BINFO_BASE_BINFOS (TYPE_BINFO (type));
+ int n_bases = BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
int i;
for (i = 0; i < n_bases; ++i)
{
tree field;
- if (TYPE_BINFO (type) != NULL
- && TYPE_BINFO_BASETYPES (type) != NULL)
+ if (TYPE_BINFO (type) && BINFO_BASE_BINFOS (TYPE_BINFO (type)))
{
- tree bases = TYPE_BINFO_BASETYPES (type);
- int n_bases = TREE_VEC_LENGTH (bases);
+ tree bases = BINFO_BASE_BINFOS (TYPE_BINFO (type));
+ int n_bases = BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
int i;
for (i = 0; i < n_bases; ++i)
+2004-07-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_N_BASECLASSES): Remove.
+ * class.c (build_primary_vtable, check_bases,
+ determine_primary_base, finish_struct_bits,
+ maybe_warn_about_overly_private_class, dfs_find_final_overrider_q,
+ get_basefndecls, warn_hidden, walk_subobject_offsets,
+ build_base_fields, create_vtable_ptr, propagate_binfo_offsets,
+ layout_virtual_bases, end_of_class, warn_about_ambiguous_bases,
+ finish_struct_1, get_vfield_name, contains_empty_class_p,
+ dump_class_hierarchy_r, finish_vtbls, build_vtt_inits,
+ dfs_ctor_vtable_bases_queue_p, accumulate_vtbl_inits,
+ add_vcall_offset_vtbl_entries_r, cp_fold_obj_type_ref): Adjust
+ BINFO macros.
+ * decl.c (xref_basetypes): Likewise.
+ * dump.c (cp_dump_tree): Likewise.
+ * error.c (dump_expr): Likewise.
+ * init.c (sort_mem_initializers, expand_member_init,
+ push_base_cleanups): Likewise.
+ * method.c (do_build_copy_constructor, do_build_assign_reg,
+ synthesize_exception_spec): Likewise.
+ * name-lookup.c (arg_assoc_class):
+ * pt.c (instantiate_class_template, tsubst,
+ get_template_base_recursive):
+ * ptree.c (cxx_print_type):
+ * rtti.c (get_psuedo_ti_init, get_pseudo_ti_desc): Likewise.
+ * search.c (lookup_base_r, dynamic_cast_base_recurse,
+ dfs_access_in_type, access_in_type, lookup_field_queue_p,
+ bfs_walk, dfs_walk_real, look_for_overrides, markedp, unmarkedp,
+ marked_pushdecls_p, unmarked_pushdecls_p, dfs_debug_markedp,
+ dfs_debug_unmarkedp, dfs_check_overlap, dfs_no_overlap_yet,
+ binfo_for_vtable, copied_binfo, original_binfo): Likewise
+ * tree.c (copy_base_binfos, make_binfo): Likewise.
+ * typeck.c (commmon_base_type): Likewise
+ * typeck2.c (process_init_constructor): Likewise
+
2004-07-06 Joseph S. Myers <jsm@polyomino.org.uk>
* decl.c (check_tag_decl): Name redeclared type in diagnostic.
/* Initialize the association list for this type, based
on our first approximation. */
- TYPE_BINFO_VTABLE (type) = decl;
- TYPE_BINFO_VIRTUALS (type) = virtuals;
+ BINFO_VTABLE (TYPE_BINFO (type)) = decl;
+ BINFO_VIRTUALS (TYPE_BINFO (type)) = virtuals;
SET_BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (type));
return 1;
}
int seen_non_virtual_nearly_empty_base_p;
tree binfos;
- binfos = TYPE_BINFO_BASETYPES (t);
- n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ binfos = BINFO_BASE_BINFOS (TYPE_BINFO (t));
+ n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
seen_non_virtual_nearly_empty_base_p = 0;
/* An aggregate cannot have baseclasses. */
CLASSTYPE_PRIMARY_BINFO (t) = binfo;
basetype = BINFO_TYPE (binfo);
- TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
- TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
+ BINFO_VTABLE (TYPE_BINFO (t)) = BINFO_VTABLE (TYPE_BINFO (basetype));
+ BINFO_VIRTUALS (TYPE_BINFO (t)) = BINFO_VIRTUALS (TYPE_BINFO (basetype));
TYPE_VFIELD (t) = TYPE_VFIELD (basetype);
}
static void
determine_primary_base (tree t)
{
- unsigned i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ unsigned i, n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
tree type_binfo;
tree vbase_binfo;
for (i = 0; i < n_baseclasses; i++)
{
- tree base_binfo = BINFO_BASETYPE (type_binfo, i);
+ tree base_binfo = BINFO_BASE_BINFO (type_binfo, i);
tree basetype = BINFO_TYPE (base_binfo);
if (TYPE_CONTAINS_VPTR_P (basetype))
{
unsigned k;
tree base_vbase_binfo;
- tree basetype = TYPE_BINFO_BASETYPE (t, j);
+ tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), j));
for (k = 0; (base_vbase_binfo = VEC_iterate
(tree, CLASSTYPE_VBASECLASSES (basetype), k)); k++)
static void
finish_struct_bits (tree t)
{
- int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ int i, n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
/* Fix up variants (if any). */
tree variants = TYPE_NEXT_VARIANT (t);
{
/* Notice whether this class has type conversion functions defined. */
tree binfo = TYPE_BINFO (t);
- tree binfos = BINFO_BASETYPES (binfo);
+ tree binfos = BINFO_BASE_BINFOS (binfo);
tree basetype;
for (i = n_baseclasses-1; i >= 0; i--)
int i;
tree binfo = TYPE_BINFO (t);
- for (i = 0; i < BINFO_N_BASETYPES (binfo); i++)
- if (BINFO_BASEACCESS (binfo, i) != access_private_node)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (binfo); i++)
+ if (BINFO_BASE_ACCESS (binfo, i) != access_private_node)
{
has_nonprivate_method = 1;
break;
static tree
dfs_find_final_overrider_q (tree derived, int ix, void *data)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
find_final_overrider_data *ffod = (find_final_overrider_data *) data;
if (BINFO_VIRTUAL_P (binfo))
{
tree methods;
tree base_fndecls = NULL_TREE;
- int n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ int n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
int i;
/* Find virtual functions in T with the indicated NAME. */
for (i = 0; i < n_baseclasses; i++)
{
- tree basetype = TYPE_BINFO_BASETYPE (t, i);
+ tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), i));
base_fndecls = chainon (get_basefndecls (name, basetype),
base_fndecls);
}
base_fndecls = NULL_TREE;
/* Iterate through all of the base classes looking for possibly
hidden functions. */
- for (j = 0; j < CLASSTYPE_N_BASECLASSES (t); j++)
+ for (j = 0; j < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); j++)
{
- tree basetype = TYPE_BINFO_BASETYPE (t, j);
+ tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), j));
base_fndecls = chainon (get_basefndecls (name, basetype),
base_fndecls);
}
/* Iterate through the direct base classes of TYPE. */
if (!type_binfo)
type_binfo = TYPE_BINFO (type);
- for (i = 0; i < BINFO_N_BASETYPES (type_binfo); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (type_binfo); ++i)
{
tree binfo_offset;
- binfo = BINFO_BASETYPE (type_binfo, i);
+ binfo = BINFO_BASE_BINFO (type_binfo, i);
if (abi_version_at_least (2)
&& BINFO_VIRTUAL_P (binfo))
/* We cannot rely on BINFO_OFFSET being set for the base
class yet, but the offsets for direct non-virtual
bases can be calculated by going back to the TYPE. */
- orig_binfo = BINFO_BASETYPE (TYPE_BINFO (type), i);
+ orig_binfo = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
binfo_offset = size_binop (PLUS_EXPR,
offset,
BINFO_OFFSET (orig_binfo));
/* Chain to hold all the new FIELD_DECLs which stand in for base class
subobjects. */
tree t = rli->t;
- int n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
+ int n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
int i;
/* The primary base class is always allocated first. */
{
tree base_binfo;
- base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ base_binfo = BINFO_BASE_BINFO (TYPE_BINFO (t), i);
/* The primary base was already allocated above, so we don't
need to allocate it again here. */
/* This class is non-empty. */
CLASSTYPE_EMPTY_P (t) = 0;
- if (CLASSTYPE_N_BASECLASSES (t))
+ if (BINFO_N_BASE_BINFOS (TYPE_BINFO (t)))
/* If there were any baseclasses, they can't possibly be at
offset zero any more, because that's where the vtable
pointer is. So, converting to a base class is going to
/* Scan all of the bases, pushing the BINFO_OFFSET adjust
downwards. */
- for (i = -1; i < BINFO_N_BASETYPES (binfo); ++i)
+ for (i = -1; i < BINFO_N_BASE_BINFOS (binfo); ++i)
{
tree base_binfo;
}
else
{
- base_binfo = BINFO_BASETYPE (binfo, i);
+ base_binfo = BINFO_BASE_BINFO (binfo, i);
/* Don't do the primary base twice. */
if (base_binfo == primary_binfo)
continue;
bool first_vbase = true;
tree *next_field;
- if (CLASSTYPE_N_BASECLASSES (t) == 0)
+ if (BINFO_N_BASE_BINFOS (TYPE_BINFO (t)) == 0)
return;
if (!abi_version_at_least(2))
tree offset;
int i;
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); ++i)
{
- binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ binfo = BINFO_BASE_BINFO (TYPE_BINFO (t), i);
if (!include_virtuals_p
&& BINFO_VIRTUAL_P (binfo)
tree binfo;
/* Check direct bases. */
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); ++i)
{
- basetype = TYPE_BINFO_BASETYPE (t, i);
+ basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (t), i));
if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
int vindex;
tree fn;
- if (TYPE_BINFO_VTABLE (t))
- my_friendly_assert (DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)),
+ if (BINFO_VTABLE (TYPE_BINFO (t)))
+ my_friendly_assert (DECL_VIRTUAL_P (BINFO_VTABLE (TYPE_BINFO (t))),
20000116);
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
- my_friendly_assert (TYPE_BINFO_VIRTUALS (t) == NULL_TREE,
+ my_friendly_assert (BINFO_VIRTUALS (TYPE_BINFO (t)) == NULL_TREE,
20000116);
/* Add entries for virtual functions introduced by this class. */
- TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t), virtuals);
+ BINFO_VIRTUALS (TYPE_BINFO (t))
+ = chainon (BINFO_VIRTUALS (TYPE_BINFO (t)), virtuals);
/* Set DECL_VINDEX for all functions declared in this class. */
for (vindex = 0, fn = BINFO_VIRTUALS (TYPE_BINFO (t));
tree binfo = TYPE_BINFO (type);
char *buf;
- while (BINFO_BASETYPES (binfo)
- && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0)))
- && ! BINFO_VIRTUAL_P (BINFO_BASETYPE (binfo, 0)))
- binfo = BINFO_BASETYPE (binfo, 0);
+ while (BINFO_BASE_BINFOS (binfo)
+ && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASE_BINFO (binfo, 0)))
+ && ! BINFO_VIRTUAL_P (BINFO_BASE_BINFO (binfo, 0)))
+ binfo = BINFO_BASE_BINFO (binfo, 0);
type = BINFO_TYPE (binfo);
buf = alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2);
tree field;
int i;
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); ++i)
- if (contains_empty_class_p (TYPE_BINFO_BASETYPE (type, i)))
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (type)); ++i)
+ if (contains_empty_class_p
+ (BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type), i))))
return true;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL
fprintf (stream, "\n");
}
- base_binfos = BINFO_BASETYPES (binfo);
+ base_binfos = BINFO_BASE_BINFOS (binfo);
if (base_binfos)
{
int ix, n;
/* We lay out the primary and secondary vtables in one contiguous
vtable. The primary vtable is first, followed by the non-virtual
secondary vtables in inheritance graph order. */
- list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE);
+ list = build_tree_list (BINFO_VTABLE (TYPE_BINFO (t)), NULL_TREE);
accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
TYPE_BINFO (t), t, list);
accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
}
- if (TYPE_BINFO_VTABLE (t))
+ if (BINFO_VTABLE (TYPE_BINFO (t)))
initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
}
*index = size_binop (PLUS_EXPR, *index, TYPE_SIZE_UNIT (ptr_type_node));
/* Recursively add the secondary VTTs for non-virtual bases. */
- for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (binfo); ++i)
{
- b = BINFO_BASETYPE (binfo, i);
+ b = BINFO_BASE_BINFO (binfo, i);
if (!BINFO_VIRTUAL_P (b))
- inits = build_vtt_inits (BINFO_BASETYPE (binfo, i), t,
+ inits = build_vtt_inits (BINFO_BASE_BINFO (binfo, i), t,
inits, index);
}
dfs_ctor_vtable_bases_queue_p (tree derived, int ix,
void* data)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
if (!BINFO_MARKED (binfo) == VTT_MARKED_BINFO_P ((tree) data))
return NULL_TREE;
secondary vtable lies from the primary vtable. We can't use
dfs_walk here because we need to iterate through bases of BINFO
and RTTI_BINFO simultaneously. */
- for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (binfo); ++i)
{
- tree base_binfo = BINFO_BASETYPE (binfo, i);
+ tree base_binfo = BINFO_BASE_BINFO (binfo, i);
/* Skip virtual bases. */
if (BINFO_VIRTUAL_P (base_binfo))
continue;
accumulate_vtbl_inits (base_binfo,
- BINFO_BASETYPE (orig_binfo, i),
+ BINFO_BASE_BINFO (orig_binfo, i),
rtti_binfo, t,
inits);
}
add_vcall_offset_vtbl_entries_1 (binfo, vid);
/* Scan the non-primary bases of BINFO. */
- for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (binfo); ++i)
{
tree base_binfo;
- base_binfo = BINFO_BASETYPE (binfo, i);
+ base_binfo = BINFO_BASE_BINFO (binfo, i);
if (base_binfo != primary_binfo)
add_vcall_offset_vtbl_entries_r (base_binfo, vid);
}
{
HOST_WIDE_INT index = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1);
HOST_WIDE_INT i = 0;
- tree v = TYPE_BINFO_VIRTUALS (known_type);
+ tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type));
tree fndecl;
while (i != index)
should be initialized.) */
#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
-/* Number of direct baseclasses of NODE. */
-#define CLASSTYPE_N_BASECLASSES(NODE) \
- (BINFO_N_BASETYPES (TYPE_BINFO (NODE)))
-
/* The type corresponding to NODE when NODE is used as a base class,
i.e., NODE without virtual base classes. */
tree binfos = make_tree_vec (i);
tree accesses = make_tree_vec (i);
- BINFO_BASETYPES (binfo) = binfos;
- BINFO_BASEACCESSES (binfo) = accesses;
+ BINFO_BASE_BINFOS (binfo) = binfos;
+ BINFO_BASE_ACCESSES (binfo) = accesses;
for (i = 0; base_list; base_list = TREE_CHAIN (base_list))
{
if (i)
TREE_VEC_LENGTH (accesses) = TREE_VEC_LENGTH (binfos) = i;
else
- BINFO_BASEACCESSES (binfo) = BINFO_BASETYPES (binfo) = NULL_TREE;
+ BINFO_BASE_ACCESSES (binfo) = BINFO_BASE_BINFOS (binfo) = NULL_TREE;
if (max_vbases)
CLASSTYPE_VBASECLASSES (ref) = VEC_alloc (tree, max_vbases);
/* Unmark all the types. */
while (i--)
{
- tree basetype = BINFO_TYPE (BINFO_BASETYPE (TYPE_BINFO (ref), i));
+ tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (ref), i));
CLEAR_CLASSTYPE_MARKED (basetype);
if (CLASS_TYPE_P (basetype))
{
int i;
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); ++i)
{
- tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ tree base_binfo = BINFO_BASE_BINFO (TYPE_BINFO (t), i);
dump_child ("base", BINFO_TYPE (base_binfo));
if (BINFO_VIRTUAL_P (base_binfo))
dump_string (di, "virtual");
t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
t = TYPE_METHOD_BASETYPE (t);
- virtuals = TYPE_BINFO_VIRTUALS (TYPE_MAIN_VARIANT (t));
+ virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t)));
n = tree_low_cst (idx, 0);
sorted_inits = tree_cons (base, NULL_TREE, sorted_inits);
/* Process the direct bases. */
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); ++i)
{
- base = BINFO_BASETYPE (TYPE_BINFO (t), i);
+ base = BINFO_BASE_BINFO (TYPE_BINFO (t), i);
if (!BINFO_VIRTUAL_P (base))
sorted_inits = tree_cons (base, NULL_TREE, sorted_inits);
}
{
/* This is an obsolete unnamed base class initializer. The
parser will already have warned about its use. */
- switch (CLASSTYPE_N_BASECLASSES (current_class_type))
+ switch (BINFO_N_BASE_BINFOS (TYPE_BINFO (current_class_type)))
{
case 0:
error ("unnamed initializer for `%T', which has no base classes",
current_class_type);
return NULL_TREE;
case 1:
- basetype = TYPE_BINFO_BASETYPE (current_class_type, 0);
+ basetype = BINFO_TYPE
+ (BINFO_BASE_BINFO (TYPE_BINFO (current_class_type), 0));
break;
default:
error ("unnamed initializer for `%T', which uses multiple inheritance",
virtual_binfo = NULL_TREE;
/* Look for a direct base. */
- for (i = 0; i < BINFO_N_BASETYPES (class_binfo); ++i)
- if (same_type_p (basetype,
- TYPE_BINFO_BASETYPE (current_class_type, i)))
+ for (i = 0; i < BINFO_N_BASE_BINFOS (class_binfo); ++i)
+ if (same_type_p
+ (basetype, BINFO_TYPE
+ (BINFO_BASE_BINFO (TYPE_BINFO (current_class_type), i))))
{
- direct_binfo = BINFO_BASETYPE (class_binfo, i);
+ direct_binfo = BINFO_BASE_BINFO (class_binfo, i);
break;
}
/* Look for a virtual base -- unless the direct base is itself
}
}
- binfos = BINFO_BASETYPES (TYPE_BINFO (current_class_type));
- n_baseclasses = CLASSTYPE_N_BASECLASSES (current_class_type);
+ binfos = BINFO_BASE_BINFOS (TYPE_BINFO (current_class_type));
+ n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (current_class_type));
/* Take care of the remaining baseclasses. */
for (i = 0; i < n_baseclasses; i++)
else
{
tree fields = TYPE_FIELDS (current_class_type);
- int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type);
- tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
+ int n_bases = BINFO_N_BASE_BINFOS (TYPE_BINFO (current_class_type));
+ tree binfos = BINFO_BASE_BINFOS (TYPE_BINFO (current_class_type));
tree member_init_list = NULL_TREE;
int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
int i;
/* Assign to each of the direct base classes. */
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (current_class_type); ++i)
+ for (i = 0;
+ i < BINFO_N_BASE_BINFOS (TYPE_BINFO (current_class_type));
+ ++i)
{
tree binfo;
tree converted_parm;
- binfo = BINFO_BASETYPE (TYPE_BINFO (current_class_type), i);
+ binfo = BINFO_BASE_BINFO (TYPE_BINFO (current_class_type), i);
/* We must convert PARM directly to the base class
explicitly since the base class may be ambiguous. */
converted_parm = build_base_path (PLUS_EXPR, parm, binfo, 1);
{
tree raises = empty_except_spec;
tree fields = TYPE_FIELDS (type);
- int i, n_bases = CLASSTYPE_N_BASECLASSES (type);
- tree binfos = TYPE_BINFO_BASETYPES (type);
+ int i, n_bases = BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
+ tree binfos = BINFO_BASE_BINFOS (TYPE_BINFO (type));
for (i = 0; i != n_bases; i++)
{
return true;
/* Process baseclasses. */
- for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); i++)
- if (arg_assoc_class (k, TYPE_BINFO_BASETYPE (type, i)))
+ for (i = 0; i < BINFO_N_BASE_BINFOS (TYPE_BINFO (type)); i++)
+ if (arg_assoc_class
+ (k, BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type), i))))
return true;
/* Process friends. */
abort ();
#endif
- if (BINFO_BASETYPES (pbinfo))
+ if (BINFO_BASE_BINFOS (pbinfo))
{
tree base_list = NULL_TREE;
- tree pbases = BINFO_BASETYPES (pbinfo);
- tree paccesses = BINFO_BASEACCESSES (pbinfo);
+ tree pbases = BINFO_BASE_BINFOS (pbinfo);
+ tree paccesses = BINFO_BASE_ACCESSES (pbinfo);
tree context = TYPE_CONTEXT (type);
bool pop_p;
int i;
case TREE_BINFO:
/* A binfo node. We always need to make a copy, of the node
- itself and of its BINFO_BASETYPES. */
+ itself and of its BINFO_BASE_BINFOS. */
my_friendly_assert (type, 20040628);
t = copy_node (t);
TREE_TYPE (t) = complete_type (type);
if (IS_AGGR_TYPE (type))
{
- BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (type);
- BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (type);
- if (TYPE_BINFO_BASETYPES (type) != NULL_TREE)
- BINFO_BASETYPES (t) = copy_node (TYPE_BINFO_BASETYPES (type));
+ BINFO_VTABLE (t) = BINFO_VTABLE (TYPE_BINFO (type));
+ BINFO_VIRTUALS (t) = BINFO_VIRTUALS (TYPE_BINFO (type));
+ if (BINFO_BASE_BINFOS (TYPE_BINFO (type)) != NULL_TREE)
+ BINFO_BASE_BINFOS (t)
+ = copy_node (BINFO_BASE_BINFOS (TYPE_BINFO (type)));
}
return t;
rval = r;
}
- binfos = BINFO_BASETYPES (arg_binfo);
+ binfos = BINFO_BASE_BINFOS (arg_binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
/* Process base types. */
if (TREE_CODE (node) == RECORD_TYPE)
{
- fprintf (file, " n_parents %d", CLASSTYPE_N_BASECLASSES (node));
+ fprintf (file, " n_parents %d", BINFO_N_BASE_BINFOS (TYPE_BINFO (node)));
fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
if (CLASSTYPE_INTERFACE_ONLY (node))
fprintf (file, " interface-only");
}
else if (var_desc == si_class_desc_type_node)
{
- tree base_binfos = BINFO_BASETYPES (TYPE_BINFO (type));
+ tree base_binfos = BINFO_BASE_BINFOS (TYPE_BINFO (type));
tree base_binfo = TREE_VEC_ELT (base_binfos, 0);
tree tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
tree base_inits = tree_cons (NULL_TREE, tinfo, NULL_TREE);
{
int hint = class_hint_flags (type);
tree binfo = TYPE_BINFO (type);
- int nbases = BINFO_N_BASETYPES (binfo);
- tree base_binfos = BINFO_BASETYPES (binfo);
- tree base_accesses = BINFO_BASEACCESSES (binfo);
+ int nbases = BINFO_N_BASE_BINFOS (binfo);
+ tree base_binfos = BINFO_BASE_BINFOS (binfo);
+ tree base_accesses = BINFO_BASE_ACCESSES (binfo);
tree base_inits = NULL_TREE;
int ix;
cxx_incomplete_type_error (NULL_TREE, type);
return class_desc_type_node;
}
- else if (!CLASSTYPE_N_BASECLASSES (type))
+ else if (!BINFO_N_BASE_BINFOS (TYPE_BINFO (type)))
return class_desc_type_node;
else
{
tree binfo = TYPE_BINFO (type);
- tree base_binfos = BINFO_BASETYPES (binfo);
- tree base_accesses = BINFO_BASEACCESSES (binfo);
+ tree base_binfos = BINFO_BASE_BINFOS (binfo);
+ tree base_accesses = BINFO_BASE_ACCESSES (binfo);
tree base_binfo = TREE_VEC_ELT (base_binfos, 0);
int num_bases = TREE_VEC_LENGTH (base_binfos);
return found;
}
- bases = BINFO_BASETYPES (binfo);
- accesses = BINFO_BASEACCESSES (binfo);
+ bases = BINFO_BASE_BINFOS (binfo);
+ accesses = BINFO_BASE_ACCESSES (binfo);
if (!bases)
return bk_not_base;
}
}
- binfos = BINFO_BASETYPES (binfo);
- accesses = BINFO_BASEACCESSES (binfo);
+ binfos = BINFO_BASE_BINFOS (binfo);
+ accesses = BINFO_BASE_ACCESSES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
for (i = 0; i < n_baselinks; i++)
{
/* Otherwise, scan our baseclasses, and pick the most favorable
access. */
- binfos = BINFO_BASETYPES (binfo);
- accesses = BINFO_BASEACCESSES (binfo);
+ binfos = BINFO_BASE_BINFOS (binfo);
+ accesses = BINFO_BASE_ACCESSES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
for (i = 0; i < n_baselinks; ++i)
{
static tree
dfs_accessible_queue_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
if (BINFO_MARKED (binfo))
return NULL_TREE;
/* If this class is inherited via private or protected inheritance,
then we can't see it, unless we are a friend of the derived class. */
- if (BINFO_BASEACCESS (derived, ix) != access_public_node
+ if (BINFO_BASE_ACCESS (derived, ix) != access_public_node
&& !is_friend (BINFO_TYPE (derived), current_scope ()))
return NULL_TREE;
static tree
lookup_field_queue_p (tree derived, int ix, void *data)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
struct lookup_field_info *lfi = (struct lookup_field_info *) data;
/* Don't look for constructors or destructors in base classes. */
if (rval)
goto done;
- n_bases = BINFO_N_BASETYPES (binfo);
+ n_bases = BINFO_N_BASE_BINFOS (binfo);
for (ix = 0; ix != n_bases; ix++)
{
tree base_binfo;
if (qfn)
base_binfo = (*qfn) (binfo, ix, data);
else
- base_binfo = BINFO_BASETYPE (binfo, ix);
+ base_binfo = BINFO_BASE_BINFO (binfo, ix);
if (base_binfo)
{
}
/* Process the basetypes. */
- if (BINFO_BASETYPES (binfo))
+ if (BINFO_BASE_BINFOS (binfo))
{
- int i, n = TREE_VEC_LENGTH (BINFO_BASETYPES (binfo));
+ int i, n = TREE_VEC_LENGTH (BINFO_BASE_BINFOS (binfo));
for (i = 0; i != n; i++)
{
tree base_binfo;
if (qfn)
base_binfo = (*qfn) (binfo, i, data);
else
- base_binfo = BINFO_BASETYPE (binfo, i);
+ base_binfo = BINFO_BASE_BINFO (binfo, i);
if (base_binfo)
{
look_for_overrides (tree type, tree fndecl)
{
tree binfo = TYPE_BINFO (type);
- tree basebinfos = BINFO_BASETYPES (binfo);
+ tree basebinfos = BINFO_BASE_BINFOS (binfo);
int nbasebinfos = basebinfos ? TREE_VEC_LENGTH (basebinfos) : 0;
int ix;
int found = 0;
tree
markedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
return BINFO_MARKED (binfo) ? binfo : NULL_TREE;
}
tree
unmarkedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
return !BINFO_MARKED (binfo) ? binfo : NULL_TREE;
}
static tree
marked_pushdecls_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
return (!BINFO_DEPENDENT_BASE_P (binfo)
&& BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
static tree
unmarked_pushdecls_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
return (!BINFO_DEPENDENT_BASE_P (binfo)
&& !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
static tree
dfs_debug_unmarkedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
return (!CLASSTYPE_DEBUG_REQUESTED (BINFO_TYPE (binfo))
? binfo : NULL_TREE);
tree binfo;
for (binfo = TYPE_BINFO (oi->compare_type);
;
- binfo = BINFO_BASETYPE (binfo, 0))
+ binfo = BINFO_BASE_BINFO (binfo, 0))
{
if (BINFO_TYPE (binfo) == BINFO_TYPE (empty_binfo))
{
oi->found_overlap = 1;
break;
}
- else if (BINFO_BASETYPES (binfo) == NULL_TREE)
+ else if (BINFO_BASE_BINFOS (binfo) == NULL_TREE)
break;
}
static tree
dfs_no_overlap_yet (tree derived, int ix, void *data)
{
- tree binfo = BINFO_BASETYPE (derived, ix);
+ tree binfo = BINFO_BASE_BINFO (derived, ix);
struct overlap_info *oi = (struct overlap_info *) data;
return !oi->found_overlap ? binfo : NULL_TREE;
binfo_for_vtable (tree var)
{
tree main_binfo = TYPE_BINFO (DECL_CONTEXT (var));
- tree binfos = TYPE_BINFO_BASETYPES (BINFO_TYPE (main_binfo));
- int n_baseclasses = CLASSTYPE_N_BASECLASSES (BINFO_TYPE (main_binfo));
+ tree binfos = BINFO_BASE_BINFOS (TYPE_BINFO (BINFO_TYPE (main_binfo)));
+ int n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (BINFO_TYPE (main_binfo)));
int i;
for (i = 0; i < n_baseclasses; i++)
int ix, n;
base_binfos = copied_binfo (BINFO_INHERITANCE_CHAIN (binfo), here);
- base_binfos = BINFO_BASETYPES (base_binfos);
+ base_binfos = BINFO_BASE_BINFOS (base_binfos);
n = TREE_VEC_LENGTH (base_binfos);
for (ix = 0; ix != n; ix++)
{
{
int ix, n;
- base_binfos = BINFO_BASETYPES (base_binfos);
+ base_binfos = BINFO_BASE_BINFOS (base_binfos);
n = TREE_VEC_LENGTH (base_binfos);
for (ix = 0; ix != n; ix++)
{
tree
copy_base_binfos (tree binfo, tree t, tree prev)
{
- tree binfos = BINFO_BASETYPES (binfo);
+ tree binfos = BINFO_BASE_BINFOS (binfo);
int n, ix;
if (prev)
BINFO_VIRTUALS (new_binfo) = virtuals;
if (binfo && !BINFO_DEPENDENT_BASE_P (binfo)
- && BINFO_BASETYPES (binfo) != NULL_TREE)
+ && BINFO_BASE_BINFOS (binfo) != NULL_TREE)
{
- BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
+ BINFO_BASE_BINFOS (new_binfo) = copy_node (BINFO_BASE_BINFOS (binfo));
/* We do not need to copy the accesses, as they are read only. */
- BINFO_BASEACCESSES (new_binfo) = BINFO_BASEACCESSES (binfo);
+ BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (binfo);
}
return new_binfo;
}
/* Otherwise, try to find a unique baseclass of TT1
that is shared by TT2, and follow that down. */
- for (i = CLASSTYPE_N_BASECLASSES (tt1)-1; i >= 0; i--)
+ for (i = BINFO_N_BASE_BINFOS (TYPE_BINFO (tt1))-1; i >= 0; i--)
{
- tree basetype = TYPE_BINFO_BASETYPE (tt1, i);
+ tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (tt1), i));
tree trial = common_base_type (basetype, tt2);
+
if (trial)
{
if (trial == error_mark_node)
}
/* Same for TT2. */
- for (i = CLASSTYPE_N_BASECLASSES (tt2)-1; i >= 0; i--)
+ for (i = BINFO_N_BASE_BINFOS (TYPE_BINFO (tt2))-1; i >= 0; i--)
{
- tree basetype = TYPE_BINFO_BASETYPE (tt2, i);
+ tree basetype = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (tt2), i));
tree trial = common_base_type (tt1, basetype);
+
if (trial)
{
if (trial == error_mark_node)
return error_mark_node;
}
- if (TYPE_BINFO_BASETYPES (type))
+ if (BINFO_BASE_BINFOS (TYPE_BINFO (type)))
{
sorry ("initializer list for object of class with base classes");
return error_mark_node;
{
int i, n_baseclasses = 0;
- if (TYPE_BINFO (type) != 0
- && TYPE_BINFO_BASETYPES (type) != 0)
- n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
+ if (TYPE_BINFO (type) && BINFO_BASE_BINFOS (TYPE_BINFO (type)))
+ n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
/* Output a structure type. We must use the same test here as we
use in the DBX_NO_XREFS case above. */
for (i = 0; i < n_baseclasses; i++)
{
tree binfo = TYPE_BINFO (type);
- tree child = BINFO_BASETYPE (binfo, i);
- tree access = (BINFO_BASEACCESSES (binfo)
- ? BINFO_BASEACCESS (binfo, i) : access_public_node);
+ tree child = BINFO_BASE_BINFO (binfo, i);
+ tree access = (BINFO_BASE_ACCESSES (binfo)
+ ? BINFO_BASE_ACCESS (binfo, i) : access_public_node);
if (use_gnu_debug_info_extensions)
{
the TREE node representing the appropriate (containing) type. */
/* First output info about the base classes. */
- if (binfo && BINFO_BASETYPES (binfo))
+ if (binfo && BINFO_BASE_BINFOS (binfo))
{
- tree bases = BINFO_BASETYPES (binfo);
- tree accesses = BINFO_BASEACCESSES (binfo);
+ tree bases = BINFO_BASE_BINFOS (binfo);
+ tree accesses = BINFO_BASE_ACCESSES (binfo);
int n_bases = TREE_VEC_LENGTH (bases);
int i;
+2004-07-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ * java-tree.h (CLASSTYPE_SPUER): Adjust BINFO macros.
+ (TYPE_NVIRTUALS, TYPE_VTABLE): Likewise.
+ * java/class.c (set_super_info, class_depth, interface_of_p,
+ maybe_add_interface, add_interface, make_class_data,
+ layout_class, add_miranda_methods): Adjust BINFO macros.
+ * expr.c (can_widen_reference_to, lookup_field): Likewise.
+ * jcf-write.c (generate_classfile): Likewise.
+ * parse.y (patch_anonymous_class,
+ check_inner_circular_reference, check_circular_reference,
+ java_complete_class, check_abstract_method_definitions,
+ java_check_abstract_method_definitions,
+ check_interface_throws_clauses, java_check_abstract_methods,
+ lookup_java_interface_method2,
+ find_applicable_accessible_methods_list): Likewise.
+ * typeck.c (find_method_in_interface): Likewise.
+ * verify.c (merge_types): Likewise.
+
2004-07-06 Nathan Sidwell <nathan@codesourcery.com>
* java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1.
total_supers++;
TYPE_VFIELD (this_class) = TYPE_VFIELD (object_type_node);
- TYPE_BINFO_BASETYPES (this_class) = make_tree_vec (total_supers);
+ BINFO_BASE_BINFOS (TYPE_BINFO (this_class)) = make_tree_vec (total_supers);
if (super_class)
{
tree super_binfo = make_tree_binfo (0);
BINFO_TYPE (super_binfo) = super_class;
BINFO_OFFSET (super_binfo) = integer_zero_node;
- TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (this_class)), 0)
+ TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (this_class)), 0)
= super_binfo;
CLASS_HAS_SUPER (this_class) = 1;
}
while (clas != object_type_node)
{
depth++;
- clas = TYPE_BINFO_BASETYPE (clas, 0);
+ clas = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (clas), 0));
}
return depth;
}
int n, i;
tree basetype_vec;
- if (!(basetype_vec = TYPE_BINFO_BASETYPES (type2)))
+ if (!(basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type2))))
return 0;
n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; i < n; i++)
tree
maybe_add_interface (tree this_class, tree interface_class)
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (this_class);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (this_class));
int i;
int n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; ; i++)
void
add_interface (tree this_class, tree interface_class)
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (this_class);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (this_class));
int i;
int n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; ; i++)
/* Build and emit the array of implemented interfaces. */
if (type != object_type_node)
- interface_len = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)) - 1;
+ interface_len = BINFO_N_BASE_BINFOS (TYPE_BINFO (type)) - 1;
+
if (interface_len > 0)
{
tree init = NULL_TREE;
interface_array_type);
for (i = interface_len; i > 0; i--)
{
- tree child = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i);
+ tree child = TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (type)), i);
tree iclass = BINFO_TYPE (child);
tree index;
if (! flag_indirect_dispatch
of this itself. */
if (!CLASS_FROM_SOURCE_P (this_class))
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (this_class);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (this_class));
if (basetype_vec)
{
static void
add_miranda_methods (tree base_class, tree search_class)
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (search_class);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (search_class));
int i, n = TREE_VEC_LENGTH (basetype_vec);
for (i = 1; i < n; ++i)
{
/* target_type is OK if source_type or source_type ancestors
implement target_type. We handle multiple sub-interfaces */
- tree basetype_vec = TYPE_BINFO_BASETYPES (source_type);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (source_type));
int n = TREE_VEC_LENGTH (basetype_vec), i;
for (i=0 ; i < n; i++)
if (can_widen_reference_to
for ( ; source_depth > target_depth; source_depth--)
{
- source_type = TYPE_BINFO_BASETYPE (source_type, 0);
+ source_type
+ = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (source_type), 0));
}
return source_type == target_type;
}
return field;
/* Process implemented interfaces. */
- basetype_vec = TYPE_BINFO_BASETYPES (*typep);
+ basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (*typep));
n = TREE_VEC_LENGTH (basetype_vec);
save_field = NULL_TREE;
for (i = 0; i < n; i++)
#define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
-#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) ? \
- BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (TYPE), 0)) : NULL_TREE)
+#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) \
+ ? BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (TYPE), 0)) \
+ : NULL_TREE)
/* True if the class we are compiling is a .java source file;
false if it is a .class bytecode file. */
/* The number of virtual methods in this class's dispatch table.
Does not include initial two dummy entries (one points to the
Class object, and the other is for G++ -fvtable-thunks compatibility). */
-#define TYPE_NVIRTUALS(TYPE) TYPE_BINFO_VIRTUALS (TYPE)
+#define TYPE_NVIRTUALS(TYPE) BINFO_VIRTUALS (TYPE_BINFO (TYPE))
/* A TREE_VEC (indexed by DECL_VINDEX) containing this class's
virtual methods. */
-#define TYPE_VTABLE(TYPE) TYPE_BINFO_VTABLE(TYPE)
+#define TYPE_VTABLE(TYPE) BINFO_VTABLE(TYPE_BINFO (TYPE))
/* Use CLASS_LOADED_P? FIXME */
#define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL)
int methods_count = 0;
tree part;
int total_supers
- = clas == object_type_node ? 0
- : TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (clas));
+ = clas == object_type_node ? 0 : BINFO_N_BASE_BINFOS (TYPE_BINFO (clas));
ptr = append_chunk (NULL, 8, state);
PUT4 (0xCafeBabe); /* Magic number */
}
else
{
- tree basetypes = TYPE_BINFO_BASETYPES (clas);
+ tree basetypes = BINFO_BASE_BINFOS (TYPE_BINFO (clas));
tree base = BINFO_TYPE (TREE_VEC_ELT (basetypes, 0));
int j = find_class_constant (&state->cpool, base);
PUT2 (j); /* super_class */
if (parser_check_super_interface (type_decl, class_decl, wfl))
return;
- s_binfo = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (class)), 0);
- length = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (class))+1;
- TYPE_BINFO_BASETYPES (class) = make_tree_vec (length);
- TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (class)), 0) = s_binfo;
+ s_binfo = TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (class)), 0);
+ length = TREE_VEC_LENGTH (BINFO_BASE_BINFOS (TYPE_BINFO (class)))+1;
+ BINFO_BASE_BINFOS (TYPE_BINFO (class)) = make_tree_vec (length);
+ TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (class)), 0) = s_binfo;
/* And add the interface */
parser_add_interface (class_decl, type_decl, wfl);
}
{
if (parser_check_super (type_decl, class_decl, wfl))
return;
- BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (binfo), 0)) = type;
+ BINFO_TYPE (TREE_VEC_ELT (BINFO_BASE_BINFOS (binfo), 0)) = type;
}
}
static tree
check_inner_circular_reference (tree source, tree target)
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (source);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (source));
tree ctx, cl;
int i;
static tree
check_circular_reference (tree type)
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (type);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type));
int i;
if (!basetype_vec)
/* Simply patch super */
if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
continue;
- BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
+ BINFO_TYPE (TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO
(TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
break;
{
/* Check for implemented interfaces. */
int i;
- tree vector = TYPE_BINFO_BASETYPES (type);
+ tree vector = BINFO_BASE_BINFOS (TYPE_BINFO (type));
for (i = 1; ok && vector && i < TREE_VEC_LENGTH (vector); i++)
{
tree super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
} while (super != object_type_node);
/* Check for implemented interfaces. */
- vector = TYPE_BINFO_BASETYPES (class);
+ vector = BINFO_BASE_BINFOS (TYPE_BINFO (class));
for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
{
super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
load_class (class_decl, 1);
}
- bases = TYPE_BINFO_BASETYPES (class_decl);
+ bases = BINFO_BASE_BINFOS (TYPE_BINFO (class_decl));
iface_len = TREE_VEC_LENGTH (bases) - 1;
for (i = iface_len; i > 0; --i)
{
}
/* 4- Inherited methods can't differ by their returned types */
- if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
+ if (!(basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (interface))))
return;
n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; i < n; i++)
lookup_java_interface_method2 (tree class, tree method_decl)
{
int i, n;
- tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (class));
+ tree to_return;
if (!basetype_vec)
return NULL_TREE;
&& CLASS_INTERFACE (TYPE_NAME (class)))
{
int i, n;
- tree basetype_vec = TYPE_BINFO_BASETYPES (class);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (class));
search_applicable_methods_list (lc, TYPE_METHODS (class),
name, arglist, &list, &all_list);
n = TREE_VEC_LENGTH (basetype_vec);
/* We must search all interfaces of this class */
if (!lc)
{
- tree basetype_vec = TYPE_BINFO_BASETYPES (class);
+ tree basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (class));
int n = TREE_VEC_LENGTH (basetype_vec), i;
for (i = 1; i < n; i++)
{
{
int i;
int interface_len =
- TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (searched_class)) - 1;
+ TREE_VEC_LENGTH (BINFO_BASE_BINFOS (TYPE_BINFO (searched_class))) - 1;
for (i = interface_len; i > 0; i--)
{
- tree child =
- TREE_VEC_ELT (TYPE_BINFO_BASETYPES (searched_class), i);
+ tree child = BINFO_BASE_BINFO (TYPE_BINFO (searched_class), i);
tree iclass = BINFO_TYPE (child);
tree method;
depth1 = class_depth (type1);
depth2 = class_depth (type2);
for ( ; depth1 > depth2; depth1--)
- type1 = TYPE_BINFO_BASETYPE (type1, 0);
+ type1 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type1), 0));
for ( ; depth2 > depth1; depth2--)
- type2 = TYPE_BINFO_BASETYPE (type2, 0);
+ type2 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type2), 0));
while (type1 != type2)
{
- type1 = TYPE_BINFO_BASETYPE (type1, 0);
- type2 = TYPE_BINFO_BASETYPE (type2, 0);
+ type1 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type1), 0));
+ type2 = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (type2), 0));
}
return promote_type (type1);
}
case. */
if (TREE_CODE (type) != ENUMERAL_TYPE)
{
- if (TYPE_BINFO (type)
- && TYPE_BINFO_BASETYPES (type))
- n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type));
+ if (TYPE_BINFO (type) && BINFO_BASE_BINFOS (TYPE_BINFO (type)))
+ n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (type));
+
for (i = 0; i < n_baseclasses; i++)
{
- tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)),
- i);
+ tree child = BINFO_BASE_BINFO (TYPE_BINFO (type), i);
tree child_type = BINFO_TYPE (child);
tree child_type_name;
if (TYPE_NAME (child_type) == 0)
if (dni->binfo_p)
{
unsigned ix;
- tree bases = BINFO_BASETYPES (t);
+ tree bases = BINFO_BASE_BINFOS (t);
unsigned n_bases = bases ? TREE_VEC_LENGTH (bases): 0;
- tree accesses = BINFO_BASEACCESSES (t);
+ tree accesses = BINFO_BASE_ACCESSES (t);
dump_child ("type", BINFO_TYPE (t));
TREE_STATIC in
VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, ADDR_EXPR
- TREE_VIA_VIRTUAL in
+ BINFO_VIRTUAL_P in
TREE_BINFO
TREE_CONSTANT_OVERFLOW in
INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST
This is always 0 except when there is multiple inheritance. */
#define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK(NODE)->binfo.offset)
-#define TYPE_BINFO_OFFSET(NODE) BINFO_OFFSET (TYPE_BINFO (NODE))
#define BINFO_OFFSET_ZEROP(NODE) (integer_zerop (BINFO_OFFSET (NODE)))
/* The virtual function table belonging to this basetype. Virtual
The entries of a virtual function table are language-dependent. */
#define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vtable)
-#define TYPE_BINFO_VTABLE(NODE) BINFO_VTABLE (TYPE_BINFO (NODE))
/* The virtual functions in the virtual function table. This is
a TREE_LIST that is used as an initial approximation for building
a virtual function table for this basetype. */
#define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK(NODE)->binfo.virtuals)
-#define TYPE_BINFO_VIRTUALS(NODE) BINFO_VIRTUALS (TYPE_BINFO (NODE))
/* A vector of binfos for the direct basetypes inherited by this
basetype.
base types at the end of this TREE_VEC (instead of using
another TREE_VEC). This would simplify the calculation
of how many basetypes a given type had. */
-#define BINFO_BASETYPES(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_types)
-#define TYPE_BINFO_BASETYPES(NODE) BINFO_BASETYPES (TYPE_BINFO (NODE))
+#define BINFO_BASE_BINFOS(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_binfos)
/* The number of basetypes for NODE. */
-#define BINFO_N_BASETYPES(NODE) \
- (BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (BINFO_BASETYPES (NODE)) : 0)
+#define BINFO_N_BASE_BINFOS(NODE) \
+ (BINFO_BASE_BINFOS (NODE) ? TREE_VEC_LENGTH (BINFO_BASE_BINFOS (NODE)) : 0)
-/* Accessor macro to get to the Nth basetype of this basetype. */
-#define BINFO_BASETYPE(NODE,N) TREE_VEC_ELT (BINFO_BASETYPES (NODE), (N))
-#define TYPE_BINFO_BASETYPE(NODE,N) \
- BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (NODE)), (N)))
+/* Accessor macro to get to the Nth base binfo of this binfo. */
+#define BINFO_BASE_BINFO(NODE,N) TREE_VEC_ELT (BINFO_BASE_BINFOS (NODE), (N))
/* For a BINFO record describing a virtual base class, i.e., one where
TREE_VIA_VIRTUAL is set, this field assists in locating the virtual
/* Indicates the accesses this binfo has to its bases. The values are
access_public_node, access_protected_node or access_private_node.
If this array is not present, public access is implied. */
-#define BINFO_BASEACCESSES(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_accesses)
-#define BINFO_BASEACCESS(NODE,N) TREE_VEC_ELT (BINFO_BASEACCESSES(NODE), (N))
+#define BINFO_BASE_ACCESSES(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_accesses)
+#define BINFO_BASE_ACCESS(NODE,N) TREE_VEC_ELT (BINFO_BASE_ACCESSES(NODE), (N))
/* Number of language independent elements in a binfo. Languages may
add additional trailing elements. */
#define BINFO_LANG_SLOT(NODE,N) (TREE_BINFO_CHECK(NODE)->binfo.lang_slots[N])
-/* Slot used to build a chain that represents a use of inheritance.
- For example, if X is derived from Y, and Y is derived from Z,
- then this field can be used to link the binfo node for X to
- the binfo node for X's Y to represent the use of inheritance
- from X to Y. Similarly, this slot of the binfo node for X's Y
- can point to the Z from which Y is inherited (in X's inheritance
- hierarchy). In this fashion, one can represent and traverse specific
- uses of inheritance using the binfo nodes themselves (instead of
- consing new space pointing to binfo nodes).
- It is up to the language-dependent front-ends to maintain
- this information as necessary. */
+/* The BINFO_INHERITANCE_CHAIN points at the binfo for the base
+ inheriting this base for non-virtual bases. For virtual bases it
+ points to the binfo of the most derived type. */
#define BINFO_INHERITANCE_CHAIN(NODE) \
(TREE_BINFO_CHECK(NODE)->binfo.inheritance)
tree offset;
tree vtable;
tree virtuals;
- tree base_types;
+ tree base_binfos;
tree vptr_field;
tree base_accesses;
tree inheritance;