aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-07-15 08:33:27 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-07-15 08:33:27 +0000
commit37a247a0a0fdbe1450ce2284b12b8e7f6c304909 (patch)
tree0369e3e7eea1b2e7d68732896c46407961d4f9db /gcc
parent400053660cdd089c226a6f6fdb4e6793c6384f16 (diff)
downloadgcc-37a247a0a0fdbe1450ce2284b12b8e7f6c304909.zip
gcc-37a247a0a0fdbe1450ce2284b12b8e7f6c304909.tar.gz
gcc-37a247a0a0fdbe1450ce2284b12b8e7f6c304909.tar.bz2
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. (get_vfield_name): Simplify while loop. * decl.c (xref_basetypes): Set CLASSTYPE_NON_AGGREGATE here. From-SVN: r84747
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/class.c39
-rw-r--r--gcc/cp/decl.c6
3 files changed, 25 insertions, 27 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f95168a..703941b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-07-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * class.c (check_bases): Don't set CLASSTYPE_NON_AGGREGATE here.
+ Don't check for incomplete base.
+ (get_vfield_name): Simplify while loop.
+ * decl.c (xref_basetypes): Set CLASSTYPE_NON_AGGREGATE here.
+
2004-07-14 Mark Mitchell <mark@codesourcery.com>
* lex.c (cxx_make_type): Remove call to get_pointer_type.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b292255f..de1aadd 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1198,9 +1198,6 @@ check_bases (tree t,
n_baseclasses = BINFO_N_BASE_BINFOS (TYPE_BINFO (t));
seen_non_virtual_nearly_empty_base_p = 0;
- /* An aggregate cannot have baseclasses. */
- CLASSTYPE_NON_AGGREGATE (t) |= (n_baseclasses != 0);
-
for (i = 0; i < n_baseclasses; ++i)
{
tree base_binfo;
@@ -1210,24 +1207,8 @@ check_bases (tree t,
base_binfo = TREE_VEC_ELT (binfos, i);
basetype = TREE_TYPE (base_binfo);
- /* If the type of basetype is incomplete, then we already
- complained about that fact (and we should have fixed it up as
- well). */
- if (!COMPLETE_TYPE_P (basetype))
- {
- int j;
- /* The base type is of incomplete type. It is
- probably best to pretend that it does not
- exist. */
- if (i == n_baseclasses-1)
- TREE_VEC_ELT (binfos, i) = NULL_TREE;
- TREE_VEC_LENGTH (binfos) -= 1;
- n_baseclasses -= 1;
- for (j = i; j+1 < n_baseclasses; j++)
- TREE_VEC_ELT (binfos, j) = TREE_VEC_ELT (binfos, j+1);
- continue;
- }
-
+ my_friendly_assert (COMPLETE_TYPE_P (basetype), 20040714);
+
/* Effective C++ rule 14. We only need to check TYPE_POLYMORPHIC_P
here because the case of virtual functions but non-virtual
dtor is handled in finish_struct_1. */
@@ -6260,14 +6241,20 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
static tree
get_vfield_name (tree type)
{
- tree binfo = TYPE_BINFO (type);
+ tree binfo, base_binfo;
char *buf;
- while (BINFO_BASE_BINFOS (binfo)
- && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASE_BINFO (binfo, 0)))
- && ! BINFO_VIRTUAL_P (BINFO_BASE_BINFO (binfo, 0)))
- binfo = BINFO_BASE_BINFO (binfo, 0);
+ for (binfo = TYPE_BINFO (type);
+ BINFO_BASE_BINFOS (binfo);
+ binfo = base_binfo)
+ {
+ base_binfo = BINFO_BASE_BINFO (binfo, 0);
+ if (BINFO_VIRTUAL_P (base_binfo)
+ || !TYPE_CONTAINS_VPTR_P (BINFO_TYPE (base_binfo)))
+ break;
+ }
+
type = BINFO_TYPE (binfo);
buf = alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2);
sprintf (buf, VFIELD_NAME_FORMAT,
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7277343..d91709e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9176,7 +9176,11 @@ xref_basetypes (tree ref, tree base_list)
i++;
}
if (i)
- TREE_VEC_LENGTH (accesses) = TREE_VEC_LENGTH (binfos) = i;
+ {
+ TREE_VEC_LENGTH (accesses) = TREE_VEC_LENGTH (binfos) = i;
+ /* An aggregate cannot have baseclasses. */
+ CLASSTYPE_NON_AGGREGATE (ref) = 1;
+ }
else
BINFO_BASE_ACCESSES (binfo) = BINFO_BASE_BINFOS (binfo) = NULL_TREE;
if (max_vbases)