* 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
+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.
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
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,
!= 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
unsigned dummy : 8;
tree primary_base;
- tree vcall_indices;
+ VEC (tree_pair_s) *vcall_indices;
tree vtables;
tree typeinfo_var;
VEC (tree) *vbases;
/* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
\f
-/* 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)