aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-01-02 02:13:53 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-01-02 02:13:53 +0000
commit0533d788e5a1cfee22b813adc87afa9f44c688c0 (patch)
tree8fb9bf7e9dc53b9203c4fee3ddcdf7c16e265df2 /gcc
parent4485c55bfda1b1cc8698c1b9601d1e5b2d1f902d (diff)
downloadgcc-0533d788e5a1cfee22b813adc87afa9f44c688c0.zip
gcc-0533d788e5a1cfee22b813adc87afa9f44c688c0.tar.gz
gcc-0533d788e5a1cfee22b813adc87afa9f44c688c0.tar.bz2
class.c (build_vtable): Don't return a value.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c86
2 files changed, 47 insertions, 49 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fdcf9eb..eb51cc2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 2de8bc6..dfe1a15 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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