Change base class access representation.

* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
	TREE_VIA_PRIVATE): Remove.
	(BINFO_BASEACCESSES): New binfo elt.
	(BINFO_BASEACCESS): New accessor.
	(BINFO_ELTS): Increase.
	(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
	(access_public_node, access_protected_node,
	access_private_node): New global nodes.
	* tree.c (build_common_tree_nodes_2): Initialize access nodes.
	* dbxout.c (dbxout_type): Adjust.
	* dwarf2out.c (gen_inheritance_die): Add access parameter.
	(gen_member_die): Adjust.
	* dwarfout.c (output_inheritance_die): ARG is array of two trees.
	(output_type): Adjust.
	* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.

	Change base class access representation. Share virtual base
	binfos.
	* cp/call.c (build_special_member_call): Remove binfo_for_vbase
	call.
	* cp/class.c (build_base_path): Likewise.
	(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
	(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
	(make_new_vtable): Adjust.
	(force_canonical_binfo_r): Delete.
	(force_canonical_binfo): Delete.
	(mark_primary_virtual_base): Delete.
	(dfs_unshared_virtual_bases): Delete.
	(mark_primary_bases): Adjust.
	(maybe_warn_about_overly_private_class): Adjust.
	(dfs_base_derived_from): Delete.
	(base_derived_from): Follow the inheritance chain.
	(struct find_final_overrider_data): Add vpath member.
	(dfs_find_final_overrider): Adjust.
	(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
	(find_final_overrider): Adjust.
	(update_vtable_entry_for_fn): Adjust.
	(modify_all_vtables): Adjust.
	(walk_subobject_offsets): Adjust.
	(layout_nonempty_base_or_field): Adjust.
	(layout_empty_base): Remove last parameter. Adjust.
	(build_base_field): Adjust.
	(build_base_fields): Adjust.
	(propagate_binfo_offsets): Remove last parameter. Adjust.
	(dfs_set_offset_for_unshared_vbases): Delete.
	(layout_virtual_bases): Adjust.
	(finish_struct_1): Adjust.
	(init_class_processing): Don't init access nodes.
	(dfs_get_primary_binfo): Delete.
	(get_primary_binfo): Adjust.
	(dump_class_hierarchy_r): Remove most derived arg, add IGO
	parameter. Adjust.
	(dump_class_hierarchy): Adjust.
	(finish_vtbls): Adjust.
	(get_original_base): Delete.
	(build_vtt_inits): Adjust.
	(dfs_build_secondary_vptr_vtt_inits): Adjust.
	(dfs_ctor_vtable_bases_queue_p): Adjust.
	(build_ctor_vtbl_group): Adjust.
	(dfs_accumulate_vtbl_inits): Adjust.
	(build_vtbl_initializer): Adjust.
	(build_vbase_offset_vtbl_entries): Adjust.
	(add_vcall_offset_vtbl_entries_1): Adjust.
	* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
	(access_*_node): Remove.
	(CANONICAL_BINFO): Delete.
	(BINFO_UNSHARED_MARKED): Remove.
	(BINFO_MARKED): Set LANG_FLAG_0 directly.
	(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
	(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
	(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
	Delete.
	(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
	(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
	(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
	Delete.
	(BINFO_DEPENDENT_BASE_P): New.
	(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
	index.
	(markedp, unmarkedp): Adjust.
	(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
	dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
	find_vbase_instance, binfo_for_vbase): Delete.
	(copied_binfo, original_binfo): Declare.
	(finish_base_specifier): Add virtual_p arg.
	(unshare_base_binfos): Delete.
	(copy_base_binfos): Declare.
	(reverse_path): Delete.
	* cp/decl.c (xref_basetypes): Access and virtuality passed
	differently. Don't copy direct base binfos here. Call
	copy_base_binfos.
	* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
	(initialize_vtbl_ptrs): Adjust.
	(expand_member_init): Adjust.
	* cp/parser.c (cp_parser_base_specifier): Adjust.
	* cp/pt.c (instantiate_class_template): Adjust.
	(get_template_base_recursive): Adjust.
	* cp/rtti.c (get_pseudo_ti_init): Adjust.
	(get_pseudo_ti_desc): Adjust.
	* cp/tree.c (unshare_base_binfos): Rename to ...
	(copy_base_binfos): ... here, reimplement.
	(make_binfo): Set BINFO_DEPENDENT_BASE_P.
	(reverse_path): Remove.
	* cp/typeck.c (get_delta_difference): Adjust error messages.
	* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
	* cp/search.c (lookup_base_r): Adjust.
	(dynamic_cast_base_recurse): Adjust.
	(canonical_binfo): Remove.
	(dfs_canonical_queue): Remove.
	(dfs_assert_unmarked_p): Remove.
	(assert_canonical_unmarked): Remove.
	(shared_marked_p, shared_unmarked_p): Remove.
	(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
	(dfs_access_in_type): Adjust.
	(access_in_type): Adjust.
	(dfs_accessible_queue_p): Adjust.
	(dfs_accessible_p): Adjust.
	(is_subobject_of_p_1, is_subobject_of_p): Remove.
	(struct lookup_field_info): Remove from_dep_base_p field.
	(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
	(lookup_field_r): Remove dependent base code.
	(lookup_member): Likewise.
	(dfs_walk, dfs_walk_real): Add access arg to queue fn.
	(dfs_unmarked_real_bases_queue_p): Remove.
	(dfs_marked_real_bases_queue_p): Remove.
	(dfs_skip_vbases): Remove.
	(dfs_get_pure_virtuals): Adjust.
	(markedp, unmarkedp): Adjust.
	(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
	(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
	(dfs_unmark): Adjust.
	(dfs_get_vbase_types):Remove.
	(dfs_build_inheritance_graph_order): Remove.
	(get_vbase_types): Remove
	(dfs_find_vbase_instance): Remove.
	(find_vbase_instance): Remove.
	(dfs_debug_unmarkedp): Adjust.
	(dependent_base_p): Remove.
	(dfs_push_type_decls): Adjust.
	(dfs_push_decls): Adjust.
	(dfs_no_overlap_yet): Adjust.
	(copied_binfo): New function.
	(original_binfo): New function.
	(binfo_for_vbase): Remove.

	Change base class access representation.
	* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
	(add_interface_do): Likewise.

From-SVN: r63172
This commit is contained in:
Nathan Sidwell 2003-02-20 17:51:46 +00:00 committed by Nathan Sidwell
parent 4c24ac2716
commit dbbf88d1b8
21 changed files with 1166 additions and 1506 deletions

View file

@ -1,3 +1,155 @@
2003-02-20 Nathan Sidwell <nathan@codesourcery.com>
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
2003-02-20 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/sysv4.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Define.

View file

@ -1,3 +1,134 @@
2003-02-20 Nathan Sidwell <nathan@codesourcery.com>
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
2003-02-18 Zack Weinberg <zack@codesourcery.com>
* cp/search.c (grow_bfs_bases): New subroutine of bfs_walk.

View file

@ -4653,8 +4653,6 @@ build_special_member_call (tree instance, tree name, tree args,
current_in_charge_parm, integer_zero_node),
current_vtt_parm,
vtt);
if (TREE_VIA_VIRTUAL (binfo))
binfo = binfo_for_vbase (class_type, current_class_type);
my_friendly_assert (BINFO_SUBVTT_INDEX (binfo), 20010110);
sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt,
BINFO_SUBVTT_INDEX (binfo));

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,7 @@ struct diagnostic_context;
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
ICS_ELLIPSIS_FLAG (in _CONV)
BINFO_ACCESS (in BINFO)
BINFO_DEPENDENT_BASE_P (in BINFO)
DECL_INITIALIZED_P (in VAR_DECL)
2: IDENTIFIER_OPNAME_P.
TYPE_POLYMORPHIC_P (in _TYPE)
@ -79,7 +79,7 @@ struct diagnostic_context;
NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
6: BINFO_ACCESS (in BINFO)
6: For future expansion
Usage of TYPE_LANG_FLAG_?:
0: TYPE_DEPENDENT_P
@ -592,15 +592,6 @@ enum cp_tree_index
CPTI_GLOBAL_DELETE_FNDECL,
CPTI_AGGR_TAG,
CPTI_ACCESS_DEFAULT,
CPTI_ACCESS_PUBLIC,
CPTI_ACCESS_PROTECTED,
CPTI_ACCESS_PRIVATE,
CPTI_ACCESS_DEFAULT_VIRTUAL,
CPTI_ACCESS_PUBLIC_VIRTUAL,
CPTI_ACCESS_PROTECTED_VIRTUAL,
CPTI_ACCESS_PRIVATE_VIRTUAL,
CPTI_CTOR_IDENTIFIER,
CPTI_COMPLETE_CTOR_IDENTIFIER,
CPTI_BASE_CTOR_IDENTIFIER,
@ -682,19 +673,6 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
#define current_aggr cp_global_trees[CPTI_AGGR_TAG]
/* Define the sets of attributes that member functions and baseclasses
can have. These are sensible combinations of {public,private,protected}
cross {virtual,non-virtual}. */
#define access_default_node cp_global_trees[CPTI_ACCESS_DEFAULT]
#define access_public_node cp_global_trees[CPTI_ACCESS_PUBLIC]
#define access_protected_node cp_global_trees[CPTI_ACCESS_PROTECTED]
#define access_private_node cp_global_trees[CPTI_ACCESS_PRIVATE]
#define access_default_virtual_node cp_global_trees[CPTI_ACCESS_DEFAULT_VIRTUAL]
#define access_public_virtual_node cp_global_trees[CPTI_ACCESS_PUBLIC_VIRTUAL]
#define access_protected_virtual_node cp_global_trees[CPTI_ACCESS_PROTECTED_VIRTUAL]
#define access_private_virtual_node cp_global_trees[CPTI_ACCESS_PRIVATE_VIRTUAL]
/* We cache these tree nodes so as to call get_identifier less
frequently. */
@ -768,6 +746,11 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES]
/* Node to indicate default access. This must be distinct from the
access nodes in tree.h. */
#define access_default_node null_node
/* Global state. */
struct saved_scope GTY(())
@ -1414,21 +1397,9 @@ struct lang_type GTY(())
/* A chain of BINFOs for the direct and indirect virtual base classes
that this type uses in a post-order depth-first left-to-right
order. (In other words, these bases appear in the order that they
should be initialized.) If a virtual base is primary, then the
primary copy will appear on this list. Thus, the BINFOs on this
list are all "real"; they are the same BINFOs that will be
encountered when using dfs_unmarked_real_bases_queue_p and related
functions. */
should be initialized.) */
#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
/* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the
binfo_for_vbase. C is the most derived class for the hierarchy
containing BINFO. */
#define CANONICAL_BINFO(BINFO, C) \
(TREE_VIA_VIRTUAL (BINFO) \
? binfo_for_vbase (BINFO_TYPE (BINFO), C) \
: (BINFO))
/* Number of direct baseclasses of NODE. */
#define CLASSTYPE_N_BASECLASSES(NODE) \
(BINFO_N_BASETYPES (TYPE_BINFO (NODE)))
@ -1551,63 +1522,28 @@ struct lang_type GTY(())
/* Additional macros for inheritance information. */
/* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
gcc/tree.h. In particular if D is derived from B then the BINFO
for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
D. In tree.h, this pointer is described as pointing in other
direction. There is a different BINFO for each path to a virtual
base; BINFOs for virtual bases are not shared.
We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
inheritance is indicated by the absence of the other two flags, not
by TREE_VIA_PRIVATE, which is unused. */
/* Mark the binfo, whether shared or not. Each instance of a virtual
base can be separately marked. */
#define BINFO_UNSHARED_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
gcc/tree.h. In particular if D is non-virtually derived from B
then the BINFO for B (in D) will have a BINFO_INHERITANCE_CHAIN
pointing to D. If D is virtually derived, its
BINFO_INHERITANCE_CHAIN will point to the most derived binfo. In
tree.h, this pointer is described as pointing in other
direction. The binfos of virtual bases are shared. */
/* Nonzero means marked by DFS or BFS search. */
#define BINFO_MARKED(NODE) \
(TREE_VIA_VIRTUAL (NODE) \
? CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
: TREE_LANG_FLAG_0 (NODE))
/* Macros needed because of C compilers that don't allow conditional
expressions to be lvalues. Grr! */
#define SET_BINFO_MARKED(NODE) \
(TREE_VIA_VIRTUAL(NODE) \
? SET_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
: (void)(TREE_LANG_FLAG_0 (NODE) = 1))
#define CLEAR_BINFO_MARKED(NODE) \
(TREE_VIA_VIRTUAL (NODE) \
? CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
: (void)(TREE_LANG_FLAG_0 (NODE) = 0))
#define BINFO_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* Nonzero means that this class is on a path leading to a new vtable. */
#define BINFO_VTABLE_PATH_MARKED(NODE) \
(TREE_VIA_VIRTUAL (NODE) \
? CLASSTYPE_MARKED3 (BINFO_TYPE (NODE)) \
: TREE_LANG_FLAG_3 (NODE))
#define SET_BINFO_VTABLE_PATH_MARKED(NODE) \
(TREE_VIA_VIRTUAL(NODE) \
? SET_CLASSTYPE_MARKED3 (BINFO_TYPE (NODE)) \
: (TREE_LANG_FLAG_3 (NODE) = 1))
#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) \
(TREE_VIA_VIRTUAL (NODE) \
? CLEAR_CLASSTYPE_MARKED3 (BINFO_TYPE (NODE))\
: (TREE_LANG_FLAG_3 (NODE) = 0))
#define BINFO_VTABLE_PATH_MARKED(NODE) TREE_LANG_FLAG_3 (NODE)
/* Nonzero means B (a BINFO) has its own vtable. Under the old ABI,
secondary vtables are sometimes shared. Any copies will not have
this flag set.
B is part of the hierarchy dominated by C. */
#define BINFO_NEW_VTABLE_MARKED(B, C) \
(TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C)))
/* Nonzero means B (a BINFO) has its own vtable. Any copies will not
have this flag set. */
#define BINFO_NEW_VTABLE_MARKED(B) (TREE_LANG_FLAG_4 (B))
/* Any subobject that needs a new vtable must have a vptr and must not
be a non-virtual primary base (since it would then use the vtable from a
derived class and never become non-primary.) */
#define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
(BINFO_NEW_VTABLE_MARKED (B, C) = 1, \
#define SET_BINFO_NEW_VTABLE_MARKED(B) \
(BINFO_NEW_VTABLE_MARKED (B) = 1, \
my_friendly_assert (!BINFO_PRIMARY_P (B) \
|| TREE_VIA_VIRTUAL (B), 20000517), \
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
@ -1615,8 +1551,6 @@ struct lang_type GTY(())
/* Nonzero means this class has done dfs_pushdecls. */
#define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
#define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
#define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
/* Nonzero if this BINFO is a primary base class. Note, this can be
set for non-canononical virtual bases. For a virtual primary base
@ -1643,6 +1577,10 @@ struct lang_type GTY(())
#define BINFO_LANG_ELTS (BINFO_ELTS + 3)
/* Nonzero if this binfo is for a dependent base - one that should not
be searched. */
#define BINFO_DEPENDENT_BASE_P(NODE) TREE_LANG_FLAG_1(NODE)
/* Nonzero if this binfo has lost its primary base binfo (because that
is a nearly-empty virtual base that has been taken by some other
base in the complete hierarchy. */
@ -3077,7 +3015,7 @@ typedef enum tmpl_spec_kind {
/* The various kinds of access. BINFO_ACCESS depends on these being
two bit quantities. The numerical values are important; they are
used to initialize RTTI data structures, so changing them changes
the ABI. */
the ABI. */
typedef enum access_kind {
ak_none = 0, /* Inaccessible. */
ak_public = 1, /* Accessible, as a `public' thing. */
@ -4142,28 +4080,24 @@ extern tree binfo_from_vbase (tree);
extern tree look_for_overrides_here (tree, tree);
extern int check_final_overrider (tree, tree);
extern tree dfs_walk (tree,
tree (*) (tree, void *),
tree (*) (tree, void *),
void *);
tree (*) (tree, void *),
tree (*) (tree, int, void *),
void *);
extern tree dfs_walk_real (tree,
tree (*) (tree, void *),
tree (*) (tree, void *),
tree (*) (tree, void *),
void *);
tree (*) (tree, void *),
tree (*) (tree, void *),
tree (*) (tree, int, void *),
void *);
extern tree dfs_unmark (tree, void *);
extern tree markedp (tree, void *);
extern tree unmarkedp (tree, void *);
extern tree dfs_unmarked_real_bases_queue_p (tree, void *);
extern tree dfs_marked_real_bases_queue_p (tree, void *);
extern tree dfs_skip_vbases (tree, void *);
extern tree marked_vtable_pathp (tree, void *);
extern tree unmarked_vtable_pathp (tree, void *);
extern tree find_vbase_instance (tree, tree);
extern tree binfo_for_vbase (tree, tree);
extern tree markedp (tree, int, void *);
extern tree unmarkedp (tree, int, void *);
extern tree binfo_via_virtual (tree, tree);
extern tree build_baselink (tree, tree, tree, tree);
extern tree adjust_result_of_qualified_name_lookup
(tree, tree, tree);
extern tree copied_binfo (tree, tree);
extern tree original_binfo (tree, tree);
/* in semantics.c */
extern void push_deferring_access_checks (bool defer_p);
extern void resume_deferring_access_checks (void);
@ -4245,7 +4179,7 @@ extern void finish_default_args (void);
extern tree finish_member_class_template (tree);
extern void finish_template_decl (tree);
extern tree finish_template_type (tree, tree, int);
extern tree finish_base_specifier (tree, tree);
extern tree finish_base_specifier (tree, tree, bool);
extern void finish_member_declaration (tree);
extern void check_multiple_declarators (void);
extern tree finish_typeof (tree);
@ -4275,7 +4209,7 @@ extern void init_tree (void);
extern int pod_type_p (tree);
extern int zero_init_p (tree);
extern tree canonical_type_variant (tree);
extern void unshare_base_binfos (tree);
extern tree copy_base_binfos (tree, tree, tree);
extern int member_p (tree);
extern cp_lvalue_kind real_lvalue_p (tree);
extern int non_cast_lvalue_p (tree);
@ -4293,7 +4227,6 @@ extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
extern tree hash_chainon (tree, tree);
extern tree make_binfo (tree, tree, tree, tree);
extern tree reverse_path (tree);
extern int count_functions (tree);
extern int is_overloaded_fn (tree);
extern tree get_first_fn (tree);

View file

@ -12829,17 +12829,17 @@ xref_tag_from_type (tree old, tree id, int globalize)
}
/* REF is a type (named NAME), for which we have just seen some
baseclasses. BINFO is a list of those baseclasses; the
baseclasses. BASE_LIST is a list of those baseclasses; the
TREE_PURPOSE is an access_* node, and the TREE_VALUE is the type of
the base-class. CODE_TYPE_NODE indicates whether REF is a class,
the base-class. TREE_VIA_VIRTUAL indicates virtual
inheritance. CODE_TYPE_NODE indicates whether REF is a class,
struct, or union. */
void
xref_basetypes (tree ref, tree binfo)
xref_basetypes (tree ref, tree base_list)
{
/* In the declaration `A : X, Y, ... Z' we mark all the types
(A, X, Y, ..., Z) so we can check for duplicates. */
tree binfos;
tree *basep;
int i;
@ -12857,145 +12857,147 @@ xref_basetypes (tree ref, tree binfo)
instantiated. This ensures that if we call ourselves recursively
we do not get confused about which classes are marked and which
are not. */
basep = &binfo;
basep = &base_list;
while (*basep)
{
tree basetype = TREE_VALUE (*basep);
if (!(processing_template_decl && uses_template_parms (basetype))
&& !complete_type_or_else (basetype, NULL))
/* An incomplete type. Remove it form the list. */
/* An incomplete type. Remove it from the list. */
*basep = TREE_CHAIN (*basep);
else
basep = &TREE_CHAIN (*basep);
}
SET_CLASSTYPE_MARKED (ref);
BINFO_BASETYPES (TYPE_BINFO (ref)) = binfos
= make_tree_vec (list_length (binfo));
for (i = 0; binfo; binfo = TREE_CHAIN (binfo))
i = list_length (base_list);
if (i)
{
/* The base of a derived struct is public by default. */
int via_public
= (TREE_PURPOSE (binfo) == access_public_node
|| TREE_PURPOSE (binfo) == access_public_virtual_node
|| (tag_code != class_type
&& (TREE_PURPOSE (binfo) == access_default_node
|| TREE_PURPOSE (binfo) == access_default_virtual_node)));
int via_protected
= (TREE_PURPOSE (binfo) == access_protected_node
|| TREE_PURPOSE (binfo) == access_protected_virtual_node);
int via_virtual
= (TREE_PURPOSE (binfo) == access_private_virtual_node
|| TREE_PURPOSE (binfo) == access_protected_virtual_node
|| TREE_PURPOSE (binfo) == access_public_virtual_node
|| TREE_PURPOSE (binfo) == access_default_virtual_node);
tree basetype = TREE_VALUE (binfo);
tree base_binfo;
if (basetype && TREE_CODE (basetype) == TYPE_DECL)
basetype = TREE_TYPE (basetype);
if (!basetype
|| (TREE_CODE (basetype) != RECORD_TYPE
&& TREE_CODE (basetype) != TYPENAME_TYPE
&& TREE_CODE (basetype) != TEMPLATE_TYPE_PARM
&& TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM))
tree binfo = TYPE_BINFO (ref);
tree binfos = make_tree_vec (i);
tree accesses = make_tree_vec (i);
BINFO_BASETYPES (binfo) = binfos;
BINFO_BASEACCESSES (binfo) = accesses;
for (i = 0; base_list; base_list = TREE_CHAIN (base_list))
{
error ("base type `%T' fails to be a struct or class type",
TREE_VALUE (binfo));
continue;
}
if (CLASSTYPE_MARKED (basetype))
{
if (basetype == ref)
error ("recursive type `%T' undefined", basetype);
tree access = TREE_PURPOSE (base_list);
int via_virtual = TREE_VIA_VIRTUAL (base_list);
tree basetype = TREE_VALUE (base_list);
tree base_binfo;
if (access == access_default_node)
/* The base of a derived struct is public by default. */
access = (tag_code == class_type
? access_private_node : access_public_node);
if (basetype && TREE_CODE (basetype) == TYPE_DECL)
basetype = TREE_TYPE (basetype);
if (!basetype
|| (TREE_CODE (basetype) != RECORD_TYPE
&& TREE_CODE (basetype) != TYPENAME_TYPE
&& TREE_CODE (basetype) != TEMPLATE_TYPE_PARM
&& TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM))
{
error ("base type `%T' fails to be a struct or class type",
basetype);
continue;
}
if (CLASSTYPE_MARKED (basetype))
{
if (basetype == ref)
error ("recursive type `%T' undefined", basetype);
else
error ("duplicate base type `%T' invalid", basetype);
continue;
}
if (TYPE_FOR_JAVA (basetype)
&& (current_lang_depth () == 0))
TYPE_FOR_JAVA (ref) = 1;
if (CLASS_TYPE_P (basetype))
{
base_binfo = TYPE_BINFO (basetype);
/* This flag will be in the binfo of the base type, we must
clear it after copying the base binfos. */
BINFO_DEPENDENT_BASE_P (base_binfo)
= dependent_type_p (basetype);
}
else
error ("duplicate base type `%T' invalid", basetype);
continue;
base_binfo = make_binfo (size_zero_node, basetype,
NULL_TREE, NULL_TREE);
TREE_VEC_ELT (binfos, i) = base_binfo;
TREE_VEC_ELT (accesses, i) = access;
/* This flag will be in the binfo of the base type, we must
clear it after copying the base binfos. */
TREE_VIA_VIRTUAL (base_binfo) = via_virtual;
SET_CLASSTYPE_MARKED (basetype);
/* We are free to modify these bits because they are meaningless
at top level, and BASETYPE is a top-level type. */
if (via_virtual || TYPE_USES_VIRTUAL_BASECLASSES (basetype))
{
TYPE_USES_VIRTUAL_BASECLASSES (ref) = 1;
/* Converting to a virtual base class requires looking
up the offset of the virtual base. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
}
if (CLASS_TYPE_P (basetype))
{
TYPE_HAS_NEW_OPERATOR (ref)
|= TYPE_HAS_NEW_OPERATOR (basetype);
TYPE_HAS_ARRAY_NEW_OPERATOR (ref)
|= TYPE_HAS_ARRAY_NEW_OPERATOR (basetype);
TYPE_GETS_DELETE (ref) |= TYPE_GETS_DELETE (basetype);
/* If the base-class uses multiple inheritance, so do we. */
TYPE_USES_MULTIPLE_INHERITANCE (ref)
|= TYPE_USES_MULTIPLE_INHERITANCE (basetype);
/* Likewise, if converting to a base of the base may require
code, then we may need to generate code to convert to a
base as well. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref)
|= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype);
}
i++;
}
if (TYPE_FOR_JAVA (basetype)
&& (current_lang_depth () == 0))
TYPE_FOR_JAVA (ref) = 1;
/* Note that the BINFO records which describe individual
inheritances are *not* shared in the lattice! They
cannot be shared because a given baseclass may be
inherited with different `accessibility' by different
derived classes. (Each BINFO record describing an
individual inheritance contains flags which say what
the `accessibility' of that particular inheritance is.) */
base_binfo
= make_binfo (size_zero_node, basetype,
CLASS_TYPE_P (basetype)
? TYPE_BINFO_VTABLE (basetype) : NULL_TREE,
CLASS_TYPE_P (basetype)
? TYPE_BINFO_VIRTUALS (basetype) : NULL_TREE);
TREE_VEC_ELT (binfos, i) = base_binfo;
TREE_VIA_PUBLIC (base_binfo) = via_public;
TREE_VIA_PROTECTED (base_binfo) = via_protected;
TREE_VIA_VIRTUAL (base_binfo) = via_virtual;
BINFO_INHERITANCE_CHAIN (base_binfo) = TYPE_BINFO (ref);
/* We need to unshare the binfos now so that lookups during class
definition work. */
unshare_base_binfos (base_binfo);
SET_CLASSTYPE_MARKED (basetype);
/* We are free to modify these bits because they are meaningless
at top level, and BASETYPE is a top-level type. */
if (via_virtual || TYPE_USES_VIRTUAL_BASECLASSES (basetype))
if (i)
TREE_VEC_LENGTH (accesses) = TREE_VEC_LENGTH (binfos) = i;
else
BINFO_BASEACCESSES (binfo) = BINFO_BASETYPES (binfo) = NULL_TREE;
if (i > 1)
{
TYPE_USES_VIRTUAL_BASECLASSES (ref) = 1;
/* Converting to a virtual base class requires looking
up the offset of the virtual base. */
TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1;
/* If there is more than one non-empty they cannot be at the same
address. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
}
}
/* Copy the base binfos, collect the virtual bases and set the
inheritance order chain. */
copy_base_binfos (TYPE_BINFO (ref), ref, NULL_TREE);
CLASSTYPE_VBASECLASSES (ref) = nreverse (CLASSTYPE_VBASECLASSES (ref));
/* Unmark all the types. */
while (i--)
{
tree basetype = BINFO_TYPE (BINFO_BASETYPE (TYPE_BINFO (ref), i));
CLEAR_CLASSTYPE_MARKED (basetype);
if (CLASS_TYPE_P (basetype))
{
TYPE_HAS_NEW_OPERATOR (ref)
|= TYPE_HAS_NEW_OPERATOR (basetype);
TYPE_HAS_ARRAY_NEW_OPERATOR (ref)
|= TYPE_HAS_ARRAY_NEW_OPERATOR (basetype);
TYPE_GETS_DELETE (ref) |= TYPE_GETS_DELETE (basetype);
/* If the base-class uses multiple inheritance, so do we. */
TYPE_USES_MULTIPLE_INHERITANCE (ref)
|= TYPE_USES_MULTIPLE_INHERITANCE (basetype);
/* Likewise, if converting to a base of the base may require
code, then we may need to generate code to convert to a
base as well. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref)
|= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype);
TREE_VIA_VIRTUAL (TYPE_BINFO (basetype)) = 0;
BINFO_DEPENDENT_BASE_P (TYPE_BINFO (basetype)) = 0;
}
i += 1;
}
if (i)
TREE_VEC_LENGTH (binfos) = i;
else
BINFO_BASETYPES (TYPE_BINFO (ref)) = NULL_TREE;
if (i > 1)
{
TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1;
/* If there is more than one non-empty they cannot be at the same
address. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
}
/* Unmark all the types. */
while (--i >= 0)
CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (TREE_VEC_ELT (binfos, i)));
CLEAR_CLASSTYPE_MARKED (ref);
/* Now that we know all the base-classes, set up the list of virtual
bases. */
get_vbase_types (ref);
}

View file

@ -1,6 +1,6 @@
/* Handle initialization things in C++.
Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
@ -127,7 +127,7 @@ dfs_initialize_vtbl_ptrs (binfo, data)
expand_virtual_init (binfo, base_ptr);
}
SET_BINFO_MARKED (binfo);
BINFO_MARKED (binfo) = 1;
return NULL_TREE;
}
@ -149,10 +149,9 @@ initialize_vtbl_ptrs (addr)
class. We do these in pre-order because can't find the virtual
bases for a class until we've initialized the vtbl for that
class. */
dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs,
NULL, dfs_unmarked_real_bases_queue_p, list);
dfs_walk (TYPE_BINFO (type), dfs_unmark,
dfs_marked_real_bases_queue_p, type);
dfs_walk_real (TYPE_BINFO (type), dfs_initialize_vtbl_ptrs,
NULL, unmarkedp, list);
dfs_walk (TYPE_BINFO (type), dfs_unmark, markedp, type);
}
/* Return an expression for the zero-initialization of an object with
@ -1001,15 +1000,9 @@ expand_member_init (tree name, tree init)
binfo = lookup_base (current_class_type, basetype,
ba_ignore, NULL);
if (binfo)
{
if (TREE_VIA_VIRTUAL (binfo))
binfo = binfo_for_vbase (basetype, current_class_type);
else if (BINFO_INHERITANCE_CHAIN (binfo)
!= TYPE_BINFO (current_class_type))
binfo = NULL_TREE;
}
if (!binfo)
if (!binfo || (!TREE_VIA_VIRTUAL (binfo)
&& (BINFO_INHERITANCE_CHAIN (binfo)
!= TYPE_BINFO (current_class_type))))
{
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))
error ("type `%D' is not a direct or virtual base of `%T'",
@ -1019,9 +1012,7 @@ expand_member_init (tree name, tree init)
name, current_class_type);
return NULL_TREE;
}
if (binfo)
return build_tree_list (binfo, init);
return build_tree_list (binfo, init);
}
else
{

View file

@ -12419,22 +12419,13 @@ cp_parser_base_clause (cp_parser* parser)
static tree
cp_parser_base_specifier (cp_parser* parser)
{
static const tree *const access_nodes[][2] =
{
/* This ordering must match the access_kind enumeration. */
{&access_default_node, &access_default_virtual_node},
{&access_public_node, &access_public_virtual_node},
{&access_protected_node, &access_protected_virtual_node},
{&access_private_node, &access_private_virtual_node}
};
cp_token *token;
bool done = false;
bool virtual_p = false;
bool duplicate_virtual_error_issued_p = false;
bool duplicate_access_error_issued_p = false;
bool class_scope_p, template_p;
access_kind access = ak_none;
tree access_node;
tree access = access_default_node;
tree type;
/* Process the optional `virtual' and `access-specifier'. */
@ -12466,16 +12457,15 @@ cp_parser_base_specifier (cp_parser* parser)
case RID_PRIVATE:
/* If more than one access specifier appears, issue an
error. */
if (access != ak_none && !duplicate_access_error_issued_p)
if (access != access_default_node
&& !duplicate_access_error_issued_p)
{
cp_parser_error (parser,
"more than one access specifier in base-specified");
duplicate_access_error_issued_p = true;
}
access = ((access_kind)
tree_low_cst (ridpointers[(int) token->keyword],
/*pos=*/1));
access = ridpointers[(int) token->keyword];
/* Consume the access-specifier. */
cp_lexer_consume_token (parser->lexer);
@ -12488,9 +12478,6 @@ cp_parser_base_specifier (cp_parser* parser)
}
}
/* Map `virtual_p' and `access' onto one of the access tree-nodes. */
access_node = *access_nodes[access][virtual_p];
/* Look for the optional `::' operator. */
cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false);
/* Look for the nested-name-specifier. The simplest way to
@ -12526,7 +12513,7 @@ cp_parser_base_specifier (cp_parser* parser)
if (type == error_mark_node)
return error_mark_node;
return finish_base_specifier (access_node, TREE_TYPE (type));
return finish_base_specifier (TREE_TYPE (type), access, virtual_p);
}
/* Exception handling [gram.exception] */

View file

@ -5146,7 +5146,8 @@ instantiate_class_template (type)
{
tree template, args, pattern, t, member;
tree typedecl;
tree pbinfo;
if (type == error_mark_node)
return error_mark_node;
@ -5277,10 +5278,13 @@ instantiate_class_template (type)
if (ANON_AGGR_TYPE_P (pattern))
SET_ANON_AGGR_TYPE_P (type);
if (TYPE_BINFO_BASETYPES (pattern))
pbinfo = TYPE_BINFO (pattern);
if (BINFO_BASETYPES (pbinfo))
{
tree base_list = NULL_TREE;
tree pbases = TYPE_BINFO_BASETYPES (pattern);
tree pbases = BINFO_BASETYPES (pbinfo);
tree paccesses = BINFO_BASEACCESSES (pbinfo);
int i;
/* Substitute into each of the bases to determine the actual
@ -5292,33 +5296,15 @@ instantiate_class_template (type)
tree pbase;
pbase = TREE_VEC_ELT (pbases, i);
access = TREE_VEC_ELT (paccesses, i);
/* Substitute to figure out the base class. */
base = tsubst (BINFO_TYPE (pbase), args, tf_error, NULL_TREE);
if (base == error_mark_node)
continue;
/* Calculate the correct access node. */
if (TREE_VIA_VIRTUAL (pbase))
{
if (TREE_VIA_PUBLIC (pbase))
access = access_public_virtual_node;
else if (TREE_VIA_PROTECTED (pbase))
access = access_protected_virtual_node;
else
access = access_private_virtual_node;
}
else
{
if (TREE_VIA_PUBLIC (pbase))
access = access_public_node;
else if (TREE_VIA_PROTECTED (pbase))
access = access_protected_node;
else
access = access_private_node;
}
base_list = tree_cons (access, base, base_list);
TREE_VIA_VIRTUAL (base_list) = TREE_VIA_VIRTUAL (pbase);
}
/* The list is now in reverse order; correct that. */
@ -9161,7 +9147,7 @@ get_template_base_recursive (tparms, targs, parm,
/* When searching for a non-virtual, we cannot mark virtually
found binfos. */
if (! this_virtual)
SET_BINFO_MARKED (base_binfo);
BINFO_MARKED (base_binfo) = 1;
rval = get_template_base_recursive (tparms, targs,
parm,

View file

@ -1039,6 +1039,7 @@ get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p)
tree binfo = TYPE_BINFO (type);
int nbases = BINFO_N_BASETYPES (binfo);
tree base_binfos = BINFO_BASETYPES (binfo);
tree base_accesses = BINFO_BASEACCESSES (binfo);
tree base_inits = NULL_TREE;
int ix;
@ -1051,15 +1052,14 @@ get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p)
tree tinfo;
tree offset;
if (TREE_PUBLIC (base_binfo))
if (TREE_VEC_ELT (base_accesses, ix) == access_public_node)
flags |= 2;
tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
if (TREE_VIA_VIRTUAL (base_binfo))
{
/* We store the vtable offset at which the virtual
base offset can be found. */
offset = BINFO_VPTR_FIELD
(binfo_for_vbase (BINFO_TYPE (base_binfo), type));
offset = BINFO_VPTR_FIELD (base_binfo);
offset = convert (sizetype, offset);
flags |= 1;
}
@ -1187,12 +1187,14 @@ get_pseudo_ti_desc (tree type)
return class_desc_type_node;
else
{
tree base_binfo =
TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), 0);
int num_bases = BINFO_N_BASETYPES (TYPE_BINFO (type));
tree binfo = TYPE_BINFO (type);
tree base_binfos = BINFO_BASETYPES (binfo);
tree base_accesses = BINFO_BASEACCESSES (binfo);
tree base_binfo = TREE_VEC_ELT (base_binfos, 0);
int num_bases = TREE_VEC_LENGTH (base_binfos);
if (num_bases == 1
&& TREE_PUBLIC (base_binfo)
&& TREE_VEC_ELT (base_accesses, 0) == access_public_node
&& !TREE_VIA_VIRTUAL (base_binfo)
&& integer_zerop (BINFO_OFFSET (base_binfo)))
/* single non-virtual public. */

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,8 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002,
2003 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
@ -2038,27 +2039,26 @@ finish_template_type (name, args, entering_scope)
access_{default,public,protected_private}[_virtual]_node.*/
tree
finish_base_specifier (access_specifier, base_class)
tree access_specifier;
tree base_class;
finish_base_specifier (tree base, tree access, bool virtual_p)
{
tree result;
if (base_class == error_mark_node)
if (base == error_mark_node)
{
error ("invalid base-class specification");
result = NULL_TREE;
}
else if (! is_aggr_type (base_class, 1))
else if (! is_aggr_type (base, 1))
result = NULL_TREE;
else
{
if (cp_type_quals (base_class) != 0)
if (cp_type_quals (base) != 0)
{
error ("base class `%T' has cv qualifiers", base_class);
base_class = TYPE_MAIN_VARIANT (base_class);
error ("base class `%T' has cv qualifiers", base);
base = TYPE_MAIN_VARIANT (base);
}
result = build_tree_list (access_specifier, base_class);
result = build_tree_list (access, base);
TREE_VIA_VIRTUAL (result) = virtual_p;
}
return result;

View file

@ -1,6 +1,6 @@
/* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
@ -714,37 +714,81 @@ canonical_type_variant (t)
return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), cp_type_quals (t));
}
/* Makes new binfos for the indirect bases under BINFO, and updates
BINFO_OFFSET for them and their bases. */
/* Makes new binfos for the indirect bases under BINFO. T is the most
derived TYPE. PREV is the previous binfo, whose TREE_CHAIN we make
point to this binfo. We return the last BINFO created.
void
unshare_base_binfos (binfo)
tree binfo;
The CLASSTYPE_VBASECLASSES list of T is constructed in reverse
order (pre-order, depth-first, right-to-left). You must nreverse it.
The BINFO_INHERITANCE of a virtual base class points to the binfo
og the most derived type.
The binfo's TREE_CHAIN is set to inheritance graph order, but bases
for non-class types are not included (i.e. those which are
dependent bases in non-instantiated templates). */
tree
copy_base_binfos (binfo, t, prev)
tree binfo, t, prev;
{
tree binfos = BINFO_BASETYPES (binfo);
tree new_binfo;
int j;
int n, ix;
if (prev)
TREE_CHAIN (prev) = binfo;
prev = binfo;
if (binfos == NULL_TREE)
return;
return prev;
/* Now unshare the structure beneath BINFO. */
for (j = TREE_VEC_LENGTH (binfos)-1;
j >= 0; j--)
n = TREE_VEC_LENGTH (binfos);
/* Now copy the structure beneath BINFO. */
for (ix = 0; ix != n; ix++)
{
tree base_binfo = TREE_VEC_ELT (binfos, j);
new_binfo = TREE_VEC_ELT (binfos, j)
= make_binfo (BINFO_OFFSET (base_binfo),
base_binfo,
BINFO_VTABLE (base_binfo),
BINFO_VIRTUALS (base_binfo));
TREE_VIA_PUBLIC (new_binfo) = TREE_VIA_PUBLIC (base_binfo);
TREE_VIA_PROTECTED (new_binfo) = TREE_VIA_PROTECTED (base_binfo);
TREE_VIA_VIRTUAL (new_binfo) = TREE_VIA_VIRTUAL (base_binfo);
BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
BINFO_PRIMARY_BASE_OF (new_binfo) = NULL_TREE;
unshare_base_binfos (new_binfo);
tree base_binfo = TREE_VEC_ELT (binfos, ix);
tree new_binfo = NULL_TREE;
if (!CLASS_TYPE_P (BINFO_TYPE (base_binfo)))
{
my_friendly_assert (binfo == TYPE_BINFO (t), 20030204);
new_binfo = base_binfo;
TREE_CHAIN (prev) = new_binfo;
prev = new_binfo;
BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
BINFO_DEPENDENT_BASE_P (new_binfo) = 1;
}
else if (TREE_VIA_VIRTUAL (base_binfo))
{
new_binfo = purpose_member (BINFO_TYPE (base_binfo),
CLASSTYPE_VBASECLASSES (t));
if (new_binfo)
new_binfo = TREE_VALUE (new_binfo);
}
if (!new_binfo)
{
new_binfo = make_binfo (BINFO_OFFSET (base_binfo),
base_binfo, NULL_TREE,
BINFO_VIRTUALS (base_binfo));
prev = copy_base_binfos (new_binfo, t, prev);
if (TREE_VIA_VIRTUAL (base_binfo))
{
CLASSTYPE_VBASECLASSES (t)
= tree_cons (BINFO_TYPE (new_binfo), new_binfo,
CLASSTYPE_VBASECLASSES (t));
TREE_VIA_VIRTUAL (new_binfo) = 1;
BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t);
}
else
BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
}
TREE_VEC_ELT (binfos, ix) = new_binfo;
}
return prev;
}
@ -897,11 +941,15 @@ make_binfo (offset, binfo, vtable, virtuals)
tree type;
if (TREE_CODE (binfo) == TREE_VEC)
type = BINFO_TYPE (binfo);
{
type = BINFO_TYPE (binfo);
BINFO_DEPENDENT_BASE_P (new_binfo) = BINFO_DEPENDENT_BASE_P (binfo);
}
else
{
type = binfo;
binfo = CLASS_TYPE_P (type) ? TYPE_BINFO (binfo) : NULL_TREE;
binfo = NULL_TREE;
BINFO_DEPENDENT_BASE_P (new_binfo) = 1;
}
TREE_TYPE (new_binfo) = TYPE_MAIN_VARIANT (type);
@ -909,31 +957,14 @@ make_binfo (offset, binfo, vtable, virtuals)
BINFO_VTABLE (new_binfo) = vtable;
BINFO_VIRTUALS (new_binfo) = virtuals;
if (binfo && BINFO_BASETYPES (binfo) != NULL_TREE)
BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
return new_binfo;
}
/* Return a TREE_LIST whose TREE_VALUE nodes along the
BINFO_INHERITANCE_CHAIN for BINFO, but in the opposite order. In
other words, while the BINFO_INHERITANCE_CHAIN goes from base
classes to derived classes, the reversed path goes from derived
classes to base classes. */
tree
reverse_path (binfo)
tree binfo;
{
tree reversed_path;
reversed_path = NULL_TREE;
while (binfo)
if (binfo && !BINFO_DEPENDENT_BASE_P (binfo)
&& BINFO_BASETYPES (binfo) != NULL_TREE)
{
reversed_path = tree_cons (NULL_TREE, binfo, reversed_path);
binfo = BINFO_INHERITANCE_CHAIN (binfo);
BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
/* We do not need to copy the accesses, as they are read only. */
BINFO_BASEACCESSES (new_binfo) = BINFO_BASEACCESSES (binfo);
}
return reversed_path;
return new_binfo;
}
void

View file

@ -5720,9 +5720,8 @@ get_delta_difference (from, to, force)
if (virt_binfo)
{
/* This is a reinterpret cast, we choose to do nothing. */
warning ("pointer to member cast via virtual base `%T' of `%T'",
BINFO_TYPE (virt_binfo),
BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
warning ("pointer to member cast via virtual base `%T'",
BINFO_TYPE (virt_binfo));
return delta;
}
delta = BINFO_OFFSET (binfo);
@ -5739,13 +5738,11 @@ get_delta_difference (from, to, force)
{
/* This is a reinterpret cast, we choose to do nothing. */
if (force)
warning ("pointer to member cast via virtual base `%T' of `%T'",
BINFO_TYPE (virt_binfo),
BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
warning ("pointer to member cast via virtual base `%T'",
BINFO_TYPE (virt_binfo));
else
error ("pointer to member conversion via virtual base `%T' of `%T'",
BINFO_TYPE (virt_binfo),
BINFO_TYPE (BINFO_INHERITANCE_CHAIN (virt_binfo)));
error ("pointer to member conversion via virtual base `%T'",
BINFO_TYPE (virt_binfo));
return delta;
}
delta = BINFO_OFFSET (binfo);

View file

@ -1,6 +1,6 @@
/* Output dbx-format symbol table information from GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC.
@ -1577,15 +1577,19 @@ dbxout_type (type, full)
}
for (i = 0; i < n_baseclasses; i++)
{
tree child = TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (type)), i);
tree binfo = TYPE_BINFO (type);
tree child = BINFO_BASETYPE (binfo, i);
tree access = (BINFO_BASEACCESSES (binfo)
? BINFO_BASEACCESS (binfo, i) : access_public_node);
if (use_gnu_debug_info_extensions)
{
have_used_extensions = 1;
putc (TREE_VIA_VIRTUAL (child) ? '1' : '0', asmfile);
putc (TREE_VIA_PUBLIC (child) ? '2' : '0', asmfile);
putc (access == access_public_node ? '2' : '0', asmfile);
CHARS (2);
if (TREE_VIA_VIRTUAL (child) && strcmp (lang_hooks.name, "GNU C++") == 0)
if (TREE_VIA_VIRTUAL (child)
&& strcmp (lang_hooks.name, "GNU C++") == 0)
/* For a virtual base, print the (negative) offset within
the vtable where we must look to find the necessary
adjustment. */

View file

@ -3818,7 +3818,7 @@ static void gen_field_die PARAMS ((tree, dw_die_ref));
static void gen_ptr_to_mbr_type_die PARAMS ((tree, dw_die_ref));
static dw_die_ref gen_compile_unit_die PARAMS ((const char *));
static void gen_string_type_die PARAMS ((tree, dw_die_ref));
static void gen_inheritance_die PARAMS ((tree, dw_die_ref));
static void gen_inheritance_die PARAMS ((tree, tree, dw_die_ref));
static void gen_member_die PARAMS ((tree, dw_die_ref));
static void gen_struct_or_union_type_die PARAMS ((tree, dw_die_ref));
static void gen_subroutine_type_die PARAMS ((tree, dw_die_ref));
@ -11363,8 +11363,8 @@ gen_string_type_die (type, context_die)
/* Generate the DIE for a base class. */
static void
gen_inheritance_die (binfo, context_die)
tree binfo;
gen_inheritance_die (binfo, access, context_die)
tree binfo, access;
dw_die_ref context_die;
{
dw_die_ref die = new_die (DW_TAG_inheritance, context_die, binfo);
@ -11375,9 +11375,9 @@ gen_inheritance_die (binfo, context_die)
if (TREE_VIA_VIRTUAL (binfo))
add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
if (TREE_VIA_PUBLIC (binfo))
if (access == access_public_node)
add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_public);
else if (TREE_VIA_PROTECTED (binfo))
else if (access == access_protected_node)
add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_protected);
}
@ -11389,6 +11389,7 @@ gen_member_die (type, context_die)
dw_die_ref context_die;
{
tree member;
tree binfo = TYPE_BINFO (type);
dw_die_ref child;
/* If this is not an incomplete type, output descriptions of each of its
@ -11404,14 +11405,17 @@ gen_member_die (type, context_die)
the TREE node representing the appropriate (containing) type. */
/* First output info about the base classes. */
if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
if (binfo && BINFO_BASETYPES (binfo))
{
tree bases = TYPE_BINFO_BASETYPES (type);
tree bases = BINFO_BASETYPES (binfo);
tree accesses = BINFO_BASEACCESSES (binfo);
int n_bases = TREE_VEC_LENGTH (bases);
int i;
for (i = 0; i < n_bases; i++)
gen_inheritance_die (TREE_VEC_ELT (bases, i), context_die);
gen_inheritance_die (TREE_VEC_ELT (bases, i),
(accesses ? TREE_VEC_ELT (accesses, i)
: access_public_node), context_die);
}
/* Now output info about the data members and type members. */

View file

@ -4179,7 +4179,8 @@ static void
output_inheritance_die (arg)
void *arg;
{
tree binfo = arg;
tree binfo = ((tree *)arg)[0];
tree access = ((tree *)arg)[1];
ASM_OUTPUT_DWARF_TAG (asm_out_file, TAG_inheritance);
sibling_attribute ();
@ -4190,12 +4191,12 @@ output_inheritance_die (arg)
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual);
ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
}
if (TREE_VIA_PUBLIC (binfo))
if (access == access_public_node)
{
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_public);
ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
}
else if (TREE_VIA_PROTECTED (binfo))
else if (access == access_protected_node)
{
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_protected);
ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, "");
@ -4896,18 +4897,25 @@ output_type (type, containing_scope)
if (COMPLETE_TYPE_P (type))
{
tree binfo = TYPE_BINFO (type);
/* First output info about the base classes. */
if (TYPE_BINFO (type) && TYPE_BINFO_BASETYPES (type))
if (binfo)
{
register tree bases = TYPE_BINFO_BASETYPES (type);
register int n_bases = TREE_VEC_LENGTH (bases);
tree bases = BINFO_BASETYPES (binfo);
tree accesses = BINFO_BASEACCESSES (binfo);
register int n_bases = BINFO_N_BASETYPES (binfo);
register int i;
for (i = 0; i < n_bases; i++)
{
tree binfo = TREE_VEC_ELT (bases, i);
tree arg[2];
arg[0] = TREE_VEC_ELT (bases, i);
arg[1] = (accesses ? TREE_VEC_ELT (accesses, i)
: access_public_node);
output_type (BINFO_TYPE (binfo), containing_scope);
output_die (output_inheritance_die, binfo);
output_die (output_inheritance_die, arg);
}
}

View file

@ -1,3 +1,9 @@
2003-02-20 Nathan Sidwell <nathan@codesourcery.com>
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
2003-02-12 Ranjit Mathew <rmathew@hotmail.com>
* decl.c (java_init_decl_processing): Change

View file

@ -363,7 +363,6 @@ set_super_info (int access_flags, tree this_class,
tree super_binfo = make_tree_vec (BINFO_ELTS);
BINFO_TYPE (super_binfo) = super_class;
BINFO_OFFSET (super_binfo) = integer_zero_node;
TREE_VIA_PUBLIC (super_binfo) = 1;
TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO (this_class)), 0)
= super_binfo;
CLASS_HAS_SUPER (this_class) = 1;
@ -497,7 +496,6 @@ add_interface_do (tree basetype_vec, tree interface_class, int i)
BINFO_OFFSET (interface_binfo) = integer_zero_node;
BINFO_VPTR_FIELD (interface_binfo) = integer_zero_node;
TREE_VIA_VIRTUAL (interface_binfo) = 1;
TREE_VIA_PUBLIC (interface_binfo) = 1;
TREE_VEC_ELT (basetype_vec, i) = interface_binfo;
}

View file

@ -1,5 +1,5 @@
/* Tree-dumping functionality for intermediate representation.
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>
This file is part of GCC.
@ -273,18 +273,37 @@ dequeue_and_dump (di)
more informative. */
if (dni->binfo_p)
{
if (TREE_VIA_PUBLIC (t))
dump_string (di, "pub");
else if (TREE_VIA_PROTECTED (t))
dump_string (di, "prot");
else if (TREE_VIA_PRIVATE (t))
dump_string (di, "priv");
unsigned ix;
tree bases = BINFO_BASETYPES (t);
unsigned n_bases = bases ? TREE_VEC_LENGTH (bases): 0;
tree accesses = BINFO_BASEACCESSES (t);
dump_child ("type", BINFO_TYPE (t));
if (TREE_VIA_VIRTUAL (t))
dump_string (di, "virt");
dump_child ("type", BINFO_TYPE (t));
dump_child ("base", BINFO_BASETYPES (t));
dump_int (di, "bases", n_bases);
for (ix = 0; ix != n_bases; ix++)
{
tree base = TREE_VEC_ELT (bases, ix);
tree access = (accesses ? TREE_VEC_ELT (accesses, ix)
: access_public_node);
const char *string = NULL;
if (access == access_public_node)
string = "pub";
else if (access == access_protected_node)
string = "prot";
else if (access == access_private_node)
string = "priv";
else
abort ();
dump_string (di, string);
queue_and_dump_index (di, "binf", base, DUMP_BINFO);
}
goto done;
}

View file

@ -1,6 +1,6 @@
/* Front-end tree definitions for GNU compiler.
Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002 Free Software Foundation, Inc.
2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC.
@ -192,15 +192,11 @@ struct tree_common GTY(())
INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST
TREE_PUBLIC in
VAR_DECL or FUNCTION_DECL or IDENTIFIER_NODE
TREE_VIA_PUBLIC in
TREE_LIST or TREE_VEC
EXPR_WFL_EMIT_LINE_NOTE in
EXPR_WITH_FILE_LOCATION
private_flag:
TREE_VIA_PRIVATE in
TREE_LIST or TREE_VEC
TREE_PRIVATE in
..._DECL
CALL_EXPR_HAS_RETURN_SLOT_ADDR in
@ -208,9 +204,6 @@ struct tree_common GTY(())
protected_flag:
TREE_VIA_PROTECTED in
TREE_LIST
TREE_VEC
TREE_PROTECTED in
BLOCK
..._DECL
@ -565,20 +558,6 @@ extern void tree_vec_elt_check_failed PARAMS ((int, int, const char *,
for this name in an inner scope. */
#define TREE_PUBLIC(NODE) ((NODE)->common.public_flag)
/* Nonzero for TREE_LIST or TREE_VEC node means that the path to the
base class is via a `public' declaration, which preserves public
fields from the base class as public. */
#define TREE_VIA_PUBLIC(NODE) ((NODE)->common.public_flag)
/* Ditto, for `private' declarations. */
#define TREE_VIA_PRIVATE(NODE) ((NODE)->common.private_flag)
/* Nonzero for TREE_LIST or TREE_VEC node means that the path to the
base class is via a `protected' declaration, which preserves
protected fields from the base class as protected.
OVERLOADED. */
#define TREE_VIA_PROTECTED(NODE) ((NODE)->common.protected_flag)
/* In any expression, nonzero means it has side effects or reevaluation
of the whole expression could produce a different value.
This is set if any subexpression is a function call, a side effect
@ -1362,7 +1341,16 @@ struct tree_type GTY(())
vtable where the offset to the virtual base can be found. */
#define BINFO_VPTR_FIELD(NODE) TREE_VEC_ELT (NODE, 5)
#define BINFO_ELTS 6
/* 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_VEC_ELT ((NODE), 6)
#define BINFO_BASEACCESS(NODE,N) TREE_VEC_ELT (BINFO_BASEACCESSES(NODE), (N))
/* Number of language independent elements in a binfo. Languages may
add additional trailing elements. */
#define BINFO_ELTS 7
/* 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,
@ -2028,6 +2016,11 @@ extern GTY(()) tree global_trees[TI_MAX];
#define bitsize_one_node global_trees[TI_BITSIZE_ONE]
#define bitsize_unit_node global_trees[TI_BITSIZE_UNIT]
/* Base access nodes. */
#define access_public_node NULL_TREE
#define access_protected_node size_zero_node
#define access_private_node size_one_node
#define null_pointer_node global_trees[TI_NULL_POINTER]
#define float_type_node global_trees[TI_FLOAT_TYPE]