OSDN Git Service

* cp-tree.h (make_binfo): Remove.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Jul 2004 17:11:35 +0000 (17:11 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Jul 2004 17:11:35 +0000 (17:11 +0000)
* decl.c (xref_basetypes): Use make_tree_binfo directly.
* tree.h (copy_base_binfos): Likewise.
(make_binfo): Remove.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84566 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/tree.c

index 392a732..c897bdc 100644 (file)
@@ -1,5 +1,10 @@
 2004-07-12  Nathan Sidwell  <nathan@codesourcery.com>
 
+       * cp-tree.h (make_binfo): Remove.
+       * decl.c (xref_basetypes): Use make_tree_binfo directly.
+       * tree.h (copy_base_binfos): Likewise.
+       (make_binfo): Remove.
+       
        * call.c (build_user_type_conversion_1, build_new_op,
        check_constructor_callable, build_temp,
        perform_direct_initialization_of_possible): Pass type directly to
index 500ad11..a8d6f04 100644 (file)
@@ -4181,7 +4181,6 @@ extern tree build_cplus_array_type                (tree, tree);
 extern tree hash_tree_cons                     (tree, tree, tree);
 extern tree hash_tree_chain                    (tree, tree);
 extern tree hash_chainon                       (tree, tree);
-extern tree make_binfo                         (tree, tree, tree, tree);
 extern int count_functions                     (tree);
 extern int is_overloaded_fn                    (tree);
 extern tree get_first_fn                       (tree);
index 39b0a17..f659b20 100644 (file)
@@ -9064,7 +9064,10 @@ xref_basetypes (tree ref, tree base_list)
   /* The binfo slot should be empty, unless this is an (ill-formed)
      redefinition.  */
   my_friendly_assert (!TYPE_BINFO (ref) || TYPE_SIZE (ref), 20040706);
-  TYPE_BINFO (ref) = make_binfo (size_zero_node, ref, NULL_TREE, NULL_TREE);
+  my_friendly_assert (TYPE_MAIN_VARIANT (ref) == ref, 20040712);
+  TYPE_BINFO (ref) = make_tree_binfo (BINFO_LANG_SLOTS);
+  BINFO_OFFSET (TYPE_BINFO (ref)) = size_zero_node;
+  BINFO_TYPE (TYPE_BINFO (ref)) = ref;
   
   if (i)
     {
@@ -9115,23 +9118,17 @@ xref_basetypes (tree ref, tree base_list)
              && (current_lang_depth () == 0))
            TYPE_FOR_JAVA (ref) = 1;
          
-         if (CLASS_TYPE_P (basetype))
+         if (CLASS_TYPE_P (basetype) && !dependent_type_p (basetype))
            {
              base_binfo = TYPE_BINFO (basetype);
 
-             if (dependent_type_p (basetype))
-               {
-                 base_binfo = make_binfo (size_zero_node, basetype,
-                                          NULL_TREE, NULL_TREE);
-                 BINFO_DEPENDENT_BASE_P (base_binfo) = 1;
-               }
-             else
-               my_friendly_assert (base_binfo, 20040706);
+             my_friendly_assert (base_binfo, 20040706);
            }
          else
            {
-             base_binfo = make_binfo (size_zero_node, basetype,
-                                      NULL_TREE, NULL_TREE);
+             base_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
+             
+             BINFO_TYPE (base_binfo) = basetype;
              BINFO_DEPENDENT_BASE_P (base_binfo) = 1;
            }
          
index b463fc1..6cb784a 100644 (file)
@@ -617,9 +617,19 @@ copy_base_binfos (tree binfo, tree t, tree prev)
       
       if (!new_binfo)
        {
-         new_binfo = make_binfo (BINFO_OFFSET (base_binfo),
-                                 base_binfo, NULL_TREE,
-                                 BINFO_VIRTUALS (base_binfo));
+         new_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
+
+         BINFO_TYPE (new_binfo) = BINFO_TYPE (base_binfo);
+         BINFO_OFFSET (new_binfo) = BINFO_OFFSET (base_binfo);
+         BINFO_VIRTUALS (new_binfo) = BINFO_VIRTUALS (base_binfo);
+
+         if (BINFO_BASE_BINFOS (base_binfo))
+           /* Duplicate the binfo's base vector, so we can recurse.  */
+           BINFO_BASE_BINFOS (new_binfo)
+             = copy_node (BINFO_BASE_BINFOS (base_binfo));
+         /* We do not need to copy the accesses, as they are read only.  */
+         BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (base_binfo);
+         
          prev = copy_base_binfos (new_binfo, t, prev);
          if (BINFO_VIRTUAL_P (base_binfo))
            {
@@ -753,52 +763,6 @@ hash_chainon (tree list1, tree list2)
                          hash_chainon (TREE_CHAIN (list1), list2));
 }
 \f
-/* Build an association between TYPE and some parameters:
-
-   OFFSET is the offset added to `this' to convert it to a pointer
-   of type `TYPE *'
-
-   BINFO is the base binfo to use, if we are deriving from one.  This
-   is necessary, as we want specialized parent binfos from base
-   classes, so that the VTABLE_NAMEs of bases are for the most derived
-   type, instead of the simple type.
-
-   VTABLE is the virtual function table with which to initialize
-   sub-objects of type TYPE.
-
-   VIRTUALS are the virtual functions sitting in VTABLE.  */
-
-tree
-make_binfo (tree offset, tree binfo, tree vtable, tree virtuals)
-{
-  tree new_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
-  tree type;
-
-  if (TREE_CODE (binfo) == TREE_BINFO)
-    {
-      type = BINFO_TYPE (binfo);
-      my_friendly_assert (!BINFO_DEPENDENT_BASE_P (binfo), 20040706);
-    }
-  else
-    {
-      type = binfo;
-      binfo = NULL_TREE;
-    }
-
-  TREE_TYPE (new_binfo) = TYPE_MAIN_VARIANT (type);
-  BINFO_OFFSET (new_binfo) = offset;
-  BINFO_VTABLE (new_binfo) = vtable;
-  BINFO_VIRTUALS (new_binfo) = virtuals;
-
-  if (binfo && BINFO_BASE_BINFOS (binfo))
-    {
-      BINFO_BASE_BINFOS (new_binfo) = copy_node (BINFO_BASE_BINFOS (binfo));
-      /* We do not need to copy the accesses, as they are read only.  */
-      BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (binfo);
-    }
-  return new_binfo;
-}
-
 void
 debug_binfo (tree elem)
 {