Commit 132c7dd3 by Nathan Sidwell Committed by Nathan Sidwell

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
parent 769d99d9
2004-07-15 Nathan Sidwell <nathan@codesourcery.com> 2004-07-15 Nathan Sidwell <nathan@codesourcery.com>
* 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. * class.c (check_bases): Don't set CLASSTYPE_NON_AGGREGATE here.
Don't check for incomplete base. Don't check for incomplete base.
(get_vfield_name): Simplify while loop. (get_vfield_name): Simplify while loop.
......
...@@ -1464,7 +1464,7 @@ determine_primary_base (tree t) ...@@ -1464,7 +1464,7 @@ determine_primary_base (tree t)
static void static void
finish_struct_bits (tree t) 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). */ /* Fix up variants (if any). */
tree variants = TYPE_NEXT_VARIANT (t); tree variants = TYPE_NEXT_VARIANT (t);
...@@ -1497,34 +1497,19 @@ finish_struct_bits (tree t) ...@@ -1497,34 +1497,19 @@ finish_struct_bits (tree t)
if (n_baseclasses && TYPE_POLYMORPHIC_P (t)) if (n_baseclasses && TYPE_POLYMORPHIC_P (t))
/* For a class w/o baseclasses, `finish_struct' has set /* For a class w/o baseclasses, `finish_struct' has set
CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by definition).
definition). Similarly for a class whose base classes do not Similarly for a class whose base classes do not have vtables.
have vtables. When neither of these is true, we might have When neither of these is true, we might have removed abstract
removed abstract virtuals (by providing a definition), added virtuals (by providing a definition), added some (by declaring
some (by declaring new ones), or redeclared ones from a base new ones), or redeclared ones from a base class. We need to
class. We need to recalculate what's really an abstract virtual recalculate what's really an abstract virtual at this point (by
at this point (by looking in the vtables). */ looking in the vtables). */
get_pure_virtuals (t); get_pure_virtuals (t);
if (n_baseclasses) /* If this type has a copy constructor or a destructor, force its
{ mode to be BLKmode, and force its TREE_ADDRESSABLE bit to be
/* Notice whether this class has type conversion functions defined. */ nonzero. This will cause it to be passed by invisible reference
tree binfo = TYPE_BINFO (t); and prevent it from being returned in a register. */
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. */
if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
{ {
tree variants; tree variants;
......
...@@ -9170,6 +9170,7 @@ xref_basetypes (tree ref, tree base_list) ...@@ -9170,6 +9170,7 @@ xref_basetypes (tree ref, tree base_list)
base as well. */ base as well. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref)
|= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype); |= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype);
TYPE_HAS_CONVERSION (ref) |= TYPE_HAS_CONVERSION (basetype);
max_vbases += VEC_length max_vbases += VEC_length
(tree, CLASSTYPE_VBASECLASSES (basetype)); (tree, CLASSTYPE_VBASECLASSES (basetype));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment