aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-07-15 15:06:26 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-07-15 15:06:26 +0000
commit132c7dd3d966066e2c031b7ed31690b5ec933705 (patch)
treed0bcfe2d119966b5f8e0d007d0cce4496738ad27 /gcc
parent769d99d9cdc419ccc801f369f0043281054b5452 (diff)
downloadgcc-132c7dd3d966066e2c031b7ed31690b5ec933705.zip
gcc-132c7dd3d966066e2c031b7ed31690b5ec933705.tar.gz
gcc-132c7dd3d966066e2c031b7ed31690b5ec933705.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/class.c43
-rw-r--r--gcc/cp/decl.c1
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 <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.
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));
}