summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-06 19:01:44 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-10-06 19:01:44 +0000
commit0ff26a7ae21245e526cdfec7c82fd4d90d901a88 (patch)
tree53cc6468d8fe6e06ad4f46094e0dc83f17bafbfd /gcc
parent883be126f9eef95bad160b0bfe5e3ed975840c2e (diff)
downloadppe42-gcc-0ff26a7ae21245e526cdfec7c82fd4d90d901a88.tar.gz
ppe42-gcc-0ff26a7ae21245e526cdfec7c82fd4d90d901a88.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog19
-rw-r--r--gcc/cp/call.c6
-rw-r--r--gcc/cp/class.c38
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/dump.c1
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/ir.texi10
-rw-r--r--gcc/cp/search.c4
-rw-r--r--gcc/cp/typeck.c10
9 files changed, 59 insertions, 36 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c6015266d6a..3321923e83f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,22 @@
+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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5d9f5c3786e..6eaf61e77fe 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -112,10 +112,10 @@ build_vfield_ref (datum, type)
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;
}
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index afe33462702..dc4053608c3 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -605,7 +605,7 @@ get_vfield_offset (binfo)
{
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));
@@ -1603,7 +1603,7 @@ finish_base_struct (t, b)
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)
@@ -1612,15 +1612,15 @@ finish_base_struct (t, b)
|| ! 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
{
@@ -1633,8 +1633,8 @@ finish_base_struct (t, b)
{
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);
@@ -1652,8 +1652,8 @@ finish_base_struct (t, b)
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
@@ -1661,8 +1661,8 @@ finish_base_struct (t, b)
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
@@ -2400,7 +2400,7 @@ modify_one_vtable (binfo, t, fndecl)
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
{
@@ -2428,7 +2428,7 @@ modify_one_vtable (binfo, t, 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);
@@ -2520,7 +2520,7 @@ fixup_vtable_deltas1 (binfo, t)
{
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);
@@ -3284,7 +3284,7 @@ finish_struct_1 (t)
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))
{
@@ -3753,7 +3753,7 @@ finish_struct_1 (t)
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;
@@ -3923,7 +3923,7 @@ finish_struct_1 (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
@@ -4046,7 +4046,7 @@ finish_struct_1 (t)
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)
@@ -4062,7 +4062,7 @@ finish_struct_1 (t)
}
}
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);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 5d65abfcf64..0a5d447e332 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1365,9 +1365,6 @@ struct lang_type
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)
diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c
index 2098d9b8b0f..dc767bc8fa7 100644
--- a/gcc/cp/dump.c
+++ b/gcc/cp/dump.c
@@ -530,6 +530,7 @@ dequeue_and_dump (di)
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);
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 83fd8c53eef..5f395f5ba2b 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -659,9 +659,9 @@ expand_virtual_init (binfo, decl)
/* 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);
diff --git a/gcc/cp/ir.texi b/gcc/cp/ir.texi
index 021c679a9d4..dd7a5699851 100644
--- a/gcc/cp/ir.texi
+++ b/gcc/cp/ir.texi
@@ -655,6 +655,7 @@ list. In particular, no @code{FIELD_DECL}, @code{LABEL_DECL}, or
@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
@@ -666,8 +667,8 @@ macro to discern whether or not a particular type is a @code{class} as
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
@@ -680,6 +681,11 @@ There are no entries for base classes on this list. In particular,
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
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index e3418a68662..0a1d758406a 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -656,7 +656,7 @@ lookup_field_1 (type, name)
{
/* 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;
}
@@ -2685,7 +2685,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
/* 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));
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 2b766d68dfa..4bf817858ff 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2094,12 +2094,12 @@ build_component_ref (datum, component, basetype_path, protect)
}
/* 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)
@@ -3697,8 +3697,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
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));
OpenPOWER on IntegriCloud