diff options
| author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-20 13:46:43 +0000 |
|---|---|---|
| committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-20 13:46:43 +0000 |
| commit | 4e88b09a9ed290bef31b75424db526024c80de98 (patch) | |
| tree | e31689fea107893a0dd14fdbbf6fbd860fad82b9 /gcc/cp/class.c | |
| parent | f6cc6a0817157a9069e1989d975a08a7e299cb9f (diff) | |
| download | ppe42-gcc-4e88b09a9ed290bef31b75424db526024c80de98.tar.gz ppe42-gcc-4e88b09a9ed290bef31b75424db526024c80de98.zip | |
* cp-tree.h (struct lang_type_class): Remove vfields field.
(CLASSTYPE_VFIELDS): Remove.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
* class.c (determine_primary_base): Remove CLASSTYPE_VFIELDS
handling.
(dfs_modify_vtables): Use TYPE_CONTAINS_VPTR_P.
(finish_struct_1): Remove CLASSTYPE_VFIELDS handling.
* init.c (dfs_initialize_vtbl_ptrs): Use TYPE_CONTAINS_VPTR_P.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84950 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
| -rw-r--r-- | gcc/cp/class.c | 52 |
1 files changed, 7 insertions, 45 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 70374eb9e7b..169dd917ed7 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1282,25 +1282,7 @@ determine_primary_base (tree t) continue; if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) - { - set_primary_base (t, base_binfo); - CLASSTYPE_VFIELDS (t) = copy_list (CLASSTYPE_VFIELDS (basetype)); - } - else - { - tree vfields; - - /* Only add unique vfields, and flatten them out as we go. */ - for (vfields = CLASSTYPE_VFIELDS (basetype); - vfields; - vfields = TREE_CHAIN (vfields)) - if (VF_BINFO_VALUE (vfields) == NULL_TREE - || ! BINFO_VIRTUAL_P (VF_BINFO_VALUE (vfields))) - CLASSTYPE_VFIELDS (t) - = tree_cons (base_binfo, - VF_BASETYPE_VALUE (vfields), - CLASSTYPE_VFIELDS (t)); - } + set_primary_base (t, base_binfo); } } @@ -1382,11 +1364,7 @@ determine_primary_base (tree t) /* If we've got a primary base, use it. */ if (candidate) - { - set_primary_base (t, candidate); - CLASSTYPE_VFIELDS (t) - = copy_list (CLASSTYPE_VFIELDS (BINFO_TYPE (candidate))); - } + set_primary_base (t, candidate); } /* Mark the primary base classes at this point. */ @@ -2193,15 +2171,18 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, static tree dfs_modify_vtables (tree binfo, void* data) { + tree t = (tree) data; + if (/* There's no need to modify the vtable for a non-virtual primary base; we're not going to use that vtable anyhow. We do still need to do this for virtual primary bases, as they could become non-primary in a construction vtable. */ (!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo)) /* Similarly, a base without a vtable needs no modification. */ - && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) + && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)) + /* Don't do the primary vtable, if it's new. */ + && (BINFO_TYPE (binfo) != t || CLASSTYPE_HAS_PRIMARY_BASE_P (t))) { - tree t = (tree) data; tree virtuals; tree old_virtuals; unsigned ix; @@ -4963,12 +4944,6 @@ finish_struct_1 (tree t) virtuals = modify_all_vtables (t, nreverse (virtuals)); - /* If we created a new vtbl pointer for this class, add it to the - list. */ - if (TYPE_VFIELD (t) && !CLASSTYPE_HAS_PRIMARY_BASE_P (t)) - CLASSTYPE_VFIELDS (t) - = chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t)); - /* If necessary, create the primary vtable for this class. */ if (virtuals || TYPE_CONTAINS_VPTR_P (t)) { @@ -5046,19 +5021,6 @@ finish_struct_1 (tree t) DECL_SORTED_FIELDS (TYPE_MAIN_DECL (t)) = field_vec; } - if (TYPE_HAS_CONSTRUCTOR (t)) - { - tree vfields = CLASSTYPE_VFIELDS (t); - - for (vfields = CLASSTYPE_VFIELDS (t); - vfields; vfields = TREE_CHAIN (vfields)) - /* Mark the fact that constructor for T could affect anybody - inheriting from T who wants to initialize vtables for - VFIELDS's type. */ - if (VF_BINFO_VALUE (vfields)) - TREE_ADDRESSABLE (vfields) = 1; - } - /* Make the rtl for any new vtables we have created, and unmark the base types we marked. */ finish_vtbls (t); |

