]> gcc.gnu.org Git - gcc.git/commitdiff
class.c (build_vtable): Don't return a value.
authorMark Mitchell <mark@codesourcery.com>
Sun, 2 Jan 2000 02:13:53 +0000 (02:13 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 2 Jan 2000 02:13:53 +0000 (02:13 +0000)
* class.c (build_vtable): Don't return a value.  Don't rebuild
vtables for bases that have already been handled.
(prepare_fresh_vtable): Don't rebuild vtables for bases that have
already been handled.
(modify_one_vtable): Adjust accordingly.
(fixup_vtable_deltas1): Likewise.
(finish_struct_1): Likewise.

From-SVN: r31161

gcc/cp/ChangeLog
gcc/cp/class.c

index fdcf9eb48d49ccb7774688c8e8e10d13067162ed..eb51cc2303f85ea78e20e5c1b79b208a50a56f1c 100644 (file)
@@ -1,3 +1,13 @@
+2000-01-01  Mark Mitchell  <mark@codesourcery.com>
+
+       * class.c (build_vtable): Don't return a value.  Don't rebuild
+       vtables for bases that have already been handled.
+       (prepare_fresh_vtable): Don't rebuild vtables for bases that have
+       already been handled.
+       (modify_one_vtable): Adjust accordingly.
+       (fixup_vtable_deltas1): Likewise.
+       (finish_struct_1): Likewise.
+
 2000-01-01  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
 
        * call.c (build_new_method_call): Also check destructors.
index 2de8bc6ef1abffb3c165eeef3519fc1341772db1..dfe1a1565869c694aa801aba5ab293d9eb824d43 100644 (file)
@@ -82,7 +82,7 @@ static tree get_vtable_name PROTO((tree));
 static tree get_derived_offset PROTO((tree, tree));
 static tree get_basefndecls PROTO((tree, tree));
 static void set_rtti_entry PROTO((tree, tree, tree));
-static tree build_vtable PROTO((tree, tree));
+static void build_vtable PROTO((tree, tree));
 static void prepare_fresh_vtable PROTO((tree, tree));
 static void fixup_vtable_deltas1 PROTO((tree, tree));
 static void fixup_vtable_deltas PROTO((tree, int, tree));
@@ -695,7 +695,7 @@ set_rtti_entry (virtuals, offset, type)
    approximation that it is the same as the one which is the head of
    the association list.  */
 
-static tree
+static void
 build_vtable (binfo, type)
      tree binfo, type;
 {
@@ -706,6 +706,11 @@ build_vtable (binfo, type)
     {
       tree offset;
 
+      if (BINFO_NEW_VTABLE_MARKED (binfo))
+       /* We have already created a vtable for this base, so there's
+          no need to do it again.  */
+       return;
+
       virtuals = copy_list (BINFO_VIRTUALS (binfo));
       decl = build_lang_decl (VAR_DECL, name, 
                              TREE_TYPE (BINFO_VTABLE (binfo)));
@@ -752,7 +757,6 @@ build_vtable (binfo, type)
 
   binfo = TYPE_BINFO (type);
   SET_BINFO_NEW_VTABLE_MARKED (binfo);
-  return decl;
 }
 
 /* Give TYPE a new virtual function table which is initialized
@@ -787,6 +791,11 @@ prepare_fresh_vtable (binfo, for_type)
   joiner = JOINER;
 #endif
 
+  if (BINFO_NEW_VTABLE_MARKED (binfo))
+    /* We already created a vtable for this base.  There's no need to
+       do it again.  */
+    return;
+
   basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (binfo));
 
   buf2 = TYPE_ASSEMBLER_NAME_STRING (basetype);
@@ -2414,15 +2423,9 @@ modify_one_vtable (binfo, t, fndecl)
   if (flag_rtti)
     {
       if (binfo == TYPE_BINFO (t))
-       {
-         if (! BINFO_NEW_VTABLE_MARKED (binfo))
-           build_vtable (TYPE_BINFO (DECL_CONTEXT (TYPE_VFIELD (t))), t);
-       }
+       build_vtable (TYPE_BINFO (DECL_CONTEXT (TYPE_VFIELD (t))), t);
       else
-       {
-         if (! BINFO_NEW_VTABLE_MARKED (binfo))
-           prepare_fresh_vtable (binfo, t);
-       }
+       prepare_fresh_vtable (binfo, t);
     }
   if (fndecl == NULL_TREE)
     return;
@@ -2462,22 +2465,16 @@ modify_one_vtable (binfo, t, fndecl)
          this_offset = ssize_binop (MINUS_EXPR, offset, base_offset);
 
          if (binfo == TYPE_BINFO (t))
-           {
-             /* In this case, it is *type*'s vtable we are modifying.
-                We start with the approximation that it's vtable is that
-                of the immediate base class.  */
-             if (! BINFO_NEW_VTABLE_MARKED (binfo))
-               build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
-           }
+           /* In this case, it is *type*'s vtable we are modifying.
+              We start with the approximation that it's vtable is
+              that of the immediate base class.  */
+             build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
          else
-           {
-             /* This is our very own copy of `basetype' to play with.
-                Later, we will fill in all the virtual functions
-                that override the virtual functions in these base classes
-                which are not defined by the current type.  */
-             if (! BINFO_NEW_VTABLE_MARKED (binfo))
-               prepare_fresh_vtable (binfo, t);
-           }
+           /* This is our very own copy of `basetype' to play with.
+              Later, we will fill in all the virtual functions that
+              override the virtual functions in these base classes
+              which are not defined by the current type.  */
+           prepare_fresh_vtable (binfo, t);
 
 #ifdef NOTQUITE
          cp_warning ("in %D", DECL_NAME (BINFO_VTABLE (binfo)));
@@ -2558,22 +2555,17 @@ fixup_vtable_deltas1 (binfo, t)
            {
              /* Make sure we can modify the derived association with immunity.  */
              if (binfo == TYPE_BINFO (t))
-               {
-                 /* In this case, it is *type*'s vtable we are modifying.
-                    We start with the approximation that it's vtable is that
-                    of the immediate base class.  */
-                 if (! BINFO_NEW_VTABLE_MARKED (binfo))
-                   build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
-               }
+               /* In this case, it is *type*'s vtable we are modifying.
+                  We start with the approximation that it's vtable is that
+                  of the immediate base class.  */
+               build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t);
              else
-               {
-                 /* This is our very own copy of `basetype' to play with.
-                    Later, we will fill in all the virtual functions
-                    that override the virtual functions in these base classes
-                    which are not defined by the current type.  */
-                 if (! BINFO_NEW_VTABLE_MARKED (binfo))
-                   prepare_fresh_vtable (binfo, t);
-               }
+               /* This is our very own copy of `basetype' to play
+                  with.  Later, we will fill in all the virtual
+                  functions that override the virtual functions in
+                  these base classes which are not defined by the
+                  current type.  */
+               prepare_fresh_vtable (binfo, t);
 
              modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n),
                                   this_offset,
@@ -4405,14 +4397,10 @@ finish_struct_1 (t)
            }
          build_vtable (NULL_TREE, t);
        }
-      else
-       {
-         /* Here we know enough to change the type of our virtual
-            function table, but we will wait until later this function.  */
-
-         if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t)))
-           build_vtable (CLASSTYPE_PRIMARY_BINFO (t), t);
-       }
+      else if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t)))
+       /* Here we know enough to change the type of our virtual
+          function table, but we will wait until later this function.  */
+       build_vtable (CLASSTYPE_PRIMARY_BINFO (t), t);
 
       /* If this type has basetypes with constructors, then those
         constructors might clobber the virtual function table.  But
This page took 0.094612 seconds and 5 git commands to generate.