tree.h (TREE_VIA_VIRTUAL): Rename to ...

* tree.h (TREE_VIA_VIRTUAL): Rename to ...
	(BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only.
	(BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags.
	* dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P.
	* dwarf2out.c (add_data_member_location_attribute): Likewise.
	(gen_inheritance_die): Likewise.
	* tree-dump.c (deque_and_dump): Likewise.
	* doc/c-tree.texi (Binfos): Add under reconstruction note.

	* cp/cp-tree.h (BINFO_MARKED): Remove.
	(BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED,
	BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P,
	BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n.
	(SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P.
	* cp/class.c (build_base_path): Use BINFO_VIRTUAL_P.
	(mark_primary_bases, determine_primary_base, base_derived_from,
	dfs_find_final_overrider, dfs_find_final_overrider_q,
	dfs_find_inal_overrider_post, update_vtable_entry_for_fn,
	dfs_modify_vtables, walk_subobject_offsets,
	layout_nonempty_base_or_field, build_base_field,
	build_base_fields, propagate_binfo_offsets, layout_virtual_bases,
	end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable,
	finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits,
	build_ctor_vtbl_group, accumulate_vtble_inits,
	dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries,
	build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r,
	add_vcall_offset_vtbl_entries_1): Likewise.
	* cp/decl.c (xref_basetypes): Incomming virtual base indicated by
	TREE_TYPE. Adjust.
	* cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P.
	* cp/init.c (finish_init_stmts, sort_mem_initializers,
	emit_mem_initializers, build_vtble_address, expand_member_init,
	push_base_cleanups): Likewise.
	* cp/method.c (do_build_copy_constructor): Likewise.
	* cp/pt.c (instantiate_class_template,
	get_template_base_recursive): Likewise.
	* cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init,
	get_pseudo_ti_desc): Likewise.
	* cp/search.c (lookup_base_r, dynamic_cast_base_recurse,
	binfo_from_vbase, binfo_via_virtual, copied_binfo,
	original_binfo): Likewise.
	* cp/semantics.c (finish_base_specifier): Virtualness is indicated
	by TREE_TYPE.
	* cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P.

	* java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1.
	* java/class.c (add_interface_do): Use BINFO_VIRTUAL_P.

From-SVN: r84148
This commit is contained in:
Nathan Sidwell 2004-07-06 08:51:32 +00:00
parent a95d27c83b
commit 809e3e7fec
21 changed files with 165 additions and 113 deletions

View File

@ -1,3 +1,14 @@
2004-07-06 Nathan Sidwell <nathan@codesourcery.com>
* tree.h (TREE_VIA_VIRTUAL): Rename to ...
(BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only.
(BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags.
* dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P.
* dwarf2out.c (add_data_member_location_attribute): Likewise.
(gen_inheritance_die): Likewise.
* tree-dump.c (deque_and_dump): Likewise.
* doc/c-tree.texi (Binfos): Add under reconstruction note.
2004-07-06 Steven Bosscher <stevenb@suse.de> 2004-07-06 Steven Bosscher <stevenb@suse.de>
* config/mcore/mcore.c (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE): * config/mcore/mcore.c (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE):

View File

@ -1,3 +1,41 @@
2004-07-06 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (BINFO_MARKED): Remove.
(BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED,
BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P,
BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n.
(SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P.
* class.c (build_base_path): Use BINFO_VIRTUAL_P.
(mark_primary_bases, determine_primary_base, base_derived_from,
dfs_find_final_overrider, dfs_find_final_overrider_q,
dfs_find_inal_overrider_post, update_vtable_entry_for_fn,
dfs_modify_vtables, walk_subobject_offsets,
layout_nonempty_base_or_field, build_base_field,
build_base_fields, propagate_binfo_offsets, layout_virtual_bases,
end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable,
finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits,
build_ctor_vtbl_group, accumulate_vtble_inits,
dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries,
build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r,
add_vcall_offset_vtbl_entries_1): Likewise.
* decl.c (xref_basetypes): Incomming virtual base indicated by
TREE_TYPE. Adjust.
* dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P.
* init.c (finish_init_stmts, sort_mem_initializers,
emit_mem_initializers, build_vtble_address, expand_member_init,
push_base_cleanups): Likewise.
* method.c (do_build_copy_constructor): Likewise.
* pt.c (instantiate_class_template,
get_template_base_recursive): Likewise.
* rtti.c (dfs_class_hint_mark, get_pseudo_ti_init,
get_pseudo_ti_desc): Likewise.
* search.c (lookup_base_r, dynamic_cast_base_recurse,
binfo_from_vbase, binfo_via_virtual, copied_binfo,
original_binfo): Likewise.
* semantics.c (finish_base_specifier): Virtualness is indicated
by TREE_TYPE.
* tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P.
2004-07-06 Mark Mitchell <mark@codesourcery.com> 2004-07-06 Mark Mitchell <mark@codesourcery.com>
Revert: Revert:

View File

@ -264,7 +264,7 @@ build_base_path (enum tree_code code,
d_binfo = probe; d_binfo = probe;
if (is_empty_class (BINFO_TYPE (probe))) if (is_empty_class (BINFO_TYPE (probe)))
has_empty = true; has_empty = true;
if (!v_binfo && TREE_VIA_VIRTUAL (probe)) if (!v_binfo && BINFO_VIRTUAL_P (probe))
v_binfo = probe; v_binfo = probe;
} }
@ -1257,7 +1257,7 @@ check_bases (tree t,
basetype); basetype);
} }
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
/* A virtual base does not effect nearly emptiness. */ /* A virtual base does not effect nearly emptiness. */
; ;
else if (CLASSTYPE_NEARLY_EMPTY_P (basetype)) else if (CLASSTYPE_NEARLY_EMPTY_P (basetype))
@ -1312,7 +1312,7 @@ mark_primary_bases (tree type)
/* A virtual binfo might have been copied from within /* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a primary another hierarchy. As we're about to use it as a primary
base, make sure the offsets match. */ base, make sure the offsets match. */
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
{ {
tree delta = size_diffop (convert (ssizetype, tree delta = size_diffop (convert (ssizetype,
BINFO_OFFSET (binfo)), BINFO_OFFSET (binfo)),
@ -1363,7 +1363,7 @@ determine_primary_base (tree t)
{ {
/* We prefer a non-virtual base, although a virtual one will /* We prefer a non-virtual base, although a virtual one will
do. */ do. */
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
continue; continue;
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
@ -1380,7 +1380,7 @@ determine_primary_base (tree t)
vfields; vfields;
vfields = TREE_CHAIN (vfields)) vfields = TREE_CHAIN (vfields))
if (VF_BINFO_VALUE (vfields) == NULL_TREE if (VF_BINFO_VALUE (vfields) == NULL_TREE
|| ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields))) || ! BINFO_VIRTUAL_P (VF_BINFO_VALUE (vfields)))
CLASSTYPE_VFIELDS (t) CLASSTYPE_VFIELDS (t)
= tree_cons (base_binfo, = tree_cons (base_binfo,
VF_BASETYPE_VALUE (vfields), VF_BASETYPE_VALUE (vfields),
@ -1444,7 +1444,7 @@ determine_primary_base (tree t)
{ {
tree basetype = BINFO_TYPE (base_binfo); tree basetype = BINFO_TYPE (base_binfo);
if (TREE_VIA_VIRTUAL (base_binfo) if (BINFO_VIRTUAL_P (base_binfo)
&& CLASSTYPE_NEARLY_EMPTY_P (basetype)) && CLASSTYPE_NEARLY_EMPTY_P (basetype))
{ {
/* If this is not an indirect primary base, then it's /* If this is not an indirect primary base, then it's
@ -1916,7 +1916,7 @@ base_derived_from (tree derived, tree base)
{ {
if (probe == derived) if (probe == derived)
return true; return true;
else if (TREE_VIA_VIRTUAL (probe)) else if (BINFO_VIRTUAL_P (probe))
/* If we meet a virtual base, we can't follow the inheritance /* If we meet a virtual base, we can't follow the inheritance
any more. See if the complete type of DERIVED contains any more. See if the complete type of DERIVED contains
such a virtual base. */ such a virtual base. */
@ -1959,7 +1959,7 @@ dfs_find_final_overrider (tree binfo, void* data)
path = tree_cons (NULL_TREE, probe, path); path = tree_cons (NULL_TREE, probe, path);
if (same_type_p (BINFO_TYPE (probe), ffod->most_derived_type)) if (same_type_p (BINFO_TYPE (probe), ffod->most_derived_type))
break; break;
if (TREE_VIA_VIRTUAL (probe)) if (BINFO_VIRTUAL_P (probe))
{ {
probe = TREE_VALUE (vpath); probe = TREE_VALUE (vpath);
vpath = TREE_CHAIN (vpath); vpath = TREE_CHAIN (vpath);
@ -2008,7 +2008,7 @@ dfs_find_final_overrider_q (tree derived, int ix, void *data)
tree binfo = BINFO_BASETYPE (derived, ix); tree binfo = BINFO_BASETYPE (derived, ix);
find_final_overrider_data *ffod = (find_final_overrider_data *) data; find_final_overrider_data *ffod = (find_final_overrider_data *) data;
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
ffod->vpath = tree_cons (NULL_TREE, derived, ffod->vpath); ffod->vpath = tree_cons (NULL_TREE, derived, ffod->vpath);
return binfo; return binfo;
@ -2019,7 +2019,7 @@ dfs_find_final_overrider_post (tree binfo, void *data)
{ {
find_final_overrider_data *ffod = (find_final_overrider_data *) data; find_final_overrider_data *ffod = (find_final_overrider_data *) data;
if (TREE_VIA_VIRTUAL (binfo) && TREE_CHAIN (ffod->vpath)) if (BINFO_VIRTUAL_P (binfo) && TREE_CHAIN (ffod->vpath))
ffod->vpath = TREE_CHAIN (ffod->vpath); ffod->vpath = TREE_CHAIN (ffod->vpath);
return NULL_TREE; return NULL_TREE;
@ -2188,7 +2188,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
{ {
/* We convert via virtual base. Find the virtual /* We convert via virtual base. Find the virtual
base and adjust the fixed offset to be from there. */ base and adjust the fixed offset to be from there. */
while (!TREE_VIA_VIRTUAL (thunk_binfo)) while (!BINFO_VIRTUAL_P (thunk_binfo))
thunk_binfo = BINFO_INHERITANCE_CHAIN (thunk_binfo); thunk_binfo = BINFO_INHERITANCE_CHAIN (thunk_binfo);
virtual_offset = thunk_binfo; virtual_offset = thunk_binfo;
@ -2233,7 +2233,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
/* If we find a virtual base, and we haven't yet found the /* If we find a virtual base, and we haven't yet found the
overrider, then there is a virtual base between the overrider, then there is a virtual base between the
declaring base (first_defn) and the final overrider. */ declaring base (first_defn) and the final overrider. */
if (TREE_VIA_VIRTUAL (b)) if (BINFO_VIRTUAL_P (b))
{ {
virtual_base = b; virtual_base = b;
break; break;
@ -2260,7 +2260,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
while ((probe = get_primary_binfo (probe)) while ((probe = get_primary_binfo (probe))
&& (unsigned) list_length (BINFO_VIRTUALS (probe)) > ix) && (unsigned) list_length (BINFO_VIRTUALS (probe)) > ix)
if (TREE_VIA_VIRTUAL (probe)) if (BINFO_VIRTUAL_P (probe))
virtual_base = probe; virtual_base = probe;
if (virtual_base) if (virtual_base)
@ -2309,7 +2309,7 @@ dfs_modify_vtables (tree binfo, void* data)
primary base; we're not going to use that vtable anyhow. primary base; we're not going to use that vtable anyhow.
We do still need to do this for virtual primary bases, as they We do still need to do this for virtual primary bases, as they
could become non-primary in a construction vtable. */ could become non-primary in a construction vtable. */
(!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo)) (!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo))
/* Similarly, a base without a vtable needs no modification. */ /* Similarly, a base without a vtable needs no modification. */
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
{ {
@ -3273,11 +3273,11 @@ walk_subobject_offsets (tree type,
binfo = BINFO_BASETYPE (type_binfo, i); binfo = BINFO_BASETYPE (type_binfo, i);
if (abi_version_at_least (2) if (abi_version_at_least (2)
&& TREE_VIA_VIRTUAL (binfo)) && BINFO_VIRTUAL_P (binfo))
continue; continue;
if (!vbases_p if (!vbases_p
&& TREE_VIA_VIRTUAL (binfo) && BINFO_VIRTUAL_P (binfo)
&& !BINFO_PRIMARY_P (binfo)) && !BINFO_PRIMARY_P (binfo))
continue; continue;
@ -3339,7 +3339,7 @@ walk_subobject_offsets (tree type,
above.) */ above.) */
tree vbase = get_primary_binfo (type_binfo); tree vbase = get_primary_binfo (type_binfo);
if (vbase && TREE_VIA_VIRTUAL (vbase) if (vbase && BINFO_VIRTUAL_P (vbase)
&& BINFO_PRIMARY_BASE_OF (vbase) == type_binfo) && BINFO_PRIMARY_BASE_OF (vbase) == type_binfo)
{ {
r = (walk_subobject_offsets r = (walk_subobject_offsets
@ -3517,7 +3517,7 @@ layout_nonempty_base_or_field (record_layout_info rli,
break; break;
/* G++ 3.2 did not check for overlaps when placing a non-empty /* G++ 3.2 did not check for overlaps when placing a non-empty
virtual base. */ virtual base. */
if (!abi_version_at_least (2) && binfo && TREE_VIA_VIRTUAL (binfo)) if (!abi_version_at_least (2) && binfo && BINFO_VIRTUAL_P (binfo))
break; break;
if (layout_conflict_p (field_p ? type : binfo, offset, if (layout_conflict_p (field_p ? type : binfo, offset,
offsets, field_p)) offsets, field_p))
@ -3679,7 +3679,7 @@ build_base_field (record_layout_info rli, tree binfo,
atend = layout_empty_base (binfo, eoc, offsets); atend = layout_empty_base (binfo, eoc, offsets);
/* A nearly-empty class "has no proper base class that is empty, /* A nearly-empty class "has no proper base class that is empty,
not morally virtual, and at an offset other than zero." */ not morally virtual, and at an offset other than zero." */
if (!TREE_VIA_VIRTUAL (binfo) && CLASSTYPE_NEARLY_EMPTY_P (t)) if (!BINFO_VIRTUAL_P (binfo) && CLASSTYPE_NEARLY_EMPTY_P (t))
{ {
if (atend) if (atend)
CLASSTYPE_NEARLY_EMPTY_P (t) = 0; CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
@ -3757,7 +3757,7 @@ build_base_fields (record_layout_info rli,
/* Virtual bases are added at the end (a primary virtual base /* Virtual bases are added at the end (a primary virtual base
will have already been added). */ will have already been added). */
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
continue; continue;
next_field = build_base_field (rli, base_binfo, next_field = build_base_field (rli, base_binfo,
@ -4387,7 +4387,7 @@ propagate_binfo_offsets (tree binfo, tree offset)
} }
/* Skip virtual bases that aren't our canonical primary base. */ /* Skip virtual bases that aren't our canonical primary base. */
if (TREE_VIA_VIRTUAL (base_binfo) if (BINFO_VIRTUAL_P (base_binfo)
&& BINFO_PRIMARY_BASE_OF (base_binfo) != binfo) && BINFO_PRIMARY_BASE_OF (base_binfo) != binfo)
continue; continue;
@ -4436,7 +4436,7 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
allocated in inheritance graph order. */ allocated in inheritance graph order. */
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase)) for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{ {
if (!TREE_VIA_VIRTUAL (vbase)) if (!BINFO_VIRTUAL_P (vbase))
continue; continue;
if (!BINFO_PRIMARY_P (vbase)) if (!BINFO_PRIMARY_P (vbase))
@ -4507,7 +4507,7 @@ end_of_class (tree t, int include_virtuals_p)
binfo = BINFO_BASETYPE (TYPE_BINFO (t), i); binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
if (!include_virtuals_p if (!include_virtuals_p
&& TREE_VIA_VIRTUAL (binfo) && BINFO_VIRTUAL_P (binfo)
&& BINFO_PRIMARY_BASE_OF (binfo) != TYPE_BINFO (t)) && BINFO_PRIMARY_BASE_OF (binfo) != TYPE_BINFO (t))
continue; continue;
@ -6257,7 +6257,7 @@ get_vfield_name (tree type)
while (BINFO_BASETYPES (binfo) while (BINFO_BASETYPES (binfo)
&& TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0))) && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0)))
&& ! TREE_VIA_VIRTUAL (BINFO_BASETYPE (binfo, 0))) && ! BINFO_VIRTUAL_P (BINFO_BASETYPE (binfo, 0)))
binfo = BINFO_BASETYPE (binfo, 0); binfo = BINFO_BASETYPE (binfo, 0);
type = BINFO_TYPE (binfo); type = BINFO_TYPE (binfo);
@ -6525,7 +6525,7 @@ dump_class_hierarchy_r (FILE *stream,
fprintf (stream, " empty"); fprintf (stream, " empty");
else if (CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (binfo))) else if (CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (binfo)))
fprintf (stream, " nearly-empty"); fprintf (stream, " nearly-empty");
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
fprintf (stream, " virtual"); fprintf (stream, " virtual");
fprintf (stream, "\n"); fprintf (stream, "\n");
@ -6680,7 +6680,7 @@ dump_vtable (tree t, tree binfo, tree vtable)
type_as_string (binfo, TFF_PLAIN_IDENTIFIER)); type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
if (ctor_vtbl_p) if (ctor_vtbl_p)
{ {
if (!TREE_VIA_VIRTUAL (binfo)) if (!BINFO_VIRTUAL_P (binfo))
fprintf (stream, " (0x%lx instance)", (unsigned long)binfo); fprintf (stream, " (0x%lx instance)", (unsigned long)binfo);
fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER)); fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER));
} }
@ -6777,7 +6777,7 @@ finish_vtbls (tree t)
/* Then come the virtual bases, also in inheritance graph order. */ /* Then come the virtual bases, also in inheritance graph order. */
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase)) for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{ {
if (!TREE_VIA_VIRTUAL (vbase)) if (!BINFO_VIRTUAL_P (vbase))
continue; continue;
accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list); accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
} }
@ -6928,7 +6928,7 @@ build_vtt_inits (tree binfo, tree t, tree* inits, tree* index)
for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i) for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
{ {
b = BINFO_BASETYPE (binfo, i); b = BINFO_BASETYPE (binfo, i);
if (!TREE_VIA_VIRTUAL (b)) if (!BINFO_VIRTUAL_P (b))
inits = build_vtt_inits (BINFO_BASETYPE (binfo, i), t, inits = build_vtt_inits (BINFO_BASETYPE (binfo, i), t,
inits, index); inits, index);
} }
@ -6967,7 +6967,7 @@ build_vtt_inits (tree binfo, tree t, tree* inits, tree* index)
if (top_level_p) if (top_level_p)
for (b = TYPE_BINFO (BINFO_TYPE (binfo)); b; b = TREE_CHAIN (b)) for (b = TYPE_BINFO (BINFO_TYPE (binfo)); b; b = TREE_CHAIN (b))
{ {
if (!TREE_VIA_VIRTUAL (b)) if (!BINFO_VIRTUAL_P (b))
continue; continue;
inits = build_vtt_inits (b, t, inits, index); inits = build_vtt_inits (b, t, inits, index);
@ -7016,7 +7016,7 @@ dfs_build_secondary_vptr_vtt_inits (tree binfo, void *data)
return NULL_TREE; return NULL_TREE;
/* We're not interested in non-virtual primary bases. */ /* We're not interested in non-virtual primary bases. */
if (!TREE_VIA_VIRTUAL (binfo) && BINFO_PRIMARY_P (binfo)) if (!BINFO_VIRTUAL_P (binfo) && BINFO_PRIMARY_P (binfo))
return NULL_TREE; return NULL_TREE;
/* If BINFO has virtual bases or is reachable via a virtual path /* If BINFO has virtual bases or is reachable via a virtual path
@ -7036,7 +7036,7 @@ dfs_build_secondary_vptr_vtt_inits (tree binfo, void *data)
TYPE_SIZE_UNIT (ptr_type_node)); TYPE_SIZE_UNIT (ptr_type_node));
/* Add the initializer for the secondary vptr itself. */ /* Add the initializer for the secondary vptr itself. */
if (top_level_p && TREE_VIA_VIRTUAL (binfo)) if (top_level_p && BINFO_VIRTUAL_P (binfo))
{ {
/* It's a primary virtual base, and this is not the construction /* It's a primary virtual base, and this is not the construction
vtable. Find the base this is primary of in the inheritance graph, vtable. Find the base this is primary of in the inheritance graph,
@ -7126,7 +7126,7 @@ build_ctor_vtbl_group (tree binfo, tree t)
{ {
tree b; tree b;
if (!TREE_VIA_VIRTUAL (vbase)) if (!BINFO_VIRTUAL_P (vbase))
continue; continue;
b = copied_binfo (vbase, binfo); b = copied_binfo (vbase, binfo);
@ -7196,7 +7196,7 @@ accumulate_vtbl_inits (tree binfo,
tree base_binfo = BINFO_BASETYPE (binfo, i); tree base_binfo = BINFO_BASETYPE (binfo, i);
/* Skip virtual bases. */ /* Skip virtual bases. */
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
continue; continue;
accumulate_vtbl_inits (base_binfo, accumulate_vtbl_inits (base_binfo,
BINFO_BASETYPE (orig_binfo, i), BINFO_BASETYPE (orig_binfo, i),
@ -7220,7 +7220,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t); int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
if (ctor_vtbl_p if (ctor_vtbl_p
&& TREE_VIA_VIRTUAL (orig_binfo) && BINFO_PRIMARY_P (orig_binfo)) && BINFO_VIRTUAL_P (orig_binfo) && BINFO_PRIMARY_P (orig_binfo))
{ {
/* In the hierarchy of BINFO_TYPE (RTTI_BINFO), this is a /* In the hierarchy of BINFO_TYPE (RTTI_BINFO), this is a
primary virtual base. If it is not the same primary in primary virtual base. If it is not the same primary in
@ -7245,14 +7245,14 @@ dfs_accumulate_vtbl_inits (tree binfo,
for (; b; b = BINFO_PRIMARY_BASE_OF (b)) for (; b; b = BINFO_PRIMARY_BASE_OF (b))
{ {
last = b; last = b;
if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo) if (BINFO_VIRTUAL_P (b) || b == rtti_binfo)
break; break;
} }
/* If we run out of primary links, keep looking down our /* If we run out of primary links, keep looking down our
inheritance chain; we might be an indirect primary. */ inheritance chain; we might be an indirect primary. */
if (b == NULL_TREE) if (b == NULL_TREE)
for (b = last; b; b = BINFO_INHERITANCE_CHAIN (b)) for (b = last; b; b = BINFO_INHERITANCE_CHAIN (b))
if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo) if (BINFO_VIRTUAL_P (b) || b == rtti_binfo)
break; break;
/* If we found RTTI_BINFO, this is case 1. If we found a virtual /* If we found RTTI_BINFO, this is case 1. If we found a virtual
@ -7297,7 +7297,7 @@ dfs_accumulate_vtbl_inits (tree binfo,
So, we make a TREE_LIST. Later, dfs_fixup_binfo_vtbls will So, we make a TREE_LIST. Later, dfs_fixup_binfo_vtbls will
straighten this out. */ straighten this out. */
BINFO_VTABLE (binfo) = tree_cons (rtti_binfo, vtbl, BINFO_VTABLE (binfo)); BINFO_VTABLE (binfo) = tree_cons (rtti_binfo, vtbl, BINFO_VTABLE (binfo));
else if (BINFO_PRIMARY_P (binfo) && TREE_VIA_VIRTUAL (binfo)) else if (BINFO_PRIMARY_P (binfo) && BINFO_VIRTUAL_P (binfo))
inits = NULL_TREE; inits = NULL_TREE;
else else
/* For an ordinary vtable, set BINFO_VTABLE. */ /* For an ordinary vtable, set BINFO_VTABLE. */
@ -7551,7 +7551,7 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
base (possibly multi-level) of vid->binfo, or we wouldn't base (possibly multi-level) of vid->binfo, or we wouldn't
have called build_vcall_and_vbase_vtbl_entries for it. But it have called build_vcall_and_vbase_vtbl_entries for it. But it
might be a lost primary, so just skip down to vid->binfo. */ might be a lost primary, so just skip down to vid->binfo. */
if (TREE_VIA_VIRTUAL (non_primary_binfo)) if (BINFO_VIRTUAL_P (non_primary_binfo))
{ {
non_primary_binfo = vid->binfo; non_primary_binfo = vid->binfo;
break; break;
@ -7571,7 +7571,7 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
tree b; tree b;
tree delta; tree delta;
if (!TREE_VIA_VIRTUAL (vbase)) if (!BINFO_VIRTUAL_P (vbase))
continue; continue;
/* Find the instance of this virtual base in the complete /* Find the instance of this virtual base in the complete
@ -7629,7 +7629,7 @@ build_vcall_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
/* We only need these entries if this base is a virtual base. We /* We only need these entries if this base is a virtual base. We
compute the indices -- but do not add to the vtable -- when compute the indices -- but do not add to the vtable -- when
building the main vtable for a class. */ building the main vtable for a class. */
if (TREE_VIA_VIRTUAL (binfo) || binfo == TYPE_BINFO (vid->derived)) if (BINFO_VIRTUAL_P (binfo) || binfo == TYPE_BINFO (vid->derived))
{ {
/* We need a vcall offset for each of the virtual functions in this /* We need a vcall offset for each of the virtual functions in this
vtable. For example: vtable. For example:
@ -7652,7 +7652,7 @@ build_vcall_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
vid->vbase = binfo; vid->vbase = binfo;
/* If we are just computing the vcall indices -- but do not need /* If we are just computing the vcall indices -- but do not need
the actual entries -- not that. */ the actual entries -- not that. */
if (!TREE_VIA_VIRTUAL (binfo)) if (!BINFO_VIRTUAL_P (binfo))
vid->generate_vcall_entries = false; vid->generate_vcall_entries = false;
/* Now, walk through the non-virtual bases, adding vcall offsets. */ /* Now, walk through the non-virtual bases, adding vcall offsets. */
add_vcall_offset_vtbl_entries_r (binfo, vid); add_vcall_offset_vtbl_entries_r (binfo, vid);
@ -7671,7 +7671,7 @@ add_vcall_offset_vtbl_entries_r (tree binfo, vtbl_init_data* vid)
virtual base for which we are building vcall offsets. Any virtual base for which we are building vcall offsets. Any
primary virtual base will have already had its offsets generated primary virtual base will have already had its offsets generated
through the recursion in build_vcall_and_vbase_vtbl_entries. */ through the recursion in build_vcall_and_vbase_vtbl_entries. */
if (TREE_VIA_VIRTUAL (binfo) && vid->vbase != binfo) if (BINFO_VIRTUAL_P (binfo) && vid->vbase != binfo)
return; return;
/* If BINFO has a primary base, process it first. */ /* If BINFO has a primary base, process it first. */
@ -7734,7 +7734,7 @@ add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid)
base (possibly multi-level) of vid->binfo, or we wouldn't base (possibly multi-level) of vid->binfo, or we wouldn't
have called build_vcall_and_vbase_vtbl_entries for it. But it have called build_vcall_and_vbase_vtbl_entries for it. But it
might be a lost primary, so just skip down to vid->binfo. */ might be a lost primary, so just skip down to vid->binfo. */
if (TREE_VIA_VIRTUAL (non_primary_binfo)) if (BINFO_VIRTUAL_P (non_primary_binfo))
{ {
if (non_primary_binfo != vid->vbase) if (non_primary_binfo != vid->vbase)
abort (); abort ();

View File

@ -31,12 +31,10 @@ Boston, MA 02111-1307, USA. */
#include "varray.h" #include "varray.h"
#include "c-common.h" #include "c-common.h"
#include "name-lookup.h" #include "name-lookup.h"
struct diagnostic_context; struct diagnostic_context;
/* Usage of TREE_LANG_FLAG_?: /* Usage of TREE_LANG_FLAG_?:
0: BINFO_MARKED (BINFO nodes). 0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
IDENTIFIER_MARKED (IDENTIFIER_NODEs)
NEW_EXPR_USE_GLOBAL (in NEW_EXPR). NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR). DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR). COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
@ -57,24 +55,19 @@ struct diagnostic_context;
(TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out). (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE). TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
ICS_ELLIPSIS_FLAG (in _CONV) ICS_ELLIPSIS_FLAG (in _CONV)
BINFO_DEPENDENT_BASE_P (in BINFO)
DECL_INITIALIZED_P (in VAR_DECL) DECL_INITIALIZED_P (in VAR_DECL)
2: IDENTIFIER_OPNAME_P. 2: IDENTIFIER_OPNAME_P.
TYPE_POLYMORPHIC_P (in _TYPE) TYPE_POLYMORPHIC_P (in _TYPE)
ICS_THIS_FLAG (in _CONV) ICS_THIS_FLAG (in _CONV)
BINFO_LOST_PRIMARY_P (in BINFO)
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL) DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST) STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE). 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
BINFO_VTABLE_PATH_MARKED.
BINFO_PUSHDECLS_MARKED.
(TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
ICS_BAD_FLAG (in _CONV) ICS_BAD_FLAG (in _CONV)
FN_TRY_BLOCK_P (in TRY_BLOCK) FN_TRY_BLOCK_P (in TRY_BLOCK)
IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE) IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
BIND_EXPR_BODY_BLOCK (in BIND_EXPR) BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
4: BINFO_NEW_VTABLE_MARKED. 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
or FIELD_DECL). or FIELD_DECL).
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE) IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE) 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
@ -111,9 +104,6 @@ struct diagnostic_context;
Usage of language-independent fields in a language-dependent manner: Usage of language-independent fields in a language-dependent manner:
TREE_USED
This field is BINFO_INDIRECT_PRIMARY_P in a BINFO.
TYPE_ALIAS_SET TYPE_ALIAS_SET
This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
forth as a substitute for the mark bits provided in `lang_type'. forth as a substitute for the mark bits provided in `lang_type'.
@ -1401,15 +1391,12 @@ struct lang_type GTY(())
tree.h, this pointer is described as pointing in other tree.h, this pointer is described as pointing in other
direction. The binfos of virtual bases are shared. */ direction. The binfos of virtual bases are shared. */
/* Nonzero means marked by DFS or BFS search. */
#define BINFO_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* Nonzero means that this class is on a path leading to a new vtable. */ /* Nonzero means that this class is on a path leading to a new vtable. */
#define BINFO_VTABLE_PATH_MARKED(NODE) TREE_LANG_FLAG_3 (NODE) #define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE)
/* Nonzero means B (a BINFO) has its own vtable. Any copies will not /* Nonzero means B (a BINFO) has its own vtable. Any copies will not
have this flag set. */ have this flag set. */
#define BINFO_NEW_VTABLE_MARKED(B) (TREE_LANG_FLAG_4 (B)) #define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B))
/* Any subobject that needs a new vtable must have a vptr and must not /* 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 be a non-virtual primary base (since it would then use the vtable from a
@ -1417,16 +1404,14 @@ struct lang_type GTY(())
#define SET_BINFO_NEW_VTABLE_MARKED(B) \ #define SET_BINFO_NEW_VTABLE_MARKED(B) \
(BINFO_NEW_VTABLE_MARKED (B) = 1, \ (BINFO_NEW_VTABLE_MARKED (B) = 1, \
my_friendly_assert (!BINFO_PRIMARY_P (B) \ my_friendly_assert (!BINFO_PRIMARY_P (B) \
|| TREE_VIA_VIRTUAL (B), 20000517), \ || BINFO_VIRTUAL_P (B), 20000517), \
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \ my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
20000517)) 20000517))
/* Nonzero means this class has done dfs_pushdecls. */ /* Nonzero means this class has done dfs_pushdecls. */
#define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE) #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
/* Nonzero if this BINFO is a primary base class. Note, this can be /* Nonzero if this BINFO is a primary base class. */
set for non-canonical virtual bases. For a virtual primary base
you might also need to check whether it is canonical. */
#define BINFO_PRIMARY_P(NODE) \ #define BINFO_PRIMARY_P(NODE) \
(BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE) (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
@ -1451,17 +1436,17 @@ struct lang_type GTY(())
/* Nonzero if this binfo is for a dependent base - one that should not /* Nonzero if this binfo is for a dependent base - one that should not
be searched. */ be searched. */
#define BINFO_DEPENDENT_BASE_P(NODE) TREE_LANG_FLAG_1 (NODE) #define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE)
/* Nonzero if this binfo has lost its primary base binfo (because that /* 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 is a nearly-empty virtual base that has been taken by some other
base in the complete hierarchy. */ base in the complete hierarchy. */
#define BINFO_LOST_PRIMARY_P(NODE) TREE_LANG_FLAG_2 (NODE) #define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE)
/* Nonzero if this binfo is an indirect primary base, i.e. a virtual /* Nonzero if this binfo is an indirect primary base, i.e. a virtual
base that is a primary base of some of other class in the base that is a primary base of some of other class in the
hierarchy. */ hierarchy. */
#define BINFO_INDIRECT_PRIMARY_P(NODE) TREE_USED (NODE) #define BINFO_INDIRECT_PRIMARY_P(NODE) BINFO_FLAG_5 (NODE)
/* Used by various search routines. */ /* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE) #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)

View File

@ -9033,9 +9033,9 @@ xref_tag_from_type (tree old, tree id, int globalize)
/* REF is a type (named NAME), for which we have just seen some /* REF is a type (named NAME), for which we have just seen some
baseclasses. BASE_LIST 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 TREE_PURPOSE is an access_* node, and the TREE_VALUE is the type of
the base-class. TREE_VIA_VIRTUAL indicates virtual the base-class. Non-NULL TREE_TYPE indicates virtual inheritance.
inheritance. CODE_TYPE_NODE indicates whether REF is a class, CODE_TYPE_NODE indicates whether REF is a class, struct, or
struct, or union. */ union. */
void void
xref_basetypes (tree ref, tree base_list) xref_basetypes (tree ref, tree base_list)
@ -9088,7 +9088,7 @@ xref_basetypes (tree ref, tree base_list)
for (i = 0; base_list; base_list = TREE_CHAIN (base_list)) for (i = 0; base_list; base_list = TREE_CHAIN (base_list))
{ {
tree access = TREE_PURPOSE (base_list); tree access = TREE_PURPOSE (base_list);
int via_virtual = TREE_VIA_VIRTUAL (base_list); int via_virtual = TREE_TYPE (base_list) != NULL_TREE;
tree basetype = TREE_VALUE (base_list); tree basetype = TREE_VALUE (base_list);
tree base_binfo; tree base_binfo;
@ -9141,7 +9141,7 @@ xref_basetypes (tree ref, tree base_list)
TREE_VEC_ELT (accesses, i) = access; TREE_VEC_ELT (accesses, i) = access;
/* This flag will be in the binfo of the base type, we must /* This flag will be in the binfo of the base type, we must
clear it after copying the base binfos. */ clear it after copying the base binfos. */
TREE_VIA_VIRTUAL (base_binfo) = via_virtual; BINFO_VIRTUAL_P (base_binfo) = via_virtual;
SET_CLASSTYPE_MARKED (basetype); SET_CLASSTYPE_MARKED (basetype);
@ -9211,7 +9211,7 @@ xref_basetypes (tree ref, tree base_list)
CLEAR_CLASSTYPE_MARKED (basetype); CLEAR_CLASSTYPE_MARKED (basetype);
if (CLASS_TYPE_P (basetype)) if (CLASS_TYPE_P (basetype))
{ {
TREE_VIA_VIRTUAL (TYPE_BINFO (basetype)) = 0; BINFO_VIRTUAL_P (TYPE_BINFO (basetype)) = 0;
BINFO_DEPENDENT_BASE_P (TYPE_BINFO (basetype)) = 0; BINFO_DEPENDENT_BASE_P (TYPE_BINFO (basetype)) = 0;
} }
} }

View File

@ -272,7 +272,7 @@ cp_dump_tree (void* dump_info, tree t)
{ {
tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i); tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
dump_child ("base", BINFO_TYPE (base_binfo)); dump_child ("base", BINFO_TYPE (base_binfo));
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
dump_string (di, "virtual"); dump_string (di, "virtual");
dump_access (di, base_binfo); dump_access (di, base_binfo);
} }

View File

@ -101,7 +101,7 @@ finish_init_stmts (bool is_global, tree stmt_expr, tree compound_stmt)
static tree static tree
dfs_initialize_vtbl_ptrs (tree binfo, void *data) dfs_initialize_vtbl_ptrs (tree binfo, void *data)
{ {
if ((!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo)) if ((!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo))
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
{ {
tree base_ptr = TREE_VALUE ((tree) data); tree base_ptr = TREE_VALUE ((tree) data);
@ -478,7 +478,7 @@ sort_mem_initializers (tree t, tree mem_inits)
for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i) for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
{ {
base = BINFO_BASETYPE (TYPE_BINFO (t), i); base = BINFO_BASETYPE (TYPE_BINFO (t), i);
if (!TREE_VIA_VIRTUAL (base)) if (!BINFO_VIRTUAL_P (base))
sorted_inits = tree_cons (base, NULL_TREE, sorted_inits); sorted_inits = tree_cons (base, NULL_TREE, sorted_inits);
} }
/* Process the non-static data members. */ /* Process the non-static data members. */
@ -677,7 +677,7 @@ emit_mem_initializers (tree mem_inits)
arguments = NULL_TREE; arguments = NULL_TREE;
/* Initialize the base. */ /* Initialize the base. */
if (TREE_VIA_VIRTUAL (subobject)) if (BINFO_VIRTUAL_P (subobject))
construct_virtual_base (subobject, arguments); construct_virtual_base (subobject, arguments);
else else
{ {
@ -717,7 +717,7 @@ build_vtbl_address (tree binfo)
tree binfo_for = binfo; tree binfo_for = binfo;
tree vtbl; tree vtbl;
if (BINFO_VPTR_INDEX (binfo) && TREE_VIA_VIRTUAL (binfo) if (BINFO_VPTR_INDEX (binfo) && BINFO_VIRTUAL_P (binfo)
&& BINFO_PRIMARY_P (binfo)) && BINFO_PRIMARY_P (binfo))
/* If this is a virtual primary base, then the vtable we want to store /* If this is a virtual primary base, then the vtable we want to store
is that for the base this is being used as the primary base of. We is that for the base this is being used as the primary base of. We
@ -990,7 +990,7 @@ expand_member_init (tree name)
} }
/* Look for a virtual base -- unless the direct base is itself /* Look for a virtual base -- unless the direct base is itself
virtual. */ virtual. */
if (!direct_binfo || !TREE_VIA_VIRTUAL (direct_binfo)) if (!direct_binfo || !BINFO_VIRTUAL_P (direct_binfo))
virtual_binfo = binfo_for_vbase (basetype, current_class_type); virtual_binfo = binfo_for_vbase (basetype, current_class_type);
/* [class.base.init] /* [class.base.init]
@ -2918,7 +2918,7 @@ push_base_cleanups (void)
{ {
tree base_binfo = TREE_VEC_ELT (binfos, i); tree base_binfo = TREE_VEC_ELT (binfos, i);
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo)) if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo))
|| TREE_VIA_VIRTUAL (base_binfo)) || BINFO_VIRTUAL_P (base_binfo))
continue; continue;
expr = build_special_member_call (current_class_ref, expr = build_special_member_call (current_class_ref,

View File

@ -542,7 +542,7 @@ do_build_copy_constructor (tree fndecl)
for (i = 0; i < n_bases; ++i) for (i = 0; i < n_bases; ++i)
{ {
tree binfo = TREE_VEC_ELT (binfos, i); tree binfo = TREE_VEC_ELT (binfos, i);
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
continue; continue;
member_init_list member_init_list

View File

@ -5443,7 +5443,8 @@ instantiate_class_template (tree type)
continue; continue;
base_list = tree_cons (access, base, base_list); base_list = tree_cons (access, base, base_list);
TREE_VIA_VIRTUAL (base_list) = TREE_VIA_VIRTUAL (pbase); if (BINFO_VIRTUAL_P (pbase))
TREE_TYPE (base_list) = integer_type_node;
} }
/* The list is now in reverse order; correct that. */ /* The list is now in reverse order; correct that. */
@ -9408,7 +9409,7 @@ get_template_base_recursive (tree tparms,
continue; continue;
this_virtual = this_virtual =
(flags & GTB_VIA_VIRTUAL) || TREE_VIA_VIRTUAL (base_binfo); (flags & GTB_VIA_VIRTUAL) || BINFO_VIRTUAL_P (base_binfo);
/* When searching for a non-virtual, we cannot mark virtually /* When searching for a non-virtual, we cannot mark virtually
found binfos. */ found binfos. */

View File

@ -909,7 +909,7 @@ dfs_class_hint_mark (tree binfo, void *data)
tree basetype = BINFO_TYPE (binfo); tree basetype = BINFO_TYPE (binfo);
int *hint = (int *) data; int *hint = (int *) data;
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
{ {
if (CLASSTYPE_MARKED (basetype)) if (CLASSTYPE_MARKED (basetype))
*hint |= 1; *hint |= 1;
@ -1062,7 +1062,7 @@ get_pseudo_ti_init (tree type, tree var_desc, bool *non_public_p)
if (TREE_VEC_ELT (base_accesses, ix) == access_public_node) if (TREE_VEC_ELT (base_accesses, ix) == access_public_node)
flags |= 2; flags |= 2;
tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo)); tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
{ {
/* We store the vtable offset at which the virtual /* We store the vtable offset at which the virtual
base offset can be found. */ base offset can be found. */
@ -1200,7 +1200,7 @@ get_pseudo_ti_desc (tree type)
if (num_bases == 1 if (num_bases == 1
&& TREE_VEC_ELT (base_accesses, 0) == access_public_node && TREE_VEC_ELT (base_accesses, 0) == access_public_node
&& !TREE_VIA_VIRTUAL (base_binfo) && !BINFO_VIRTUAL_P (base_binfo)
&& integer_zerop (BINFO_OFFSET (base_binfo))) && integer_zerop (BINFO_OFFSET (base_binfo)))
/* single non-virtual public. */ /* single non-virtual public. */
return si_class_desc_type_node; return si_class_desc_type_node;

View File

@ -197,7 +197,7 @@ lookup_base_r (tree binfo, tree base, base_access access,
bk = lookup_base_r (base_binfo, base, bk = lookup_base_r (base_binfo, base,
access, access,
is_virtual || TREE_VIA_VIRTUAL (base_binfo), is_virtual || BINFO_VIRTUAL_P (base_binfo),
binfo_ptr); binfo_ptr);
switch (bk) switch (bk)
@ -376,7 +376,7 @@ dynamic_cast_base_recurse (tree subtype, tree binfo, bool is_via_virtual,
continue; continue;
rval = dynamic_cast_base_recurse rval = dynamic_cast_base_recurse
(subtype, base_binfo, (subtype, base_binfo,
is_via_virtual || TREE_VIA_VIRTUAL (base_binfo), offset_ptr); is_via_virtual || BINFO_VIRTUAL_P (base_binfo), offset_ptr);
if (worst == -2) if (worst == -2)
worst = rval; worst = rval;
else if (rval >= 0) else if (rval >= 0)
@ -2493,7 +2493,7 @@ binfo_from_vbase (tree binfo)
{ {
for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo)) for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
{ {
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
return binfo; return binfo;
} }
return NULL_TREE; return NULL_TREE;
@ -2509,7 +2509,7 @@ binfo_via_virtual (tree binfo, tree limit)
for (; binfo && (!limit || !same_type_p (BINFO_TYPE (binfo), limit)); for (; binfo && (!limit || !same_type_p (BINFO_TYPE (binfo), limit));
binfo = BINFO_INHERITANCE_CHAIN (binfo)) binfo = BINFO_INHERITANCE_CHAIN (binfo))
{ {
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
return binfo; return binfo;
} }
return NULL_TREE; return NULL_TREE;
@ -2524,7 +2524,7 @@ copied_binfo (tree binfo, tree here)
{ {
tree result = NULL_TREE; tree result = NULL_TREE;
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
{ {
tree t; tree t;
@ -2588,7 +2588,7 @@ original_binfo (tree binfo, tree here)
if (BINFO_TYPE (binfo) == BINFO_TYPE (here)) if (BINFO_TYPE (binfo) == BINFO_TYPE (here))
result = here; result = here;
else if (TREE_VIA_VIRTUAL (binfo)) else if (BINFO_VIRTUAL_P (binfo))
result = (CLASSTYPE_VBASECLASSES (BINFO_TYPE (here)) result = (CLASSTYPE_VBASECLASSES (BINFO_TYPE (here))
? binfo_for_vbase (BINFO_TYPE (binfo), BINFO_TYPE (here)) ? binfo_for_vbase (BINFO_TYPE (binfo), BINFO_TYPE (here))
: NULL_TREE); : NULL_TREE);

View File

@ -2232,7 +2232,8 @@ finish_template_type (tree name, tree args, int entering_scope)
Return a TREE_LIST containing the ACCESS_SPECIFIER and the Return a TREE_LIST containing the ACCESS_SPECIFIER and the
BASE_CLASS, or NULL_TREE if an error occurred. The BASE_CLASS, or NULL_TREE if an error occurred. The
ACCESS_SPECIFIER is one of ACCESS_SPECIFIER is one of
access_{default,public,protected_private}[_virtual]_node.*/ access_{default,public,protected_private}_node. For a virtual base
we set TREE_TYPE. */
tree tree
finish_base_specifier (tree base, tree access, bool virtual_p) finish_base_specifier (tree base, tree access, bool virtual_p)
@ -2254,7 +2255,8 @@ finish_base_specifier (tree base, tree access, bool virtual_p)
base = TYPE_MAIN_VARIANT (base); base = TYPE_MAIN_VARIANT (base);
} }
result = build_tree_list (access, base); result = build_tree_list (access, base);
TREE_VIA_VIRTUAL (result) = virtual_p; if (virtual_p)
TREE_TYPE (result) = integer_type_node;
} }
return result; return result;

View File

@ -612,7 +612,7 @@ copy_base_binfos (tree binfo, tree t, tree prev)
BINFO_INHERITANCE_CHAIN (new_binfo) = binfo; BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
BINFO_DEPENDENT_BASE_P (new_binfo) = 1; BINFO_DEPENDENT_BASE_P (new_binfo) = 1;
} }
else if (TREE_VIA_VIRTUAL (base_binfo)) else if (BINFO_VIRTUAL_P (base_binfo))
new_binfo = binfo_for_vbase (BINFO_TYPE (base_binfo), t); new_binfo = binfo_for_vbase (BINFO_TYPE (base_binfo), t);
if (!new_binfo) if (!new_binfo)
@ -621,10 +621,10 @@ copy_base_binfos (tree binfo, tree t, tree prev)
base_binfo, NULL_TREE, base_binfo, NULL_TREE,
BINFO_VIRTUALS (base_binfo)); BINFO_VIRTUALS (base_binfo));
prev = copy_base_binfos (new_binfo, t, prev); prev = copy_base_binfos (new_binfo, t, prev);
if (TREE_VIA_VIRTUAL (base_binfo)) if (BINFO_VIRTUAL_P (base_binfo))
{ {
VEC_quick_push (tree, CLASSTYPE_VBASECLASSES (t), new_binfo); VEC_quick_push (tree, CLASSTYPE_VBASECLASSES (t), new_binfo);
TREE_VIA_VIRTUAL (new_binfo) = 1; BINFO_VIRTUAL_P (new_binfo) = 1;
BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t); BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t);
} }
else else

View File

@ -1704,12 +1704,12 @@ dbxout_type (tree type, int full)
if (use_gnu_debug_info_extensions) if (use_gnu_debug_info_extensions)
{ {
have_used_extensions = 1; have_used_extensions = 1;
putc (TREE_VIA_VIRTUAL (child) ? '1' : '0', asmfile); putc (BINFO_VIRTUAL_P (child) ? '1' : '0', asmfile);
putc (access == access_public_node ? '2' : putc (access == access_public_node ? '2' :
(access == access_protected_node ? '1' :'0'), (access == access_protected_node ? '1' :'0'),
asmfile); asmfile);
CHARS (2); CHARS (2);
if (TREE_VIA_VIRTUAL (child) if (BINFO_VIRTUAL_P (child)
&& strcmp (lang_hooks.name, "GNU C++") == 0) && strcmp (lang_hooks.name, "GNU C++") == 0)
/* For a virtual base, print the (negative) offset within /* For a virtual base, print the (negative) offset within
the vtable where we must look to find the necessary the vtable where we must look to find the necessary

View File

@ -747,6 +747,8 @@ list. Implicitly declared functions (including default constructors,
copy constructors, assignment operators, and destructors) will appear on copy constructors, assignment operators, and destructors) will appear on
this list as well. this list as well.
@c under reconstruction 2004-07-01, FIXME:Nathan Sidwell
[Binfos are being redesigned, this information is in a state of flux.]
Every class has an associated @dfn{binfo}, which can be obtained with Every class has an associated @dfn{binfo}, which can be obtained with
@code{TYPE_BINFO}. Binfos are used to represent base-classes. The @code{TYPE_BINFO}. Binfos are used to represent base-classes. The
binfo given by @code{TYPE_BINFO} is the degenerate case, whereby every binfo given by @code{TYPE_BINFO} is the degenerate case, whereby every

View File

@ -9471,7 +9471,7 @@ add_data_member_location_attribute (dw_die_ref die, tree decl)
if (TREE_CODE (decl) == TREE_BINFO) if (TREE_CODE (decl) == TREE_BINFO)
{ {
/* We're working on the TAG_inheritance for a base class. */ /* We're working on the TAG_inheritance for a base class. */
if (TREE_VIA_VIRTUAL (decl) && is_cxx ()) if (BINFO_VIRTUAL_P (decl) && is_cxx ())
{ {
/* For C++ virtual bases we can't just use BINFO_OFFSET, as they /* For C++ virtual bases we can't just use BINFO_OFFSET, as they
aren't at a fixed offset from all (sub)objects of the same aren't at a fixed offset from all (sub)objects of the same
@ -11860,7 +11860,7 @@ gen_inheritance_die (tree binfo, tree access, dw_die_ref context_die)
add_type_attribute (die, BINFO_TYPE (binfo), 0, 0, context_die); add_type_attribute (die, BINFO_TYPE (binfo), 0, 0, context_die);
add_data_member_location_attribute (die, binfo); add_data_member_location_attribute (die, binfo);
if (TREE_VIA_VIRTUAL (binfo)) if (BINFO_VIRTUAL_P (binfo))
add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual); add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
if (access == access_public_node) if (access == access_public_node)

View File

@ -1,3 +1,8 @@
2004-07-06 Nathan Sidwell <nathan@codesourcery.com>
* java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1.
* class.c (add_interface_do): Use BINFO_VIRTUAL_P.
2004-07-05 Nathan Sidwell <nathan@codesourcery.com> 2004-07-05 Nathan Sidwell <nathan@codesourcery.com>
* class.c (make_class): Use make_tree_binfo. * class.c (make_class): Use make_tree_binfo.
@ -8167,7 +8172,7 @@
properly initialize `finished_label'. Don't emit gotos for empty properly initialize `finished_label'. Don't emit gotos for empty
try statements. try statements.
2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de> 2000-03-19 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* except.c (emit_handlers): Clear catch_clauses_last. * except.c (emit_handlers): Clear catch_clauses_last.

View File

@ -616,7 +616,7 @@ add_interface_do (tree basetype_vec, tree interface_class, int i)
BINFO_TYPE (interface_binfo) = interface_class; BINFO_TYPE (interface_binfo) = interface_class;
BINFO_OFFSET (interface_binfo) = integer_zero_node; BINFO_OFFSET (interface_binfo) = integer_zero_node;
BINFO_VPTR_FIELD (interface_binfo) = integer_zero_node; BINFO_VPTR_FIELD (interface_binfo) = integer_zero_node;
TREE_VIA_VIRTUAL (interface_binfo) = 1; BINFO_VIRTUAL_P (interface_binfo) = 1;
TREE_VEC_ELT (basetype_vec, i) = interface_binfo; TREE_VEC_ELT (basetype_vec, i) = interface_binfo;
} }

View File

@ -48,8 +48,7 @@ struct JCF;
SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes) SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes)
ANONYMOUS_CLASS_P (in RECORD_TYPE) ANONYMOUS_CLASS_P (in RECORD_TYPE)
ARG_FINAL_P (in TREE_LIST) ARG_FINAL_P (in TREE_LIST)
1: CLASS_HAS_SUPER_FLAG (in TREE_BINFO). 1: IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
COMPOUND_ASSIGN_P (in EXPR (binop_*)) COMPOUND_ASSIGN_P (in EXPR (binop_*))
LOCAL_CLASS_P (in RECORD_TYPE) LOCAL_CLASS_P (in RECORD_TYPE)
BLOCK_IS_IMPLICIT (in BLOCK) BLOCK_IS_IMPLICIT (in BLOCK)
@ -122,7 +121,7 @@ struct JCF;
/* True if the class whose TYPE_BINFO this is has a superclass. /* True if the class whose TYPE_BINFO this is has a superclass.
(True of all classes except Object.) */ (True of all classes except Object.) */
#define CLASS_HAS_SUPER_FLAG(BINFO) TREE_LANG_FLAG_1 (TREE_BINFO_CHECK (BINFO)) #define CLASS_HAS_SUPER_FLAG(BINFO) BINFO_FLAG_1 (BINFO)
#define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE)) #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. */ /* Return the supertype of class TYPE, or NULL_TREE is it has none. */

View File

@ -257,7 +257,7 @@ dequeue_and_dump (dump_info_p di)
dump_child ("type", BINFO_TYPE (t)); dump_child ("type", BINFO_TYPE (t));
if (TREE_VIA_VIRTUAL (t)) if (BINFO_VIRTUAL_P (t))
dump_string (di, "virt"); dump_string (di, "virt");
dump_int (di, "bases", n_bases); dump_int (di, "bases", n_bases);

View File

@ -203,7 +203,7 @@ struct tree_common GTY(())
TREE_STATIC in TREE_STATIC in
VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, ADDR_EXPR VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, ADDR_EXPR
TREE_VIA_VIRTUAL in TREE_VIA_VIRTUAL in
TREE_LIST or TREE_BINFO TREE_BINFO
TREE_CONSTANT_OVERFLOW in TREE_CONSTANT_OVERFLOW in
INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST
TREE_SYMBOL_REFERENCED in TREE_SYMBOL_REFERENCED in
@ -738,11 +738,6 @@ extern void tree_operand_check_failed (int, enum tree_code,
implicitly and should not lead to any sort of warning. */ implicitly and should not lead to any sort of warning. */
#define TREE_NO_WARNING(NODE) ((NODE)->common.nowarning_flag) #define TREE_NO_WARNING(NODE) ((NODE)->common.nowarning_flag)
/* Nonzero for a TREE_LIST or TREE_BINFO node means that the derivation
chain is via a `virtual' declaration. */
#define TREE_VIA_VIRTUAL(NODE) \
(TREE_CHECK2 (NODE, TREE_LIST, TREE_BINFO)->common.static_flag)
/* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST this means /* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST this means
there was an overflow in folding. This is distinct from there was an overflow in folding. This is distinct from
TREE_OVERFLOW because ANSI C requires a diagnostic when overflows TREE_OVERFLOW because ANSI C requires a diagnostic when overflows
@ -1597,6 +1592,20 @@ struct tree_type GTY(())
Thus, given a pointer to class C, one can get a pointer to the binfo Thus, given a pointer to class C, one can get a pointer to the binfo
of D acting as a basetype for C by looking at C's binfo's basetypes. */ of D acting as a basetype for C by looking at C's binfo's basetypes. */
/* BINFO specific flags. */
/* Nonzero means that the derivation chain is via a `virtual' declaration. */
#define BINFO_VIRTUAL_P(NODE) (TREE_BINFO_CHECK (NODE)->common.static_flag)
/* Flags for language dependent use. */
#define BINFO_MARKED(NODE) TREE_LANG_FLAG_0(TREE_BINFO_CHECK(NODE))
#define BINFO_FLAG_1(NODE) TREE_LANG_FLAG_1(TREE_BINFO_CHECK(NODE))
#define BINFO_FLAG_2(NODE) TREE_LANG_FLAG_2(TREE_BINFO_CHECK(NODE))
#define BINFO_FLAG_3(NODE) TREE_LANG_FLAG_3(TREE_BINFO_CHECK(NODE))
#define BINFO_FLAG_4(NODE) TREE_LANG_FLAG_4(TREE_BINFO_CHECK(NODE))
#define BINFO_FLAG_5(NODE) TREE_LANG_FLAG_5(TREE_BINFO_CHECK(NODE))
#define BINFO_FLAG_6(NODE) TREE_LANG_FLAG_6(TREE_BINFO_CHECK(NODE))
/* The actual data type node being inherited in this basetype. */ /* The actual data type node being inherited in this basetype. */
#define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK(NODE)) #define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK(NODE))