From: Nathan Sidwell Date: Thu, 15 Jul 2004 15:06:26 +0000 (+0000) Subject: class.c (finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=132c7dd3d966066e2c031b7ed31690b5ec933705;p=gcc.git class.c (finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. * class.c(finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. * decl.c (xref_basetypes): Set it here. From-SVN: r84756 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 703941bad9b..75ae59c4b9b 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 de1aadded39..2957ac1be14 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 d91709ea45d..1c547f641f9 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)); }