aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-12-31 20:26:07 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-12-31 20:26:07 +0000
commit233811559ad3b89e994cd0f5c6f09ecc1d9bb9be (patch)
tree3ecc620b71d50e42a7df478679c7d85a735fc9fe
parent8b4d03b1f9a01f5fe3840662b1c6f0d27cc1578a (diff)
downloadgcc-233811559ad3b89e994cd0f5c6f09ecc1d9bb9be.zip
gcc-233811559ad3b89e994cd0f5c6f09ecc1d9bb9be.tar.gz
gcc-233811559ad3b89e994cd0f5c6f09ecc1d9bb9be.tar.bz2
cp-tree.h (CLASSTYPE_VBASECLASSES): Update documentation.
* cp-tree.h (CLASSTYPE_VBASECLASSES): Update documentation. (CLASSTYPE_N_BASECLASSES): Likewise. (BINFO_FOR_VBASE): New macro. (get_vbase_types): Change prototype. * class.c (build_vbase_path): Use BINFO_FOR_VBASE. (prepare_fresh_vtable): Likewise. (finish_vtbls): Likewise. (get_class_offset_1): Likewise. (modify_all_indirect_vtables): Likewise. (build_vbase_pointer_fields): Likewise. * decl.c (xref_basetypes): Don't set CLASSTYPE_VBASECLASSES here. * init.c (sort_base_init): Use BINFO_FOR_VBASE. (expand_member_init): Likewise. * search.c (get_base_distance): Likewise. (lookup_field_queue_p): Likewise. (virtual_context): Likewise. (get_vbase_types): Don't return a value. Set CLASSTYPE_VBASECLASSES here. * typeck.c (get_delta_difference): Use BINFO_FOR_VBASE. From-SVN: r31150
-rw-r--r--gcc/cp/ChangeLog22
-rw-r--r--gcc/cp/class.c24
-rw-r--r--gcc/cp/cp-tree.h18
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/init.c7
-rw-r--r--gcc/cp/search.c12
-rw-r--r--gcc/cp/typeck.c3
7 files changed, 52 insertions, 36 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6c961f1..cd44cf9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,25 @@
+1999-12-31 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (CLASSTYPE_VBASECLASSES): Update documentation.
+ (CLASSTYPE_N_BASECLASSES): Likewise.
+ (BINFO_FOR_VBASE): New macro.
+ (get_vbase_types): Change prototype.
+ * class.c (build_vbase_path): Use BINFO_FOR_VBASE.
+ (prepare_fresh_vtable): Likewise.
+ (finish_vtbls): Likewise.
+ (get_class_offset_1): Likewise.
+ (modify_all_indirect_vtables): Likewise.
+ (build_vbase_pointer_fields): Likewise.
+ * decl.c (xref_basetypes): Don't set CLASSTYPE_VBASECLASSES here.
+ * init.c (sort_base_init): Use BINFO_FOR_VBASE.
+ (expand_member_init): Likewise.
+ * search.c (get_base_distance): Likewise.
+ (lookup_field_queue_p): Likewise.
+ (virtual_context): Likewise.
+ (get_vbase_types): Don't return a value. Set
+ CLASSTYPE_VBASECLASSES here.
+ * typeck.c (get_delta_difference): Use BINFO_FOR_VBASE.
+
1999-12-30 Mark Mitchell <mark@codesourcery.com>
* class.c (fixup_inline_methods): Clear CLASSTYPE_INLINE_FRIENDS.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 4a75af9..10dff6e 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -331,8 +331,8 @@ build_vbase_path (code, type, expr, path, nonnull)
{
if (last_virtual)
{
- offset = BINFO_OFFSET (binfo_member (last_virtual,
- CLASSTYPE_VBASECLASSES (basetype)));
+ offset = BINFO_OFFSET (BINFO_FOR_VBASE (last_virtual,
+ basetype));
offset = size_binop (PLUS_EXPR, offset, BINFO_OFFSET (last));
}
else
@@ -884,8 +884,7 @@ prepare_fresh_vtable (binfo, for_type)
if (TREE_VIA_VIRTUAL (binfo))
{
- tree binfo1 = binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (for_type));
+ tree binfo1 = BINFO_FOR_VBASE (BINFO_TYPE (binfo), for_type);
/* XXX - This should never happen, if it does, the caller should
ensure that the binfo is from for_type's binfos, not from any
@@ -911,8 +910,8 @@ prepare_fresh_vtable (binfo, for_type)
import_export_vtable (new_decl, for_type, 0);
if (TREE_VIA_VIRTUAL (binfo))
- my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (current_class_type)),
+ my_friendly_assert (binfo == BINFO_FOR_VBASE (BINFO_TYPE (binfo),
+ current_class_type),
170);
SET_BINFO_NEW_VTABLE_MARKED (binfo);
}
@@ -2321,8 +2320,7 @@ finish_vtbls (binfo, do_self, t)
int is_not_base_vtable
= i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo));
if (TREE_VIA_VIRTUAL (base_binfo))
- base_binfo = binfo_member (BINFO_TYPE (base_binfo),
- CLASSTYPE_VBASECLASSES (t));
+ base_binfo = BINFO_FOR_VBASE (BINFO_TYPE (base_binfo), t);
finish_vtbls (base_binfo, is_not_base_vtable, t);
}
}
@@ -2375,8 +2373,7 @@ get_class_offset_1 (parent, binfo, context, t, fndecl)
tree nrval;
if (TREE_VIA_VIRTUAL (base_binfo))
- base_binfo = binfo_member (BINFO_TYPE (base_binfo),
- CLASSTYPE_VBASECLASSES (t));
+ base_binfo = BINFO_FOR_VBASE (BINFO_TYPE (base_binfo), t);
nrval = get_class_offset_1 (parent, base_binfo, context, t, fndecl);
/* See if we have a new value */
if (nrval && (nrval != error_mark_node || rval==0))
@@ -2699,7 +2696,7 @@ modify_all_indirect_vtables (binfo, do_self, via_virtual, t, fndecl)
if (TREE_VIA_VIRTUAL (base_binfo))
{
via_virtual = 1;
- base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t));
+ base_binfo = BINFO_FOR_VBASE (BINFO_TYPE (base_binfo), t);
}
modify_all_indirect_vtables (base_binfo, is_not_base_vtable, via_virtual, t, fndecl);
}
@@ -3769,10 +3766,7 @@ build_vbase_pointer_fields (rec, empty_p)
{
tree other_base_binfo = TREE_VEC_ELT (binfos, j);
if (! TREE_VIA_VIRTUAL (other_base_binfo)
- && binfo_member (basetype,
- CLASSTYPE_VBASECLASSES (BINFO_TYPE
- (other_base_binfo))
- ))
+ && BINFO_FOR_VBASE (basetype, BINFO_TYPE (other_base_binfo)))
goto got_it;
}
FORMAT_VBASE_NAME (name, basetype);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d5be18c..3b3596f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1406,16 +1406,22 @@ struct lang_type
/* The number of virtual functions defined for this
_CLASSTYPE node. */
#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
-/* The direct and indirect virtual base classes that this type uses in
- depth-first left-to-right order. */
+
+/* A chain of BINFOs for the direct and indirect virtual base classes
+ that this type uses in depth-first left-to-right order. */
#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
+
+/* The BINFO (if any) for the virtual baseclass T of the class C. */
+#define BINFO_FOR_VBASE(T, C) \
+ (binfo_member (T, CLASSTYPE_VBASECLASSES (C)))
+
/* The virtual function pointer fields that this type contains. */
#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
-/* Number of baseclasses defined for this type.
- 0 means no base classes. */
+/* Number of direct baseclasses of NODE. */
#define CLASSTYPE_N_BASECLASSES(NODE) \
- (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
+ (TYPE_BINFO_BASETYPES (NODE) ? \
+ TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
/* Used for keeping search-specific information. Any search routine
which uses this must define what exactly this slot is used for. */
@@ -3877,7 +3883,7 @@ extern void get_pure_virtuals PROTO((tree));
extern tree init_vbase_pointers PROTO((tree, tree));
extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
extern void clear_search_slots PROTO((tree));
-extern tree get_vbase_types PROTO((tree));
+extern void get_vbase_types PROTO((tree));
extern void maybe_suppress_debug_info PROTO((tree));
extern void note_debug_info_needed PROTO((tree));
extern void push_class_decls PROTO((tree));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e1b27ce..f0b7f8a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12522,7 +12522,7 @@ xref_basetypes (code_type_node, name, ref, binfo)
/* Now that we know all the base-classes, set up the list of virtual
bases. */
- CLASSTYPE_VBASECLASSES (ref) = get_vbase_types (ref);
+ get_vbase_types (ref);
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e841fee..893ee54 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -388,10 +388,7 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
this constructor is the top-level constructor called. */
if (TREE_VIA_VIRTUAL (binfo))
{
- tree v = CLASSTYPE_VBASECLASSES (t);
- while (BINFO_TYPE (v) != BINFO_TYPE (binfo))
- v = TREE_CHAIN (v);
-
+ tree v = BINFO_FOR_VBASE (BINFO_TYPE (binfo), t);
vbases = tree_cons (v, TREE_VALUE (x), vbases);
continue;
}
@@ -916,7 +913,7 @@ expand_member_init (exp, name, init)
&& ! current_template_parms
&& ! vec_binfo_member (basetype,
TYPE_BINFO_BASETYPES (type))
- && ! binfo_member (basetype, CLASSTYPE_VBASECLASSES (type)))
+ && ! BINFO_FOR_VBASE (basetype, type))
{
if (IDENTIFIER_CLASS_VALUE (name))
goto try_member;
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index ba414de..798099a 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -485,8 +485,7 @@ get_base_distance (parent, binfo, protect, path_ptr)
tree, deal with it. This happens when we are called from
expand_upcast_fixups. */
if (rval == -1 && TREE_CODE (parent) == TREE_VEC
- && parent == binfo_member (BINFO_TYPE (parent),
- CLASSTYPE_VBASECLASSES (type)))
+ && parent == BINFO_FOR_VBASE (BINFO_TYPE (parent), type))
{
my_friendly_assert (BINFO_INHERITANCE_CHAIN (parent) == binfo, 980827);
new_binfo = parent;
@@ -1287,8 +1286,7 @@ lookup_field_queue_p (binfo, data)
return NULL_TREE;
if (TREE_VIA_VIRTUAL (binfo))
- return binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (lfi->type));
+ return BINFO_FOR_VBASE (BINFO_TYPE (binfo), lfi->type);
else
return binfo;
}
@@ -2557,7 +2555,7 @@ virtual_context (fndecl, t, vbase)
/* Not sure if checking path == vbase is necessary here, but just in
case it is. */
if (TREE_VIA_VIRTUAL (path) || path == vbase)
- return binfo_member (BINFO_TYPE (path), CLASSTYPE_VBASECLASSES (t));
+ return BINFO_FOR_VBASE (BINFO_TYPE (path), t);
path = BINFO_INHERITANCE_CHAIN (path);
}
}
@@ -2886,7 +2884,7 @@ dfs_get_vbase_types (binfo, data)
depth-first search order. The list is freshly allocated, so
no modification is made to the current binfo hierarchy. */
-tree
+void
get_vbase_types (type)
tree type;
{
@@ -2906,7 +2904,7 @@ get_vbase_types (type)
for (vbases = vbase_types; vbases; vbases = TREE_CHAIN (vbases))
CLEAR_BINFO_VBASE_MARKED (vbases);
- return vbase_types;
+ CLASSTYPE_VBASECLASSES (type) = vbase_types;
}
/* Debug info for C++ classes can get very large; try to avoid
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9d5bfa7..808d702 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6045,8 +6045,7 @@ get_delta_difference (from, to, force)
return delta;
if (binfo_from_vbase (binfo))
{
- binfo = binfo_member (BINFO_TYPE (binfo),
- CLASSTYPE_VBASECLASSES (from));
+ binfo = BINFO_FOR_VBASE (BINFO_TYPE (binfo), from);
cp_warning ("pointer to member cast to virtual base `%T'",
BINFO_TYPE (binfo));
warning (" will only work if you are very careful");