cp-tree.h (struct tree_pair_s): New.

* cp-tree.h (struct tree_pair_s): New.
	(typedef tree_pair_p): New.
	(DEF_VEC_O(tree_pair_s)): New.
	(struct lang_type_class): Make vcall_indices a VEC(tree_pair_s).
	(CLASSTYPE_VCALL_INDICES): Update documentation.
	* class.c (get_vcall_index): Adjust.
	(add_vcall_offset): Adjust.

From-SVN: r85256
This commit is contained in:
Nathan Sidwell 2004-07-28 08:50:27 +00:00 committed by Nathan Sidwell
parent c1b763fa9a
commit 0871761b07
3 changed files with 44 additions and 19 deletions

View File

@ -1,3 +1,13 @@
2004-07-28 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (struct tree_pair_s): New.
(typedef tree_pair_p): New.
(DEF_VEC_O(tree_pair_s)): New.
(struct lang_type_class): Make vcall_indices a VEC(tree_pair_s).
(CLASSTYPE_VCALL_INDICES): Update documentation.
* class.c (get_vcall_index): Adjust.
(add_vcall_offset): Adjust.
2004-07-27 Kelley Cook <kcook@gcc.gnu.org>
* pt.c, typeck.c: Remove spurious carriage returns.

View File

@ -1955,17 +1955,19 @@ find_final_overrider (tree derived, tree binfo, tree fn)
static tree
get_vcall_index (tree fn, tree type)
{
tree v;
VEC (tree_pair_s) *indices = CLASSTYPE_VCALL_INDICES (type);
tree_pair_p p;
unsigned ix;
for (v = CLASSTYPE_VCALL_INDICES (type); v; v = TREE_CHAIN (v))
if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (TREE_PURPOSE (v)))
|| same_signature_p (fn, TREE_PURPOSE (v)))
break;
for (ix = 0; VEC_iterate (tree_pair_s, indices, ix, p); ix++)
if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (p->purpose))
|| same_signature_p (fn, p->purpose))
return p->value;
/* There should always be an appropriate index. */
my_friendly_assert (v, 20021103);
abort ();
return TREE_VALUE (v);
return NULL_TREE;
}
/* Update an entry in the vtable for BINFO, which is in the hierarchy
@ -7682,10 +7684,14 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
the vtable for the most derived class, remember the vcall
offset. */
if (vid->binfo == TYPE_BINFO (vid->derived))
CLASSTYPE_VCALL_INDICES (vid->derived)
= tree_cons (orig_fn, vid->index,
CLASSTYPE_VCALL_INDICES (vid->derived));
{
tree_pair_p elt = VEC_safe_push (tree_pair_s,
CLASSTYPE_VCALL_INDICES (vid->derived),
NULL);
elt->purpose = orig_fn;
elt->value = vid->index;
}
/* The next vcall offset will be found at a more negative
offset. */
vid->index = size_binop (MINUS_EXPR, vid->index,

View File

@ -933,9 +933,18 @@ enum languages { lang_c, lang_cplusplus, lang_java };
!= NULL_TREE)
/* Gives the visibility specification for a class type. */
#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE))
#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE))
#define CLASSTYPE_VISIBILITY(TYPE) \
DECL_VISIBILITY (TYPE_NAME (TYPE))
#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \
DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE))
typedef struct tree_pair_s GTY (())
{
tree purpose;
tree value;
} tree_pair_s;
typedef tree_pair_s *tree_pair_p;
DEF_VEC_O (tree_pair_s);
/* This is a few header flags for 'struct lang_type'. Actually,
all but the first are used only for lang_type_class; they
@ -1020,7 +1029,7 @@ struct lang_type_class GTY(())
unsigned dummy : 8;
tree primary_base;
tree vcall_indices;
VEC (tree_pair_s) *vcall_indices;
tree vtables;
tree typeinfo_var;
VEC (tree) *vbases;
@ -1432,11 +1441,11 @@ struct lang_type GTY(())
/* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* A TREE_LIST of the vcall indices associated with the class NODE.
The TREE_PURPOSE of each node is a FUNCTION_DECL for a virtual
function. The TREE_VALUE is the index into the virtual table where
the vcall offset for that function is stored, when NODE is a
virtual base. */
/* A VEC(tree_pair_s) of the vcall indices associated with the class
NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual
function. The VALUE is the index into the virtual table where the
vcall offset for that function is stored, when NODE is a virtual
base. */
#define CLASSTYPE_VCALL_INDICES(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)