From 604a320594b012c8d2cda2fc5d2bbd3230d034b1 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 7 Jul 2004 10:21:04 +0000 Subject: [PATCH] tree.h (TYPE_BINFO_OFFSET, [...]): Remove. * 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. * cp/cp-tree.h (CLASSTYPE_N_BASECLASSES): Remove. * cp/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. * cp/decl.c (xref_basetypes): Likewise. * cp/dump.c (cp_dump_tree): Likewise. * cp/error.c (dump_expr): Likewise. * cp/init.c (sort_mem_initializers, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor, do_build_assign_reg, synthesize_exception_spec): Likewise. * cp/name-lookup.c (arg_assoc_class): * cp/pt.c (instantiate_class_template, tsubst, get_template_base_recursive): * cp/ptree.c (cxx_print_type): * cp/rtti.c (get_psuedo_ti_init, get_pseudo_ti_desc): Likewise. * cp/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 * cp/tree.c (copy_base_binfos, make_binfo): Likewise. * cp/typeck.c (commmon_base_type): Likewise * cp/typeck2.c (process_init_constructor): Likewise * java/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. * java/expr.c (can_widen_reference_to, lookup_field): Likewise. * java/jcf-write.c (generate_classfile): Likewise. * java/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. * java/typeck.c (find_method_in_interface): Likewise. * java/verify.c (merge_types): Likewise. From-SVN: r84198 --- gcc/ChangeLog | 21 ++++++++ gcc/alias.c | 6 +-- gcc/config/i386/i386.c | 19 ++++--- gcc/cp/ChangeLog | 36 ++++++++++++++ gcc/cp/class.c | 110 +++++++++++++++++++++-------------------- gcc/cp/cp-tree.h | 4 -- gcc/cp/decl.c | 8 +-- gcc/cp/dump.c | 4 +- gcc/cp/error.c | 2 +- gcc/cp/init.c | 22 +++++---- gcc/cp/method.c | 14 +++--- gcc/cp/name-lookup.c | 5 +- gcc/cp/pt.c | 19 +++---- gcc/cp/ptree.c | 2 +- gcc/cp/rtti.c | 14 +++--- gcc/cp/search.c | 54 ++++++++++---------- gcc/cp/tree.c | 8 +-- gcc/cp/typeck.c | 10 ++-- gcc/cp/typeck2.c | 2 +- gcc/dbxout.c | 11 ++--- gcc/dwarf2out.c | 6 +-- gcc/java/ChangeLog | 19 +++++++ gcc/java/class.c | 21 ++++---- gcc/java/expr.c | 7 +-- gcc/java/java-tree.h | 9 ++-- gcc/java/jcf-write.c | 5 +- gcc/java/parse.y | 31 ++++++------ gcc/java/typeck.c | 5 +- gcc/java/verify.c | 8 +-- gcc/sdbout.c | 9 ++-- gcc/tree-dump.c | 4 +- gcc/tree.h | 38 +++++--------- 32 files changed, 300 insertions(+), 233 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 907ff321a252..48e5f0ddbba7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2004-07-07 Nathan Sidwell + + * 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 * config/fr30/fr30.c (fr30_setup_incoming_varargs): Change diff --git a/gcc/alias.c b/gcc/alias.c index 9e53d9bb07f4..9b920b9f34fb 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -718,12 +718,12 @@ record_component_aliases (tree type) 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))); } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1ce078d90a6f..288ce7b7b29a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2063,10 +2063,10 @@ classify_argument (enum machine_mode mode, tree type, 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) @@ -2151,10 +2151,10 @@ classify_argument (enum machine_mode mode, tree type, || 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) @@ -2759,11 +2759,10 @@ contains_128bit_aligned_vector_p (tree type) { 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) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bde9ccf81e5a..488d0377a009 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,39 @@ +2004-07-07 Nathan Sidwell + + * 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 * decl.c (check_tag_decl): Name redeclared type in diagnostic. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index f3ebb83ddb4b..4cfa5875a907 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -693,8 +693,8 @@ build_primary_vtable (tree binfo, tree type) /* 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; } @@ -1194,8 +1194,8 @@ check_bases (tree t, 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. */ @@ -1334,8 +1334,8 @@ set_primary_base (tree t, tree binfo) 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); } @@ -1344,7 +1344,7 @@ set_primary_base (tree t, tree binfo) 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; @@ -1356,7 +1356,7 @@ determine_primary_base (tree t) 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)) @@ -1406,7 +1406,7 @@ determine_primary_base (tree t) { 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++) @@ -1483,7 +1483,7 @@ determine_primary_base (tree t) 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); @@ -1525,7 +1525,7 @@ finish_struct_bits (tree 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--) @@ -1626,8 +1626,8 @@ maybe_warn_about_overly_private_class (tree t) 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; @@ -2005,7 +2005,7 @@ dfs_find_final_overrider (tree binfo, void* data) 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)) @@ -2393,7 +2393,7 @@ get_basefndecls (tree name, tree t) { 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. */ @@ -2415,7 +2415,7 @@ get_basefndecls (tree name, tree t) 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); } @@ -2480,9 +2480,9 @@ warn_hidden (tree t) 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); } @@ -3266,11 +3266,11 @@ walk_subobject_offsets (tree type, /* 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)) @@ -3291,7 +3291,7 @@ walk_subobject_offsets (tree type, /* 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)); @@ -3735,7 +3735,7 @@ build_base_fields (record_layout_info rli, /* 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. */ @@ -3748,7 +3748,7 @@ build_base_fields (record_layout_info rli, { 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. */ @@ -4281,7 +4281,7 @@ create_vtable_ptr (tree t, tree* virtuals_p) /* 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 @@ -4364,7 +4364,7 @@ propagate_binfo_offsets (tree binfo, tree offset) /* 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; @@ -4380,7 +4380,7 @@ propagate_binfo_offsets (tree binfo, tree offset) } 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; @@ -4407,7 +4407,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets) 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)) @@ -4502,9 +4502,9 @@ end_of_class (tree t, int include_virtuals_p) 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) @@ -4547,9 +4547,9 @@ warn_about_ambiguous_bases (tree t) 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", @@ -5092,15 +5092,16 @@ finish_struct_1 (tree t) 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)); @@ -6255,10 +6256,10 @@ get_vfield_name (tree type) 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); @@ -6341,8 +6342,9 @@ contains_empty_class_p (tree type) 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 @@ -6583,7 +6585,7 @@ dump_class_hierarchy_r (FILE *stream, fprintf (stream, "\n"); } - base_binfos = BINFO_BASETYPES (binfo); + base_binfos = BINFO_BASE_BINFOS (binfo); if (base_binfos) { int ix, n; @@ -6770,7 +6772,7 @@ finish_vtbls (tree t) /* 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); @@ -6782,7 +6784,7 @@ finish_vtbls (tree t) 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)); } @@ -6925,11 +6927,11 @@ build_vtt_inits (tree binfo, tree t, tree* inits, tree* index) *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); } @@ -7059,7 +7061,7 @@ static tree 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; @@ -7191,15 +7193,15 @@ accumulate_vtbl_inits (tree binfo, 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); } @@ -7683,11 +7685,11 @@ add_vcall_offset_vtbl_entries_r (tree binfo, vtbl_init_data* vid) 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); } @@ -7908,7 +7910,7 @@ cp_fold_obj_type_ref (tree ref, tree known_type) { 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) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e1e89c882b47..87e610eaa19c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1258,10 +1258,6 @@ struct lang_type GTY(()) 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. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5f3b901a0086..d8feecdbc132 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9082,8 +9082,8 @@ xref_basetypes (tree ref, tree base_list) 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)) { @@ -9178,7 +9178,7 @@ xref_basetypes (tree ref, tree 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); @@ -9206,7 +9206,7 @@ xref_basetypes (tree ref, tree base_list) /* 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)) diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index f5cc1dde4ce6..64a462eb1a77 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -268,9 +268,9 @@ cp_dump_tree (void* dump_info, tree t) { 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"); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index e345793f3c74..6d5796304002 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1633,7 +1633,7 @@ dump_expr (tree t, int flags) 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); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 19e51cdaaa29..e899b01f1f47 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -475,9 +475,9 @@ sort_mem_initializers (tree t, tree mem_inits) 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); } @@ -941,14 +941,15 @@ expand_member_init (tree name) { /* 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", @@ -981,11 +982,12 @@ expand_member_init (tree name) 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 @@ -2910,8 +2912,8 @@ push_base_cleanups (void) } } - 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++) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 436359b558c8..6acf765cbc5f 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -515,8 +515,8 @@ do_build_copy_constructor (tree fndecl) 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; @@ -623,12 +623,14 @@ do_build_assign_ref (tree fndecl) 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); @@ -789,8 +791,8 @@ synthesize_exception_spec (tree type, tree (*extractor) (tree, void*), { 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++) { diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ef1668938d58..7c44c8970d89 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -4313,8 +4313,9 @@ arg_assoc_class (struct arg_lookup *k, tree type) 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. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0a43edead936..20f7a0179f6f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5419,11 +5419,11 @@ instantiate_class_template (tree type) 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; @@ -6888,7 +6888,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) 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); @@ -6899,10 +6899,11 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) 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; @@ -9402,7 +9403,7 @@ get_template_base_recursive (tree tparms, rval = r; } - binfos = BINFO_BASETYPES (arg_binfo); + binfos = BINFO_BASE_BINFOS (arg_binfo); n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; /* Process base types. */ diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index 1d6861c3664e..c9eccf2239b4 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -128,7 +128,7 @@ cxx_print_type (FILE *file, tree node, int indent) 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"); diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 559d594e48f0..c23b186e1780 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1033,7 +1033,7 @@ get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p) } 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); @@ -1044,9 +1044,9 @@ get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p) { 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; @@ -1188,13 +1188,13 @@ get_pseudo_ti_desc (tree type) 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); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index a3ab7c8173a5..0c9188dfa225 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -185,8 +185,8 @@ lookup_base_r (tree binfo, tree base, base_access access, 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; @@ -363,8 +363,8 @@ dynamic_cast_base_recurse (tree subtype, tree binfo, bool is_via_virtual, } } - 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++) { @@ -682,8 +682,8 @@ dfs_access_in_type (tree binfo, void *data) /* 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) { @@ -759,14 +759,14 @@ access_in_type (tree type, tree decl) 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; @@ -1021,7 +1021,7 @@ struct lookup_field_info { 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. */ @@ -1595,7 +1595,7 @@ bfs_walk (tree binfo, 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; @@ -1603,7 +1603,7 @@ bfs_walk (tree 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) { @@ -1657,9 +1657,9 @@ dfs_walk_real (tree 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; @@ -1667,7 +1667,7 @@ dfs_walk_real (tree 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) { @@ -1806,7 +1806,7 @@ int 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; @@ -1959,7 +1959,7 @@ get_pure_virtuals (tree type) 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; } @@ -1967,7 +1967,7 @@ markedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED) 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; } @@ -1975,7 +1975,7 @@ unmarkedp (tree derived, int ix, void *data ATTRIBUTE_UNUSED) 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; @@ -1984,7 +1984,7 @@ marked_pushdecls_p (tree derived, int ix, void *data ATTRIBUTE_UNUSED) 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; @@ -2067,7 +2067,7 @@ dfs_debug_mark (tree binfo, void *data ATTRIBUTE_UNUSED) 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); @@ -2415,14 +2415,14 @@ dfs_check_overlap (tree empty_binfo, void *data) 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; } @@ -2434,7 +2434,7 @@ dfs_check_overlap (tree empty_binfo, void *data) 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; @@ -2466,8 +2466,8 @@ 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++) @@ -2540,7 +2540,7 @@ copied_binfo (tree binfo, tree here) 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++) { @@ -2601,7 +2601,7 @@ original_binfo (tree binfo, tree here) { 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++) { diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 0863e29191dd..35679eb5215f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -584,7 +584,7 @@ canonical_type_variant (tree t) 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) @@ -792,11 +792,11 @@ make_binfo (tree offset, tree binfo, tree vtable, tree virtuals) 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; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 4f473508c389..1588cbceebe2 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1143,10 +1143,11 @@ common_base_type (tree tt1, tree tt2) /* 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) @@ -1159,10 +1160,11 @@ common_base_type (tree tt1, tree tt2) } /* 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) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 2e08d563079b..5ddfdd5bcee7 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -804,7 +804,7 @@ process_init_constructor (tree type, tree init, tree* elts) 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; diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 77e1b35d8d94..aa863bda031d 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -1635,9 +1635,8 @@ dbxout_type (tree type, int full) { 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. */ @@ -1696,9 +1695,9 @@ dbxout_type (tree type, int full) 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) { diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e1c8b75ea843..48994856bcc2 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -11891,10 +11891,10 @@ gen_member_die (tree type, dw_die_ref context_die) 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; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index bfe435d1aa14..46251af7cfd1 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,22 @@ +2004-07-07 Nathan Sidwell + + * 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 * java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. diff --git a/gcc/java/class.c b/gcc/java/class.c index be4b3fdc9203..48f6b8609cab 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -477,13 +477,13 @@ set_super_info (int access_flags, tree this_class, 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; } @@ -519,7 +519,7 @@ class_depth (tree clas) while (clas != object_type_node) { depth++; - clas = TYPE_BINFO_BASETYPE (clas, 0); + clas = BINFO_TYPE (BINFO_BASE_BINFO (TYPE_BINFO (clas), 0)); } return depth; } @@ -532,7 +532,7 @@ interface_of_p (tree type1, tree type2) 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++) @@ -627,7 +627,7 @@ add_interface_do (tree basetype_vec, tree interface_class, int 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++) @@ -651,7 +651,7 @@ maybe_add_interface (tree this_class, tree interface_class) 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++) @@ -1627,7 +1627,8 @@ make_class_data (tree type) /* 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; @@ -1639,7 +1640,7 @@ make_class_data (tree type) 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 @@ -2032,7 +2033,7 @@ layout_class (tree this_class) 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) { @@ -2068,7 +2069,7 @@ layout_class (tree this_class) 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) { diff --git a/gcc/java/expr.c b/gcc/java/expr.c index c998a68cbd02..f2df129bdda9 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -427,7 +427,7 @@ can_widen_reference_to (tree source_type, tree target_type) /* 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 @@ -440,7 +440,8 @@ can_widen_reference_to (tree source_type, tree target_type) 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; } @@ -1466,7 +1467,7 @@ lookup_field (tree *typep, tree name) 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++) diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 04a8f1f3e0f3..a07f5752f65c 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -125,8 +125,9 @@ struct JCF; #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. */ @@ -1433,11 +1434,11 @@ extern int in_same_package (tree, tree); /* 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) diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 09b39da91a3b..c95df1eb561b 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -2921,8 +2921,7 @@ generate_classfile (tree clas, struct jcf_partial *state) 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 */ @@ -2948,7 +2947,7 @@ generate_classfile (tree clas, struct jcf_partial *state) } 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 */ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index adac725cd175..3df330d3c253 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -3889,10 +3889,10 @@ patch_anonymous_class (tree type_decl, tree class_decl, tree wfl) 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); } @@ -3901,7 +3901,7 @@ patch_anonymous_class (tree type_decl, tree class_decl, tree 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; } } @@ -5214,7 +5214,7 @@ register_incomplete_type (int kind, tree wfl, tree decl, tree ptr) 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; @@ -5260,7 +5260,7 @@ check_inner_circular_reference (tree source, tree target) 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) @@ -5569,7 +5569,7 @@ java_complete_class (void) /* 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; @@ -6198,7 +6198,7 @@ check_abstract_method_definitions (int do_interface, tree class_decl, { /* 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)); @@ -6230,7 +6230,7 @@ java_check_abstract_method_definitions (tree class_decl) } 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)); @@ -6505,7 +6505,7 @@ check_interface_throws_clauses (tree check_class_decl, tree class_decl) 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) { @@ -6637,7 +6637,7 @@ java_check_abstract_methods (tree interface_decl) } /* 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++) @@ -6677,7 +6677,8 @@ static tree 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; @@ -11023,7 +11024,7 @@ find_applicable_accessible_methods_list (int lc, tree class, tree name, && 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); @@ -11056,7 +11057,7 @@ find_applicable_accessible_methods_list (int lc, tree class, tree name, /* 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++) { diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index cf916674ccc2..8cfe5e4d3bee 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -797,12 +797,11 @@ find_method_in_interfaces (tree searched_class, int flags, tree method_name, { 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; diff --git a/gcc/java/verify.c b/gcc/java/verify.c index 06f834db29c2..848246940326 100644 --- a/gcc/java/verify.c +++ b/gcc/java/verify.c @@ -226,13 +226,13 @@ merge_types (tree type1, tree type2) 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); } diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 2e40f8ad3839..0398a5ad32bb 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -1151,13 +1151,12 @@ sdbout_one_type (tree type) 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) diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 8ee8f4b5031f..659531f0300d 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -251,9 +251,9 @@ dequeue_and_dump (dump_info_p di) 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)); diff --git a/gcc/tree.h b/gcc/tree.h index 51fc2ad66e55..ab22cda92b1b 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -202,7 +202,7 @@ struct tree_common GTY(()) 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 @@ -1616,7 +1616,6 @@ struct tree_type GTY(()) 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 @@ -1624,13 +1623,11 @@ struct tree_type GTY(()) 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. @@ -1643,17 +1640,14 @@ struct tree_type GTY(()) 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 @@ -1665,25 +1659,17 @@ struct tree_type GTY(()) /* 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) @@ -1694,7 +1680,7 @@ struct tree_binfo GTY (()) tree offset; tree vtable; tree virtuals; - tree base_types; + tree base_binfos; tree vptr_field; tree base_accesses; tree inheritance; -- 2.43.5