From 2176cbb5b3c12d3e6e14d1b437b61063169e3b14 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 12 Jul 2004 17:11:35 +0000 Subject: [PATCH] cp-tree.h (make_binfo): Remove. * cp-tree.h (make_binfo): Remove. * decl.c (xref_basetypes): Use make_tree_binfo directly. * tree.h (copy_base_binfos): Likewise. (make_binfo): Remove. From-SVN: r84566 --- gcc/cp/ChangeLog | 5 ++++ gcc/cp/cp-tree.h | 1 - gcc/cp/decl.c | 21 +++++++--------- gcc/cp/tree.c | 62 ++++++++++-------------------------------------- 4 files changed, 27 insertions(+), 62 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 392a7321c52..c897bdc6a0b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2004-07-12 Nathan Sidwell + * 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 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 500ad112f45..a8d6f04fa06 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4181,7 +4181,6 @@ extern tree build_cplus_array_type (tree, tree); 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); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 39b0a17c28b..f659b201dd3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9064,7 +9064,10 @@ xref_basetypes (tree ref, tree base_list) /* 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) { @@ -9115,23 +9118,17 @@ xref_basetypes (tree ref, tree base_list) && (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; } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b463fc1bea5..6cb784ad3ba 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -617,9 +617,19 @@ copy_base_binfos (tree binfo, tree t, tree prev) 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)) { @@ -753,52 +763,6 @@ hash_chainon (tree list1, tree list2) hash_chainon (TREE_CHAIN (list1), list2)); } -/* 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) { -- 2.30.2