diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-01-17 04:08:01 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-01-17 04:08:01 +0000 |
commit | bbd15aac6fc179e9cb610f89f681c574a68f038c (patch) | |
tree | 42b7f7c924e40aafb6389868bb1bc5b33ec746bc /gcc/cp/rtti.c | |
parent | 2a198bc4bf775957b2cfbe5cf2b21b5f3c2d1482 (diff) | |
download | gcc-bbd15aac6fc179e9cb610f89f681c574a68f038c.zip gcc-bbd15aac6fc179e9cb610f89f681c574a68f038c.tar.gz gcc-bbd15aac6fc179e9cb610f89f681c574a68f038c.tar.bz2 |
cp-tree.h (flag_new_abi): Move.
* cp-tree.h (flag_new_abi): Move.
(flag_use_cxa_atexit): Likewise.
(flag_honor_std): Likewise.
(flag_rtti): Likewise.
(vbase_offsets_in_vtable_p): Define.
(vptrs_present_everywhere_p): Likewise.
(TYPE_CONTAINS_VPTR_P): Likewise.
(dfs_walk_real): Declare.
* class.c (build_vbase_pointer_fields): Check
vbase_offsets_in_vtable_p.
(dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in
BINFO_VPTR_FIELD.
(build_vbase_offset_vtbl_entries): Simplify.
(build_vbase_offset_vtbl_entries): Adjust.
(build_vbase_pointer): Add ability to look up vbase offsets in
vtable.
(start_vtable): New function.
(add_virtual_function): Use it.
(determine_primary_base): Use TYPE_CONTAINS_VPTR_P.
(num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p.
(build_vtbl_initializer): Take the type of the complete object as
input. Use it to correctly calculate vbase offsets.
(dfs_finish_vtbls): Pass the complete type to
build_vtbl_initializer.
(check_bases_and_members): Use TYPE_CONTAINS_VPTR_P.
(create_vtable_ptr): Create a vtable even if there are no
new virtual functions, under the new ABI.
(finish_struct_1): Likewise.
(get_vfield_name): Use TYPE_CONTAINS_VPTR_P.
* decl.c (exapnd_static_init): Remove call to
preserve_initializer.
* decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in
vtables.
* init.c (initialize_vtbl_ptrs): Initialize them in pre-order.
(expand_virtual_init): Use vbase_offsets_in_vtable_p.
(construct_virtual_bases): Don't initialize virtual base pointers
under the new ABI.
(build_aggr_init): Clean up comment.
(expand_aggr_init_1): Likewise.
* rtti.c (expand_class_desc): Store the virtual function table
index where the vbase offset lives in the offset field.
* search.c (dfs_walk_real): Make it global.
(dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P.
* tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD.
* tinfo.h (USItype): Make it signed under the new ABI.
* tinfo.cc (convert_to_base): New function. Encapsulate base
conversion logic here.
(__class_type_info::do_upcast): Use it.
(__class_type_info::do_dyncast): Likewise.
(__class_type_info::do_find_public_subobj): Likewise.
From-SVN: r31452
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r-- | gcc/cp/rtti.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 74113ab..cddefe7d 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -1,5 +1,5 @@ /* RunTime Type Identification - Copyright (C) 1995, 96-97, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1995, 96-97, 1998, 1999, 2000 Free Software Foundation, Inc. Mostly written by Jason Merrill (jason@cygnus.com). This file is part of GNU CC. @@ -811,7 +811,8 @@ expand_class_desc (tdecl, type) (type_info_type_node, TYPE_QUAL_CONST))); fields [1] = build_lang_decl - (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node); + (FIELD_DECL, NULL_TREE, + flag_new_abi ? intSI_type_node : unsigned_intSI_type_node); DECL_BIT_FIELD (fields[1]) = 1; DECL_FIELD_SIZE (fields[1]) = 29; @@ -839,15 +840,26 @@ expand_class_desc (tdecl, type) if (TREE_VIA_VIRTUAL (binfo)) { - tree t = BINFO_TYPE (binfo); - const char *name; - tree field; - - FORMAT_VBASE_NAME (name, t); - field = lookup_field (type, get_identifier (name), 0, 0); - offset = size_binop (FLOOR_DIV_EXPR, - DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT)); - offset = convert (sizetype, offset); + if (!vbase_offsets_in_vtable_p ()) + { + tree t = BINFO_TYPE (binfo); + const char *name; + tree field; + + FORMAT_VBASE_NAME (name, t); + field = lookup_field (type, get_identifier (name), 0, 0); + offset = size_binop (FLOOR_DIV_EXPR, + DECL_FIELD_BITPOS (field), + size_int (BITS_PER_UNIT)); + offset = convert (sizetype, offset); + } + else + { + /* Under the new ABI, we store the vtable offset at which + the virtual base offset can be found. */ + tree vbase = BINFO_FOR_VBASE (BINFO_TYPE (binfo), type); + offset = convert (sizetype, BINFO_VPTR_FIELD (vbase)); + } } else offset = BINFO_OFFSET (binfo); |