* 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
+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>
* config/mcore/mcore.c (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE):
+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>
Revert:
d_binfo = probe;
if (is_empty_class (BINFO_TYPE (probe)))
has_empty = true;
- if (!v_binfo && TREE_VIA_VIRTUAL (probe))
+ if (!v_binfo && BINFO_VIRTUAL_P (probe))
v_binfo = probe;
}
basetype);
}
- if (TREE_VIA_VIRTUAL (base_binfo))
+ if (BINFO_VIRTUAL_P (base_binfo))
/* A virtual base does not effect nearly emptiness. */
;
else if (CLASSTYPE_NEARLY_EMPTY_P (basetype))
/* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a primary
base, make sure the offsets match. */
- if (TREE_VIA_VIRTUAL (base_binfo))
+ if (BINFO_VIRTUAL_P (base_binfo))
{
tree delta = size_diffop (convert (ssizetype,
BINFO_OFFSET (binfo)),
{
/* We prefer a non-virtual base, although a virtual one will
do. */
- if (TREE_VIA_VIRTUAL (base_binfo))
+ if (BINFO_VIRTUAL_P (base_binfo))
continue;
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
vfields;
vfields = TREE_CHAIN (vfields))
if (VF_BINFO_VALUE (vfields) == NULL_TREE
- || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
+ || ! BINFO_VIRTUAL_P (VF_BINFO_VALUE (vfields)))
CLASSTYPE_VFIELDS (t)
= tree_cons (base_binfo,
VF_BASETYPE_VALUE (vfields),
{
tree basetype = BINFO_TYPE (base_binfo);
- if (TREE_VIA_VIRTUAL (base_binfo)
+ if (BINFO_VIRTUAL_P (base_binfo)
&& CLASSTYPE_NEARLY_EMPTY_P (basetype))
{
/* If this is not an indirect primary base, then it's
{
if (probe == derived)
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
any more. See if the complete type of DERIVED contains
such a virtual base. */
path = tree_cons (NULL_TREE, probe, path);
if (same_type_p (BINFO_TYPE (probe), ffod->most_derived_type))
break;
- if (TREE_VIA_VIRTUAL (probe))
+ if (BINFO_VIRTUAL_P (probe))
{
probe = TREE_VALUE (vpath);
vpath = TREE_CHAIN (vpath);
tree binfo = BINFO_BASETYPE (derived, ix);
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);
return binfo;
{
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);
return NULL_TREE;
{
/* We convert via virtual base. Find the virtual
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);
virtual_offset = thunk_binfo;
/* If we find a virtual base, and we haven't yet found the
overrider, then there is a virtual base between the
declaring base (first_defn) and the final overrider. */
- if (TREE_VIA_VIRTUAL (b))
+ if (BINFO_VIRTUAL_P (b))
{
virtual_base = b;
break;
while ((probe = get_primary_binfo (probe))
&& (unsigned) list_length (BINFO_VIRTUALS (probe)) > ix)
- if (TREE_VIA_VIRTUAL (probe))
+ if (BINFO_VIRTUAL_P (probe))
virtual_base = probe;
if (virtual_base)
primary base; we're not going to use that vtable anyhow.
We do still need to do this for virtual primary bases, as they
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. */
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
{
binfo = BINFO_BASETYPE (type_binfo, i);
if (abi_version_at_least (2)
- && TREE_VIA_VIRTUAL (binfo))
+ && BINFO_VIRTUAL_P (binfo))
continue;
if (!vbases_p
- && TREE_VIA_VIRTUAL (binfo)
+ && BINFO_VIRTUAL_P (binfo)
&& !BINFO_PRIMARY_P (binfo))
continue;
above.) */
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)
{
r = (walk_subobject_offsets
break;
/* G++ 3.2 did not check for overlaps when placing a non-empty
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;
if (layout_conflict_p (field_p ? type : binfo, offset,
offsets, field_p))
atend = layout_empty_base (binfo, eoc, offsets);
/* A nearly-empty class "has no proper base class that is empty,
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)
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
/* Virtual bases are added at the end (a primary virtual base
will have already been added). */
- if (TREE_VIA_VIRTUAL (base_binfo))
+ if (BINFO_VIRTUAL_P (base_binfo))
continue;
next_field = build_base_field (rli, base_binfo,
}
/* 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)
continue;
allocated in inheritance graph order. */
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{
- if (!TREE_VIA_VIRTUAL (vbase))
+ if (!BINFO_VIRTUAL_P (vbase))
continue;
if (!BINFO_PRIMARY_P (vbase))
binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
if (!include_virtuals_p
- && TREE_VIA_VIRTUAL (binfo)
+ && BINFO_VIRTUAL_P (binfo)
&& BINFO_PRIMARY_BASE_OF (binfo) != TYPE_BINFO (t))
continue;
while (BINFO_BASETYPES (binfo)
&& 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);
type = BINFO_TYPE (binfo);
fprintf (stream, " empty");
else if (CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (binfo)))
fprintf (stream, " nearly-empty");
- if (TREE_VIA_VIRTUAL (binfo))
+ if (BINFO_VIRTUAL_P (binfo))
fprintf (stream, " virtual");
fprintf (stream, "\n");
type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
if (ctor_vtbl_p)
{
- if (!TREE_VIA_VIRTUAL (binfo))
+ if (!BINFO_VIRTUAL_P (binfo))
fprintf (stream, " (0x%lx instance)", (unsigned long)binfo);
fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER));
}
/* Then come the virtual bases, also in inheritance graph order. */
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
{
- if (!TREE_VIA_VIRTUAL (vbase))
+ if (!BINFO_VIRTUAL_P (vbase))
continue;
accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
}
for (i = 0; i < BINFO_N_BASETYPES (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, index);
}
if (top_level_p)
for (b = TYPE_BINFO (BINFO_TYPE (binfo)); b; b = TREE_CHAIN (b))
{
- if (!TREE_VIA_VIRTUAL (b))
+ if (!BINFO_VIRTUAL_P (b))
continue;
inits = build_vtt_inits (b, t, inits, index);
return NULL_TREE;
/* 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;
/* If BINFO has virtual bases or is reachable via a virtual path
TYPE_SIZE_UNIT (ptr_type_node));
/* 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
vtable. Find the base this is primary of in the inheritance graph,
{
tree b;
- if (!TREE_VIA_VIRTUAL (vbase))
+ if (!BINFO_VIRTUAL_P (vbase))
continue;
b = copied_binfo (vbase, binfo);
tree base_binfo = BINFO_BASETYPE (binfo, i);
/* Skip virtual bases. */
- if (TREE_VIA_VIRTUAL (base_binfo))
+ if (BINFO_VIRTUAL_P (base_binfo))
continue;
accumulate_vtbl_inits (base_binfo,
BINFO_BASETYPE (orig_binfo, i),
int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
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
primary virtual base. If it is not the same primary in
for (; b; b = BINFO_PRIMARY_BASE_OF (b))
{
last = b;
- if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo)
+ if (BINFO_VIRTUAL_P (b) || b == rtti_binfo)
break;
}
/* If we run out of primary links, keep looking down our
inheritance chain; we might be an indirect primary. */
if (b == NULL_TREE)
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;
/* If we found RTTI_BINFO, this is case 1. If we found a virtual
So, we make a TREE_LIST. Later, dfs_fixup_binfo_vtbls will
straighten this out. */
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;
else
/* For an ordinary vtable, set BINFO_VTABLE. */
base (possibly multi-level) of vid->binfo, or we wouldn't
have called build_vcall_and_vbase_vtbl_entries for it. But it
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;
break;
tree b;
tree delta;
- if (!TREE_VIA_VIRTUAL (vbase))
+ if (!BINFO_VIRTUAL_P (vbase))
continue;
/* Find the instance of this virtual base in the complete
/* We only need these entries if this base is a virtual base. We
compute the indices -- but do not add to the vtable -- when
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
vtable. For example:
vid->vbase = binfo;
/* If we are just computing the vcall indices -- but do not need
the actual entries -- not that. */
- if (!TREE_VIA_VIRTUAL (binfo))
+ if (!BINFO_VIRTUAL_P (binfo))
vid->generate_vcall_entries = false;
/* Now, walk through the non-virtual bases, adding vcall offsets. */
add_vcall_offset_vtbl_entries_r (binfo, vid);
virtual base for which we are building vcall offsets. Any
primary virtual base will have already had its offsets generated
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;
/* If BINFO has a primary base, process it first. */
base (possibly multi-level) of vid->binfo, or we wouldn't
have called build_vcall_and_vbase_vtbl_entries for it. But it
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)
abort ();
#include "varray.h"
#include "c-common.h"
#include "name-lookup.h"
-
struct diagnostic_context;
/* Usage of TREE_LANG_FLAG_?:
- 0: BINFO_MARKED (BINFO nodes).
- IDENTIFIER_MARKED (IDENTIFIER_NODEs)
+ 0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
(TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
ICS_ELLIPSIS_FLAG (in _CONV)
- BINFO_DEPENDENT_BASE_P (in BINFO)
DECL_INITIALIZED_P (in VAR_DECL)
2: IDENTIFIER_OPNAME_P.
TYPE_POLYMORPHIC_P (in _TYPE)
ICS_THIS_FLAG (in _CONV)
- BINFO_LOST_PRIMARY_P (in BINFO)
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
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).
ICS_BAD_FLAG (in _CONV)
FN_TRY_BLOCK_P (in TRY_BLOCK)
IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
- 4: BINFO_NEW_VTABLE_MARKED.
- TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
+ 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
or FIELD_DECL).
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
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
This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
forth as a substitute for the mark bits provided in `lang_type'.
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_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_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
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
be a non-virtual primary base (since it would then use the vtable from a
#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), \
+ || BINFO_VIRTUAL_P (B), 20000517), \
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
20000517))
/* Nonzero means this class has done dfs_pushdecls. */
#define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
-/* Nonzero if this BINFO is a primary base class. Note, this can be
- set for non-canonical virtual bases. For a virtual primary base
- you might also need to check whether it is canonical. */
+/* Nonzero if this BINFO is a primary base class. */
#define BINFO_PRIMARY_P(NODE) \
(BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
/* 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)
+#define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (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. */
-#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
base that is a primary base of some of other class in the
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. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* REF is a type (named NAME), for which we have just seen some
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. TREE_VIA_VIRTUAL indicates virtual
- inheritance. CODE_TYPE_NODE indicates whether REF is a class,
- struct, or union. */
+ the base-class. Non-NULL TREE_TYPE indicates virtual inheritance.
+ CODE_TYPE_NODE indicates whether REF is a class, struct, or
+ union. */
void
xref_basetypes (tree ref, tree base_list)
for (i = 0; base_list; base_list = TREE_CHAIN (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 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;
+ BINFO_VIRTUAL_P (base_binfo) = via_virtual;
SET_CLASSTYPE_MARKED (basetype);
CLEAR_CLASSTYPE_MARKED (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;
}
}
{
tree base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
dump_child ("base", BINFO_TYPE (base_binfo));
- if (TREE_VIA_VIRTUAL (base_binfo))
+ if (BINFO_VIRTUAL_P (base_binfo))
dump_string (di, "virtual");
dump_access (di, base_binfo);
}
static tree
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)))
{
tree base_ptr = TREE_VALUE ((tree) data);
for (i = 0; i < CLASSTYPE_N_BASECLASSES (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);
}
/* Process the non-static data members. */
arguments = NULL_TREE;
/* Initialize the base. */
- if (TREE_VIA_VIRTUAL (subobject))
+ if (BINFO_VIRTUAL_P (subobject))
construct_virtual_base (subobject, arguments);
else
{
tree binfo_for = binfo;
tree vtbl;
- if (BINFO_VPTR_INDEX (binfo) && TREE_VIA_VIRTUAL (binfo)
+ if (BINFO_VPTR_INDEX (binfo) && BINFO_VIRTUAL_P (binfo)
&& BINFO_PRIMARY_P (binfo))
/* 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
}
/* Look for a virtual base -- unless the direct base is itself
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);
/* [class.base.init]
{
tree base_binfo = TREE_VEC_ELT (binfos, i);
if (TYPE_HAS_TRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo))
- || TREE_VIA_VIRTUAL (base_binfo))
+ || BINFO_VIRTUAL_P (base_binfo))
continue;
expr = build_special_member_call (current_class_ref,
for (i = 0; i < n_bases; ++i)
{
tree binfo = TREE_VEC_ELT (binfos, i);
- if (TREE_VIA_VIRTUAL (binfo))
+ if (BINFO_VIRTUAL_P (binfo))
continue;
member_init_list
continue;
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. */
continue;
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
found binfos. */
tree basetype = BINFO_TYPE (binfo);
int *hint = (int *) data;
- if (TREE_VIA_VIRTUAL (binfo))
+ if (BINFO_VIRTUAL_P (binfo))
{
if (CLASSTYPE_MARKED (basetype))
*hint |= 1;
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))
+ if (BINFO_VIRTUAL_P (base_binfo))
{
/* We store the vtable offset at which the virtual
base offset can be found. */
if (num_bases == 1
&& 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)))
/* single non-virtual public. */
return si_class_desc_type_node;
bk = lookup_base_r (base_binfo, base,
access,
- is_virtual || TREE_VIA_VIRTUAL (base_binfo),
+ is_virtual || BINFO_VIRTUAL_P (base_binfo),
binfo_ptr);
switch (bk)
continue;
rval = dynamic_cast_base_recurse
(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)
worst = rval;
else if (rval >= 0)
{
for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
{
- if (TREE_VIA_VIRTUAL (binfo))
+ if (BINFO_VIRTUAL_P (binfo))
return binfo;
}
return NULL_TREE;
for (; binfo && (!limit || !same_type_p (BINFO_TYPE (binfo), limit));
binfo = BINFO_INHERITANCE_CHAIN (binfo))
{
- if (TREE_VIA_VIRTUAL (binfo))
+ if (BINFO_VIRTUAL_P (binfo))
return binfo;
}
return NULL_TREE;
{
tree result = NULL_TREE;
- if (TREE_VIA_VIRTUAL (binfo))
+ if (BINFO_VIRTUAL_P (binfo))
{
tree t;
if (BINFO_TYPE (binfo) == BINFO_TYPE (here))
result = here;
- else if (TREE_VIA_VIRTUAL (binfo))
+ else if (BINFO_VIRTUAL_P (binfo))
result = (CLASSTYPE_VBASECLASSES (BINFO_TYPE (here))
? binfo_for_vbase (BINFO_TYPE (binfo), BINFO_TYPE (here))
: NULL_TREE);
Return a TREE_LIST containing the ACCESS_SPECIFIER and the
BASE_CLASS, or NULL_TREE if an error occurred. The
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
finish_base_specifier (tree base, tree access, bool virtual_p)
base = TYPE_MAIN_VARIANT (base);
}
result = build_tree_list (access, base);
- TREE_VIA_VIRTUAL (result) = virtual_p;
+ if (virtual_p)
+ TREE_TYPE (result) = integer_type_node;
}
return result;
BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
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);
if (!new_binfo)
base_binfo, NULL_TREE,
BINFO_VIRTUALS (base_binfo));
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);
- TREE_VIA_VIRTUAL (new_binfo) = 1;
+ BINFO_VIRTUAL_P (new_binfo) = 1;
BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t);
}
else
if (use_gnu_debug_info_extensions)
{
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' :
(access == access_protected_node ? '1' :'0'),
asmfile);
CHARS (2);
- if (TREE_VIA_VIRTUAL (child)
+ if (BINFO_VIRTUAL_P (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
copy constructors, assignment operators, and destructors) will appear on
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
@code{TYPE_BINFO}. Binfos are used to represent base-classes. The
binfo given by @code{TYPE_BINFO} is the degenerate case, whereby every
if (TREE_CODE (decl) == TREE_BINFO)
{
/* 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
aren't at a fixed offset from all (sub)objects of the same
add_type_attribute (die, BINFO_TYPE (binfo), 0, 0, context_die);
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);
if (access == access_public_node)
+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>
* class.c (make_class): Use make_tree_binfo.
properly initialize `finished_label'. Don't emit gotos for empty
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.
BINFO_TYPE (interface_binfo) = interface_class;
BINFO_OFFSET (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;
}
SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes)
ANONYMOUS_CLASS_P (in RECORD_TYPE)
ARG_FINAL_P (in TREE_LIST)
- 1: CLASS_HAS_SUPER_FLAG (in TREE_BINFO).
- IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
+ 1: IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
COMPOUND_ASSIGN_P (in EXPR (binop_*))
LOCAL_CLASS_P (in RECORD_TYPE)
BLOCK_IS_IMPLICIT (in BLOCK)
/* True if the class whose TYPE_BINFO this is has a superclass.
(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))
/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
dump_child ("type", BINFO_TYPE (t));
- if (TREE_VIA_VIRTUAL (t))
+ if (BINFO_VIRTUAL_P (t))
dump_string (di, "virt");
dump_int (di, "bases", n_bases);
TREE_STATIC in
VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, ADDR_EXPR
TREE_VIA_VIRTUAL in
- TREE_LIST or TREE_BINFO
+ TREE_BINFO
TREE_CONSTANT_OVERFLOW in
INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST
TREE_SYMBOL_REFERENCED in
implicitly and should not lead to any sort of warning. */
#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
there was an overflow in folding. This is distinct from
TREE_OVERFLOW because ANSI C requires a diagnostic when overflows
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. */
+/* 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. */
#define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK(NODE))