2004-07-12 Nathan Sidwell <nathan@codesourcery.com>
+ * cp-tree.h (make_binfo): Remove.
+ * decl.c (xref_basetypes): Use make_tree_binfo directly.
+ * tree.h (copy_base_binfos): Likewise.
+ (make_binfo): Remove.
+
* call.c (build_user_type_conversion_1, build_new_op,
check_constructor_callable, build_temp,
perform_direct_initialization_of_possible): Pass type directly to
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
extern tree hash_chainon (tree, tree);
-extern tree make_binfo (tree, tree, tree, tree);
extern int count_functions (tree);
extern int is_overloaded_fn (tree);
extern tree get_first_fn (tree);
/* The binfo slot should be empty, unless this is an (ill-formed)
redefinition. */
my_friendly_assert (!TYPE_BINFO (ref) || TYPE_SIZE (ref), 20040706);
- TYPE_BINFO (ref) = make_binfo (size_zero_node, ref, NULL_TREE, NULL_TREE);
+ my_friendly_assert (TYPE_MAIN_VARIANT (ref) == ref, 20040712);
+ TYPE_BINFO (ref) = make_tree_binfo (BINFO_LANG_SLOTS);
+ BINFO_OFFSET (TYPE_BINFO (ref)) = size_zero_node;
+ BINFO_TYPE (TYPE_BINFO (ref)) = ref;
if (i)
{
&& (current_lang_depth () == 0))
TYPE_FOR_JAVA (ref) = 1;
- if (CLASS_TYPE_P (basetype))
+ if (CLASS_TYPE_P (basetype) && !dependent_type_p (basetype))
{
base_binfo = TYPE_BINFO (basetype);
- if (dependent_type_p (basetype))
- {
- base_binfo = make_binfo (size_zero_node, basetype,
- NULL_TREE, NULL_TREE);
- BINFO_DEPENDENT_BASE_P (base_binfo) = 1;
- }
- else
- my_friendly_assert (base_binfo, 20040706);
+ my_friendly_assert (base_binfo, 20040706);
}
else
{
- base_binfo = make_binfo (size_zero_node, basetype,
- NULL_TREE, NULL_TREE);
+ base_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
+
+ BINFO_TYPE (base_binfo) = basetype;
BINFO_DEPENDENT_BASE_P (base_binfo) = 1;
}
if (!new_binfo)
{
- new_binfo = make_binfo (BINFO_OFFSET (base_binfo),
- base_binfo, NULL_TREE,
- BINFO_VIRTUALS (base_binfo));
+ new_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
+
+ BINFO_TYPE (new_binfo) = BINFO_TYPE (base_binfo);
+ BINFO_OFFSET (new_binfo) = BINFO_OFFSET (base_binfo);
+ BINFO_VIRTUALS (new_binfo) = BINFO_VIRTUALS (base_binfo);
+
+ if (BINFO_BASE_BINFOS (base_binfo))
+ /* Duplicate the binfo's base vector, so we can recurse. */
+ BINFO_BASE_BINFOS (new_binfo)
+ = copy_node (BINFO_BASE_BINFOS (base_binfo));
+ /* We do not need to copy the accesses, as they are read only. */
+ BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (base_binfo);
+
prev = copy_base_binfos (new_binfo, t, prev);
if (BINFO_VIRTUAL_P (base_binfo))
{
hash_chainon (TREE_CHAIN (list1), list2));
}
\f
-/* Build an association between TYPE and some parameters:
-
- OFFSET is the offset added to `this' to convert it to a pointer
- of type `TYPE *'
-
- BINFO is the base binfo to use, if we are deriving from one. This
- is necessary, as we want specialized parent binfos from base
- classes, so that the VTABLE_NAMEs of bases are for the most derived
- type, instead of the simple type.
-
- VTABLE is the virtual function table with which to initialize
- sub-objects of type TYPE.
-
- VIRTUALS are the virtual functions sitting in VTABLE. */
-
-tree
-make_binfo (tree offset, tree binfo, tree vtable, tree virtuals)
-{
- tree new_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
- tree type;
-
- if (TREE_CODE (binfo) == TREE_BINFO)
- {
- type = BINFO_TYPE (binfo);
- my_friendly_assert (!BINFO_DEPENDENT_BASE_P (binfo), 20040706);
- }
- else
- {
- type = binfo;
- binfo = NULL_TREE;
- }
-
- TREE_TYPE (new_binfo) = TYPE_MAIN_VARIANT (type);
- BINFO_OFFSET (new_binfo) = offset;
- BINFO_VTABLE (new_binfo) = vtable;
- BINFO_VIRTUALS (new_binfo) = virtuals;
-
- if (binfo && BINFO_BASE_BINFOS (binfo))
- {
- BINFO_BASE_BINFOS (new_binfo) = copy_node (BINFO_BASE_BINFOS (binfo));
- /* We do not need to copy the accesses, as they are read only. */
- BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (binfo);
- }
- return new_binfo;
-}
-
void
debug_binfo (tree elem)
{