diff options
| author | Nathan Sidwell <sidwell@codesourcery.com> | 2000-01-28 13:30:13 +0000 |
|---|---|---|
| committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-01-28 13:30:13 +0000 |
| commit | 7267d6924e8ce13cbb4003cb6fe2a83702f8b0cc (patch) | |
| tree | 319612614a1a38c46dc5ff15b2d46fd2af2763f8 /gcc/cp/class.c | |
| parent | 73565a7129b32a8b2e3e463c4e8595b499a75de5 (diff) | |
| download | gcc-7267d6924e8ce13cbb4003cb6fe2a83702f8b0cc.zip gcc-7267d6924e8ce13cbb4003cb6fe2a83702f8b0cc.tar.gz gcc-7267d6924e8ce13cbb4003cb6fe2a83702f8b0cc.tar.bz2 | |
Compiler side new abi rtti (not enabled).
* cp-tree.h (new_abi_rtti_p): New macro.
(emit_support_tinfos): Prototype new function.
(tinfo_decl_p): Likewise.
(emit_tinfo_decl): Likwise.
* rtti.c (TINFO_PSEUDO_TYPE, TINFO_VTABLE_DECL): New accessor
macros.
(doing_runtime): New local static.
(init_rtti_processing): Add new-abi initializer.
(get_tinfo_decl): Add new-abi logic.
(tinfo_from_decl): Likewise.
(build_dynamic_cast_1): Likewise.
(qualifier_flags): New static function.
(tinfo_base_init): Likewise.
(generic_initializer): Likewise.
(ptr_ref_initializer): Likewise.
(ptmd_initializer): Likewise.
(class_hint_flags): Likewise.
(class_initializer): Likewise.
(synthesize_tinfo_var): Likewise.
(create_real_tinfo_var): Likewise.
(create_pseudo_type_info): Likewise.
(get_vmi_pseudo_type_info): Likewise.
(create_tinfo_types): Likewise.
(emit_support_tinfos): New global function.
(tinfo_decl_p): New global predicate.
(emit_tinfo_decl): New global function.
* class.c (set_rtti_entry): Generalize for old and new rtti.
(build_vtbl_initializer): Likewise.
* decl2.c (finish_file): Likewise.
From-SVN: r31668
Diffstat (limited to 'gcc/cp/class.c')
| -rw-r--r-- | gcc/cp/class.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index e7b11f9..7872845 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -963,34 +963,37 @@ static void set_rtti_entry (virtuals, offset, type) tree virtuals, offset, type; { - tree fn; + tree decl; if (CLASSTYPE_COM_INTERFACE (type)) return; if (flag_rtti) - fn = get_tinfo_decl (type); - else + decl = get_tinfo_decl (type); + else if (!new_abi_rtti_p ()) /* If someone tries to get RTTI information for a type compiled without RTTI, they're out of luck. By calling __pure_virtual in this case, we give a small clue as to what went wrong. We could consider having a __no_typeinfo function as well, for a more specific hint. */ - fn = abort_fndecl; + decl = abort_fndecl; + else + /* For the new-abi, we just point to the type_info object. */ + decl = NULL_TREE; if (flag_vtable_thunks) { /* The first slot holds the offset. */ TREE_PURPOSE (virtuals) = offset; - /* The next node holds the function. */ + /* The next node holds the decl. */ virtuals = TREE_CHAIN (virtuals); offset = integer_zero_node; } - /* This slot holds the function to call. */ + /* This slot holds the decl. */ TREE_PURPOSE (virtuals) = offset; - TREE_VALUE (virtuals) = fn; + TREE_VALUE (virtuals) = decl; } /* Get the VAR_DECL of the vtable for TYPE. TYPE need not be polymorphic, @@ -2615,9 +2618,26 @@ build_vtbl_initializer (binfo, t) init = build_vtable_entry (integer_zero_node, init); inits = tree_cons (NULL_TREE, init, inits); - /* Even in this case, the second entry (the tdesc pointer) is - just an ordinary function. */ v = TREE_CHAIN (v); + + if (new_abi_rtti_p ()) + { + tree decl = TREE_VALUE (v); + + if (decl) + decl = build_unary_op (ADDR_EXPR, decl, 0); + else + decl = integer_zero_node; + decl = build1 (NOP_EXPR, vfunc_ptr_type_node, decl); + TREE_CONSTANT (decl) = 1; + decl = build_vtable_entry (integer_zero_node, decl); + inits = tree_cons (NULL_TREE, decl, inits); + + v = TREE_CHAIN (v); + } + /* In the old abi the second entry (the tdesc pointer) is + just an ordinary function, so it can be dealt with like the + virtual functions. */ } /* Go through all the ordinary virtual functions, building up |
