* cp-tree.h (CLASSTYPE_VFIELD): Remove.
* call.c (build_vfield_ref): Use TYPE_VFIELD, not
CLASSTYPE_VFIELD.
* class.c (get_vfield_offset): Likewise.
(finish_base_struct): Likewise.
(modify_one_vtable): Likewise.
(fixup_vtable_deltas): Likewise.
(finish_struct_1): Likewise.
* init.c (expand_virtual_init): Likewise.
* search.c (lookup_field_1): Likewise.
(expand_upcast_fixups): Likewise.
* typeck.c (build_component_ref): Likewise.
(build_binary_op_nodefault): Likewise.
* dump.c (dqueue_and_dump): Dump TYPE_VFIELD.
* ir.texi: Document TYPE_VFIELD.
From-SVN: r29843
+1999-10-06 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_VFIELD): Remove.
+ * call.c (build_vfield_ref): Use TYPE_VFIELD, not
+ CLASSTYPE_VFIELD.
+ * class.c (get_vfield_offset): Likewise.
+ (finish_base_struct): Likewise.
+ (modify_one_vtable): Likewise.
+ (fixup_vtable_deltas): Likewise.
+ (finish_struct_1): Likewise.
+ * init.c (expand_virtual_init): Likewise.
+ * search.c (lookup_field_1): Likewise.
+ (expand_upcast_fixups): Likewise.
+ * typeck.c (build_component_ref): Likewise.
+ (build_binary_op_nodefault): Likewise.
+
+ * dump.c (dqueue_and_dump): Dump TYPE_VFIELD.
+ * ir.texi: Document TYPE_VFIELD.
+
1999-10-06 Brendan Kehoe <brendan@cygnus.com>
* decl.c (grokdeclarator): Only warn about non-zero arrays if
datum = convert_from_reference (datum);
if (! TYPE_USES_COMPLEX_INHERITANCE (type))
- rval = build (COMPONENT_REF, TREE_TYPE (CLASSTYPE_VFIELD (type)),
- datum, CLASSTYPE_VFIELD (type));
+ rval = build (COMPONENT_REF, TREE_TYPE (TYPE_VFIELD (type)),
+ datum, TYPE_VFIELD (type));
else
- rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), NULL_TREE, 0);
+ rval = build_component_ref (datum, DECL_NAME (TYPE_VFIELD (type)), NULL_TREE, 0);
return rval;
}
{
tree tmp
= size_binop (FLOOR_DIV_EXPR,
- DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
+ DECL_FIELD_BITPOS (TYPE_VFIELD (BINFO_TYPE (binfo))),
size_int (BITS_PER_UNIT));
tmp = convert (sizetype, tmp);
return size_binop (PLUS_EXPR, tmp, BINFO_OFFSET (binfo));
TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
b->has_virtual = CLASSTYPE_VSIZE (basetype);
- b->vfield = CLASSTYPE_VFIELD (basetype);
+ b->vfield = TYPE_VFIELD (basetype);
b->vfields = copy_list (CLASSTYPE_VFIELDS (basetype));
vfields = b->vfields;
while (vfields)
|| ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
{
tree value = VF_BASETYPE_VALUE (vfields);
- if (DECL_NAME (CLASSTYPE_VFIELD (value))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
+ if (DECL_NAME (TYPE_VFIELD (value))
+ == DECL_NAME (TYPE_VFIELD (basetype)))
VF_NORMAL_VALUE (b->vfields) = basetype;
else
VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields);
}
vfields = TREE_CHAIN (vfields);
}
- CLASSTYPE_VFIELD (t) = b->vfield;
+ TYPE_VFIELD (t) = b->vfield;
}
else
{
{
tree value = VF_BASETYPE_VALUE (vfields);
b->vfields = tree_cons (base_binfo, value, b->vfields);
- if (DECL_NAME (CLASSTYPE_VFIELD (value))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
+ if (DECL_NAME (TYPE_VFIELD (value))
+ == DECL_NAME (TYPE_VFIELD (basetype)))
VF_NORMAL_VALUE (b->vfields) = basetype;
else
VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields);
TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
b->has_virtual = CLASSTYPE_VSIZE (basetype);
- b->vfield = CLASSTYPE_VFIELD (basetype);
- CLASSTYPE_VFIELD (t) = b->vfield;
+ b->vfield = TYPE_VFIELD (basetype);
+ TYPE_VFIELD (t) = b->vfield;
/* When we install the first one, set the VF_NORMAL_VALUE
to be the current class, as this it is the most derived
class. Hopefully, this is not set to something else
vfields = b->vfields;
while (vfields)
{
- if (DECL_NAME (CLASSTYPE_VFIELD (t))
- == DECL_NAME (CLASSTYPE_VFIELD (basetype)))
+ if (DECL_NAME (TYPE_VFIELD (t))
+ == DECL_NAME (TYPE_VFIELD (basetype)))
{
VF_NORMAL_VALUE (vfields) = t;
/* There should only be one of them! And it should
if (binfo == TYPE_BINFO (t))
{
if (! BINFO_NEW_VTABLE_MARKED (binfo))
- build_vtable (TYPE_BINFO (DECL_CONTEXT (CLASSTYPE_VFIELD (t))), t);
+ build_vtable (TYPE_BINFO (DECL_CONTEXT (TYPE_VFIELD (t))), t);
}
else
{
{
tree base_offset, offset;
tree context = DECL_CLASS_CONTEXT (fndecl);
- tree vfield = CLASSTYPE_VFIELD (t);
+ tree vfield = TYPE_VFIELD (t);
tree this_offset;
offset = get_class_offset (context, t, binfo, fndecl);
{
tree base_offset, offset;
tree context = DECL_CLASS_CONTEXT (fndecl);
- tree vfield = CLASSTYPE_VFIELD (t);
+ tree vfield = TYPE_VFIELD (t);
tree this_offset;
offset = get_class_offset (context, t, binfo, fndecl);
modified. Needed at this point to make add_virtual_function
and modify_vtable_entries work. */
CLASSTYPE_VFIELDS (t) = vfields;
- CLASSTYPE_VFIELD (t) = vfield;
+ TYPE_VFIELD (t) = vfield;
for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
{
other VFIELD_BASEs and VTABLE_BASEs in the code, and change
them too. */
DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);
- CLASSTYPE_VFIELD (t) = vfield;
+ TYPE_VFIELD (t) = vfield;
DECL_VIRTUAL_P (vfield) = 1;
DECL_ARTIFICIAL (vfield) = 1;
DECL_FIELD_CONTEXT (vfield) = t;
DECL_CLASS_CONTEXT (vfield) = t;
DECL_FIELD_BITPOS (vfield)
= size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield));
- CLASSTYPE_VFIELD (t) = vfield;
+ TYPE_VFIELD (t) = vfield;
}
#ifdef NOTQUITE
layout_type (atype);
- CLASSTYPE_VFIELD (t) = vfield;
+ TYPE_VFIELD (t) = vfield;
/* We may have to grow the vtable. */
if (TREE_TYPE (TYPE_BINFO_VTABLE (t)) != atype)
}
}
else if (first_vfn_base_index >= 0)
- CLASSTYPE_VFIELD (t) = vfield;
+ TYPE_VFIELD (t) = vfield;
CLASSTYPE_VFIELDS (t) = vfields;
finish_struct_bits (t, max_has_virtual);
1, if D's vtable came from B2. */
#define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
-/* Remove when done merging. */
-#define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
-
/* The number of virtual functions defined for this
_CLASSTYPE node. */
#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
dump_child ("flds", TYPE_FIELDS (t));
dump_child ("fncs", TYPE_METHODS (t));
+ dump_child ("vfld", TYPE_VFIELD (t));
queue_and_dump_index (di, "binf", TYPE_BINFO (t),
DUMP_BINFO);
}
/* This code is crusty. Should be simple, like:
vtbl = BINFO_VTABLE (binfo);
*/
- vtype = DECL_CONTEXT (CLASSTYPE_VFIELD (type));
+ vtype = DECL_CONTEXT (TYPE_VFIELD (type));
vtype_binfo = get_binfo (vtype, TREE_TYPE (TREE_TYPE (decl)), 0);
- vtbl = BINFO_VTABLE (binfo_value (DECL_FIELD_CONTEXT (CLASSTYPE_VFIELD (type)), binfo));
+ vtbl = BINFO_VTABLE (binfo_value (DECL_FIELD_CONTEXT (TYPE_VFIELD (type)), binfo));
assemble_external (vtbl);
TREE_USED (vtbl) = 1;
vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl);
@findex TREE_VIA_PROTECTED
@findex TREE_VIA_PRIVATE
@findex TYPE_FIELDS
+@findex TYPE_VFIELD
@findex TYPE_METHODS
A class type is represented by either a @code{RECORD_TYPE} or a
opposed to a @code{struct}. This macro will be true only for classes
declared with the @code{class} tag.
-All non-function members are available on the @code{TYPE_FIELDS} list.
-Given one member, the next can be found by following the
+Almost all non-function members are available on the @code{TYPE_FIELDS}
+list. Given one member, the next can be found by following the
@code{TREE_CHAIN}. You should not depend in any way on the order in
which fields appear on this list. All nodes on this list will be
@samp{DECL} nodes. A @code{FIELD_DECL} is used to represent a non-static
there is no @code{FIELD_DECL} for the ``base-class portion'' of an
object.
+The @code{TYPE_VFIELD} is a compiler-generated field used to point to
+virtual function tables. It does not appear on the @code{TYPE_FIELDS}
+list. However, back-ends should handle the @code{TYPE_VFIELD} just like
+all the entries on the @code{TYPE_FIELDS} list.
+
The function members are available on the @code{TYPE_METHODS} list.
Again, subsequent members are found by following the @code{TREE_CHAIN}
field. If a function is overloaded, each of the overloaded functions
{
/* Give the user what s/he thinks s/he wants. */
if (TYPE_VIRTUAL_P (type))
- return CLASSTYPE_VFIELD (type);
+ return TYPE_VFIELD (type);
}
return NULL_TREE;
}
/* Update the vtable pointers as necessary. */
ref = build_vfield_ref
(build_indirect_ref (addr, NULL_PTR),
- DECL_CONTEXT (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))));
+ DECL_CONTEXT (TYPE_VFIELD (BINFO_TYPE (binfo))));
finish_expr_stmt
(build_modify_expr (ref, NOP_EXPR, nvtbl));
}
}
/* Look up component name in the structure type definition. */
- if (CLASSTYPE_VFIELD (basetype)
- && DECL_NAME (CLASSTYPE_VFIELD (basetype)) == component)
+ if (TYPE_VFIELD (basetype)
+ && DECL_NAME (TYPE_VFIELD (basetype)) == component)
/* Special-case this because if we use normal lookups in an ambiguous
hierarchy, the compiler will abort (because vptr lookups are
not supposed to be ambiguous. */
- field = CLASSTYPE_VFIELD (basetype);
+ field = TYPE_VFIELD (basetype);
else if (TREE_CODE (component) == FIELD_DECL)
field = component;
else if (TREE_CODE (component) == TYPE_DECL)
DECL_VINDEX (TREE_OPERAND (op1, 0)),
integer_one_node);
op1 = integer_zero_node;
- delta21 = CLASSTYPE_VFIELD (TYPE_METHOD_BASETYPE
- (TREE_TYPE (type1)));
+ delta21 = TYPE_VFIELD (TYPE_METHOD_BASETYPE
+ (TREE_TYPE (type1)));
delta21 = DECL_FIELD_BITPOS (delta21);
delta21 = size_binop (FLOOR_DIV_EXPR, delta21,
size_int (BITS_PER_UNIT));