From b4a0d48d734457cc1d61ffeb996f930ff8bbc7fc Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 15 Jul 2004 15:06:26 +0000 Subject: [PATCH] * class.c(finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. * decl.c (xref_basetypes): Set it here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84756 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/class.c | 43 ++++++++++++++----------------------------- gcc/cp/decl.c | 1 + 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 703941b..75ae59c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2004-07-15 Nathan Sidwell + * class.c(finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. + * decl.c (xref_basetypes): Set it here. + * class.c (check_bases): Don't set CLASSTYPE_NON_AGGREGATE here. Don't check for incomplete base. (get_vfield_name): Simplify while loop. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index de1aadd..2957ac1 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1464,7 +1464,7 @@ determine_primary_base (tree t) static void finish_struct_bits (tree t) { - int i, n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); + int n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t)); /* Fix up variants (if any). */ tree variants = TYPE_NEXT_VARIANT (t); @@ -1497,34 +1497,19 @@ finish_struct_bits (tree t) if (n_baseclasses && TYPE_POLYMORPHIC_P (t)) /* For a class w/o baseclasses, `finish_struct' has set - CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by - definition). Similarly for a class whose base classes do not - have vtables. When neither of these is true, we might have - removed abstract virtuals (by providing a definition), added - some (by declaring new ones), or redeclared ones from a base - class. We need to recalculate what's really an abstract virtual - at this point (by looking in the vtables). */ - get_pure_virtuals (t); - - if (n_baseclasses) - { - /* Notice whether this class has type conversion functions defined. */ - tree binfo = TYPE_BINFO (t); - tree binfos = BINFO_BASE_BINFOS (binfo); - tree basetype; - - for (i = n_baseclasses-1; i >= 0; i--) - { - basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i)); - - TYPE_HAS_CONVERSION (t) |= TYPE_HAS_CONVERSION (basetype); - } - } - - /* If this type has a copy constructor or a destructor, force its mode to - be BLKmode, and force its TREE_ADDRESSABLE bit to be nonzero. This - will cause it to be passed by invisible reference and prevent it from - being returned in a register. */ + CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by definition). + Similarly for a class whose base classes do not have vtables. + When neither of these is true, we might have removed abstract + virtuals (by providing a definition), added some (by declaring + new ones), or redeclared ones from a base class. We need to + recalculate what's really an abstract virtual at this point (by + looking in the vtables). */ + get_pure_virtuals (t); + + /* If this type has a copy constructor or a destructor, force its + mode to be BLKmode, and force its TREE_ADDRESSABLE bit to be + nonzero. This will cause it to be passed by invisible reference + and prevent it from being returned in a register. */ if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) { tree variants; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d91709e..1c547f6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9170,6 +9170,7 @@ xref_basetypes (tree ref, tree base_list) base as well. */ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) |= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype); + TYPE_HAS_CONVERSION (ref) |= TYPE_HAS_CONVERSION (basetype); max_vbases += VEC_length (tree, CLASSTYPE_VBASECLASSES (basetype)); } -- 2.7.4