cp-tree.h (CLASSTYPE_VFIELD): Remove.
authorMark Mitchell <mark@codesourcery.com>
Wed, 6 Oct 1999 19:01:44 +0000 (19:01 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 6 Oct 1999 19:01:44 +0000 (19:01 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/dump.c
gcc/cp/init.c
gcc/cp/ir.texi
gcc/cp/search.c
gcc/cp/typeck.c

index c601526..3321923 100644 (file)
@@ -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
index 5d9f5c3..6eaf61e 100644 (file)
@@ -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;
 }
index afe3346..dc40536 100644 (file)
@@ -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);
index 5d65abf..0a5d447 100644 (file)
@@ -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)
index 2098d9b..dc767bc 100644 (file)
@@ -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);
        }
index 83fd8c5..5f395f5 100644 (file)
@@ -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);
index 021c679..dd7a569 100644 (file)
@@ -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
index e3418a6..0a1d758 100644 (file)
@@ -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));
            }
index 2b766d6..4bf8178 100644 (file)
@@ -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));