Commit 0871761b by Nathan Sidwell Committed by Nathan Sidwell

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
parent c1b763fa
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> 2004-07-27 Kelley Cook <kcook@gcc.gnu.org>
* pt.c, typeck.c: Remove spurious carriage returns. * pt.c, typeck.c: Remove spurious carriage returns.
......
...@@ -1955,17 +1955,19 @@ find_final_overrider (tree derived, tree binfo, tree fn) ...@@ -1955,17 +1955,19 @@ find_final_overrider (tree derived, tree binfo, tree fn)
static tree static tree
get_vcall_index (tree fn, tree type) 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)) for (ix = 0; VEC_iterate (tree_pair_s, indices, ix, p); ix++)
if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (TREE_PURPOSE (v))) if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (p->purpose))
|| same_signature_p (fn, TREE_PURPOSE (v))) || same_signature_p (fn, p->purpose))
break; return p->value;
/* There should always be an appropriate index. */ /* 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 /* 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) ...@@ -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 the vtable for the most derived class, remember the vcall
offset. */ offset. */
if (vid->binfo == TYPE_BINFO (vid->derived)) if (vid->binfo == TYPE_BINFO (vid->derived))
CLASSTYPE_VCALL_INDICES (vid->derived) {
= tree_cons (orig_fn, vid->index, tree_pair_p elt = VEC_safe_push (tree_pair_s,
CLASSTYPE_VCALL_INDICES (vid->derived)); 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 /* The next vcall offset will be found at a more negative
offset. */ offset. */
vid->index = size_binop (MINUS_EXPR, vid->index, vid->index = size_binop (MINUS_EXPR, vid->index,
......
...@@ -933,9 +933,18 @@ enum languages { lang_c, lang_cplusplus, lang_java }; ...@@ -933,9 +933,18 @@ enum languages { lang_c, lang_cplusplus, lang_java };
!= NULL_TREE) != NULL_TREE)
/* Gives the visibility specification for a class type. */ /* Gives the visibility specification for a class type. */
#define CLASSTYPE_VISIBILITY(TYPE) DECL_VISIBILITY (TYPE_NAME (TYPE)) #define CLASSTYPE_VISIBILITY(TYPE) \
#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) DECL_VISIBILITY_SPECIFIED (TYPE_NAME (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, /* This is a few header flags for 'struct lang_type'. Actually,
all but the first are used only for lang_type_class; they all but the first are used only for lang_type_class; they
...@@ -1020,7 +1029,7 @@ struct lang_type_class GTY(()) ...@@ -1020,7 +1029,7 @@ struct lang_type_class GTY(())
unsigned dummy : 8; unsigned dummy : 8;
tree primary_base; tree primary_base;
tree vcall_indices; VEC (tree_pair_s) *vcall_indices;
tree vtables; tree vtables;
tree typeinfo_var; tree typeinfo_var;
VEC (tree) *vbases; VEC (tree) *vbases;
...@@ -1432,11 +1441,11 @@ struct lang_type GTY(()) ...@@ -1432,11 +1441,11 @@ struct lang_type GTY(())
/* Used by various search routines. */ /* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE) #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
/* A TREE_LIST of the vcall indices associated with the class NODE. /* A VEC(tree_pair_s) of the vcall indices associated with the class
The TREE_PURPOSE of each node is a FUNCTION_DECL for a virtual NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual
function. The TREE_VALUE is the index into the virtual table where function. The VALUE is the index into the virtual table where the
the vcall offset for that function is stored, when NODE is a vcall offset for that function is stored, when NODE is a virtual
virtual base. */ base. */
#define CLASSTYPE_VCALL_INDICES(NODE) \ #define CLASSTYPE_VCALL_INDICES(NODE) \
(LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices) (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
......
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