From 70c532b51d855ebd95407556598797406ec4b417 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 15 Mar 1999 13:42:56 +0000 Subject: [PATCH] decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here. * decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here. * tree.c (layout_basetypes): Not here. * search.c (dfs_search): Remove; no longer used. From-SVN: r25789 --- gcc/cp/ChangeLog | 6 +++ gcc/cp/decl.c | 4 ++ gcc/cp/search.c | 39 +------------------ gcc/cp/tree.c | 2 +- .../g++.old-deja/g++.other/lookup9.C | 9 +++++ 5 files changed, 22 insertions(+), 38 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/lookup9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c2b52d4816a..44fbf964dfb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1999-03-15 Mark Mitchell + + * decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here. + * tree.c (layout_basetypes): Not here. + * search.c (dfs_search): Remove; no longer used. + 1999-03-12 Mark Mitchell * decl2.c (validate_nonmember_using_decl): Issue sensible diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2e7a94a725c..88fec144656 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12536,6 +12536,10 @@ xref_basetypes (code_type_node, name, ref, binfo) CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (TREE_VEC_ELT (binfos, i))); CLEAR_CLASSTYPE_MARKED (ref); + /* Now that we know all the base-classes, set up the list of virtual + bases. */ + CLASSTYPE_VBASECLASSES (ref) = get_vbase_types (ref); + pop_obstacks (); } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 6583e696935..0218b56827d 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -2073,41 +2073,6 @@ convert_pointer_to_single_level (to_type, expr) last, 1); } -/* Like dfs_walk, but only walk until fn returns something, and return - that. We also use the real vbase binfos instead of the placeholders - in the normal binfo hierarchy. START is the most-derived type for this - hierarchy, so that we can find the vbase binfos. */ - -static tree -dfs_search (binfo, fn, start) - tree binfo, start; - tree (*fn) PROTO((tree)); -{ - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - tree retval; - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - - if (TREE_CODE (BINFO_TYPE (base_binfo)) == TEMPLATE_TYPE_PARM - || TREE_CODE (BINFO_TYPE (base_binfo)) == TEMPLATE_TEMPLATE_PARM) - /* Pass */; - else - { - if (TREE_VIA_VIRTUAL (base_binfo) && start) - base_binfo = binfo_member (BINFO_TYPE (base_binfo), - CLASSTYPE_VBASECLASSES (start)); - retval = dfs_search (base_binfo, fn, start); - if (retval) - return retval; - } - } - - return fn (binfo); -} - tree markedp (binfo, data) tree binfo; void *data ATTRIBUTE_UNUSED; @@ -3436,8 +3401,8 @@ dfs_bfv_queue_p (binfo, data) return binfo; } -/* Passed to dfs_search by binfo_for_vtable; determine if bvtable comes - from BINFO. */ +/* Passed to dfs_walk_real by binfo_for_vtable; determine if bvtable + comes from BINFO. */ static tree dfs_bfv_helper (binfo, data) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b93d9bd6fd0..126669f3e81 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -640,7 +640,7 @@ layout_basetypes (rec, max) TREE_VALUE slot holds the virtual baseclass type. Note that get_vbase_types makes copies of the virtual base BINFOs, so that the vbase_types are unshared. */ - CLASSTYPE_VBASECLASSES (rec) = vbase_types = get_vbase_types (rec); + vbase_types = CLASSTYPE_VBASECLASSES (rec); my_friendly_assert (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST, 19970302); const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec)); diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup9.C b/gcc/testsuite/g++.old-deja/g++.other/lookup9.C new file mode 100644 index 00000000000..250040071d2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup9.C @@ -0,0 +1,9 @@ +// Build don't link: + +struct S { + typedef long I; +}; + +struct D : virtual public S { + I i; +};