Commit 07b7a812 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (skip_rtti_stuff): Adjust prototype.

	* cp-tree.h (skip_rtti_stuff): Adjust prototype.
	* class.c (skip_rtti_stuff): Reorganize parameters and return value.
	(modify_one_vtable): Adjust.
	(fixup_vtable_deltas1): Likewise.
	(override_one_vtable): Likewise.
	* search.c (get_abstract_virtuals_1): Likewise.
	(get_pure_virtuals): Likewise.
	(expand_upcast_fixups): Likewise.
	* tree.c (debug_binfo): Likewise.

From-SVN: r31163
parent 5e1677bc
2000-01-01 Mark Mitchell <mark@codesourcery.com> 2000-01-01 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (skip_rtti_stuff): Adjust prototype.
* class.c (skip_rtti_stuff): Reorganize parameters and return value.
(modify_one_vtable): Adjust.
(fixup_vtable_deltas1): Likewise.
(override_one_vtable): Likewise.
* search.c (get_abstract_virtuals_1): Likewise.
(get_pure_virtuals): Likewise.
(expand_upcast_fixups): Likewise.
* tree.c (debug_binfo): Likewise.
* class.c (build_vtable): Don't return a value. Don't rebuild * class.c (build_vtable): Don't return a value. Don't rebuild
vtables for bases that have already been handled. vtables for bases that have already been handled.
(prepare_fresh_vtable): Don't rebuild vtables for bases that have (prepare_fresh_vtable): Don't rebuild vtables for bases that have
......
...@@ -2384,39 +2384,48 @@ get_class_offset (context, t, binfo, fndecl) ...@@ -2384,39 +2384,48 @@ get_class_offset (context, t, binfo, fndecl)
return offset; return offset;
} }
/* Skip RTTI information at the front of the virtual list. */ /* Return the BINFO_VIRTUALS list for BINFO, without the RTTI stuff at
the front. If non-NULL, N is set to the number of entries
skipped. */
unsigned HOST_WIDE_INT tree
skip_rtti_stuff (virtuals, t) skip_rtti_stuff (binfo, t, n)
tree *virtuals, t; tree binfo;
tree t;
unsigned HOST_WIDE_INT *n;
{ {
int n; tree virtuals;
if (CLASSTYPE_COM_INTERFACE (t)) if (CLASSTYPE_COM_INTERFACE (t))
return 0; return 0;
n = 0; if (n)
if (*virtuals) *n = 0;
virtuals = BINFO_VIRTUALS (binfo);
if (virtuals)
{ {
/* We always reserve a slot for the offset/tdesc entry. */ /* We always reserve a slot for the offset/tdesc entry. */
++n; if (n)
*virtuals = TREE_CHAIN (*virtuals); ++*n;
virtuals = TREE_CHAIN (virtuals);
} }
if (flag_vtable_thunks && *virtuals) if (flag_vtable_thunks && virtuals)
{ {
/* The second slot is reserved for the tdesc pointer when thunks /* The second slot is reserved for the tdesc pointer when thunks
are used. */ are used. */
++n; if (n)
*virtuals = TREE_CHAIN (*virtuals); ++*n;
virtuals = TREE_CHAIN (virtuals);
} }
return n;
return virtuals;
} }
static void static void
modify_one_vtable (binfo, t, fndecl) modify_one_vtable (binfo, t, fndecl)
tree binfo, t, fndecl; tree binfo, t, fndecl;
{ {
tree virtuals = BINFO_VIRTUALS (binfo); tree virtuals;
unsigned HOST_WIDE_INT n; unsigned HOST_WIDE_INT n;
/* update rtti entry */ /* update rtti entry */
...@@ -2430,7 +2439,7 @@ modify_one_vtable (binfo, t, fndecl) ...@@ -2430,7 +2439,7 @@ modify_one_vtable (binfo, t, fndecl)
if (fndecl == NULL_TREE) if (fndecl == NULL_TREE)
return; return;
n = skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo)); virtuals = skip_rtti_stuff (binfo, BINFO_TYPE (binfo), &n);
while (virtuals) while (virtuals)
{ {
...@@ -2519,10 +2528,10 @@ static void ...@@ -2519,10 +2528,10 @@ static void
fixup_vtable_deltas1 (binfo, t) fixup_vtable_deltas1 (binfo, t)
tree binfo, t; tree binfo, t;
{ {
tree virtuals = BINFO_VIRTUALS (binfo); tree virtuals;
unsigned HOST_WIDE_INT n; unsigned HOST_WIDE_INT n;
n = skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo)); virtuals = skip_rtti_stuff (binfo, BINFO_TYPE (binfo), &n);
while (virtuals) while (virtuals)
{ {
...@@ -2677,8 +2686,8 @@ static void ...@@ -2677,8 +2686,8 @@ static void
override_one_vtable (binfo, old, t) override_one_vtable (binfo, old, t)
tree binfo, old, t; tree binfo, old, t;
{ {
tree virtuals = BINFO_VIRTUALS (binfo); tree virtuals;
tree old_virtuals = BINFO_VIRTUALS (old); tree old_virtuals;
enum { REUSE_NEW, REUSE_OLD, UNDECIDED, NEITHER } choose = UNDECIDED; enum { REUSE_NEW, REUSE_OLD, UNDECIDED, NEITHER } choose = UNDECIDED;
/* If we have already committed to modifying it, then don't try and /* If we have already committed to modifying it, then don't try and
...@@ -2686,8 +2695,8 @@ override_one_vtable (binfo, old, t) ...@@ -2686,8 +2695,8 @@ override_one_vtable (binfo, old, t)
if (BINFO_NEW_VTABLE_MARKED (binfo)) if (BINFO_NEW_VTABLE_MARKED (binfo))
choose = NEITHER; choose = NEITHER;
skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo)); virtuals = skip_rtti_stuff (binfo, BINFO_TYPE (binfo), NULL);
skip_rtti_stuff (&old_virtuals, BINFO_TYPE (binfo)); old_virtuals = skip_rtti_stuff (old, BINFO_TYPE (binfo), NULL);
while (virtuals) while (virtuals)
{ {
......
...@@ -3394,7 +3394,7 @@ extern void push_lang_context PROTO((tree)); ...@@ -3394,7 +3394,7 @@ extern void push_lang_context PROTO((tree));
extern void pop_lang_context PROTO((void)); extern void pop_lang_context PROTO((void));
extern tree instantiate_type PROTO((tree, tree, int)); extern tree instantiate_type PROTO((tree, tree, int));
extern void print_class_statistics PROTO((void)); extern void print_class_statistics PROTO((void));
extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree)); extern tree skip_rtti_stuff PROTO((tree, tree, unsigned HOST_WIDE_INT *));
extern void build_self_reference PROTO((void)); extern void build_self_reference PROTO((void));
extern void warn_hidden PROTO((tree)); extern void warn_hidden PROTO((tree));
extern tree get_enclosing_class PROTO((tree)); extern tree get_enclosing_class PROTO((tree));
......
...@@ -2129,9 +2129,9 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals) ...@@ -2129,9 +2129,9 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
/* Should we use something besides CLASSTYPE_VFIELDS? */ /* Should we use something besides CLASSTYPE_VFIELDS? */
if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
{ {
tree virtuals = BINFO_VIRTUALS (binfo); tree virtuals;
skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo)); virtuals = skip_rtti_stuff (binfo, BINFO_TYPE (binfo), NULL);
while (virtuals) while (virtuals)
{ {
...@@ -2160,9 +2160,9 @@ get_pure_virtuals (type) ...@@ -2160,9 +2160,9 @@ get_pure_virtuals (type)
for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; vbases = TREE_CHAIN (vbases)) for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; vbases = TREE_CHAIN (vbases))
{ {
tree virtuals = BINFO_VIRTUALS (vbases); tree virtuals;
skip_rtti_stuff (&virtuals, BINFO_TYPE (vbases)); virtuals = skip_rtti_stuff (vbases, BINFO_TYPE (vbases), NULL);
while (virtuals) while (virtuals)
{ {
...@@ -2598,7 +2598,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t, ...@@ -2598,7 +2598,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
vbase_offsets) vbase_offsets)
tree binfo, addr, orig_addr, vbase, vbase_addr, t, *vbase_offsets; tree binfo, addr, orig_addr, vbase, vbase_addr, t, *vbase_offsets;
{ {
tree virtuals = BINFO_VIRTUALS (binfo); tree virtuals;
tree vc; tree vc;
tree delta; tree delta;
unsigned HOST_WIDE_INT n; unsigned HOST_WIDE_INT n;
...@@ -2613,7 +2613,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t, ...@@ -2613,7 +2613,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
*vbase_offsets = delta; *vbase_offsets = delta;
} }
n = skip_rtti_stuff (&virtuals, BINFO_TYPE (binfo)); virtuals = skip_rtti_stuff (binfo, BINFO_TYPE (binfo), &n);
while (virtuals) while (virtuals)
{ {
......
...@@ -1165,9 +1165,7 @@ debug_binfo (elem) ...@@ -1165,9 +1165,7 @@ debug_binfo (elem)
else else
fprintf (stderr, "no vtable decl yet\n"); fprintf (stderr, "no vtable decl yet\n");
fprintf (stderr, "virtuals:\n"); fprintf (stderr, "virtuals:\n");
virtuals = BINFO_VIRTUALS (elem); virtuals = skip_rtti_stuff (elem, BINFO_TYPE (elem), &n);
n = skip_rtti_stuff (&virtuals, BINFO_TYPE (elem));
while (virtuals) while (virtuals)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment