summaryrefslogtreecommitdiff
path: root/gcc/cp/except.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-12 07:48:13 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-12 07:48:13 +0000
commitf04596da7acdf62fd10b7cc69bedc50e1e28fbf7 (patch)
tree1607e4b03e19e5a1a352f78d3cd7ac33ece46c16 /gcc/cp/except.c
parent9e9aeda163538477eb6c509185dda1078615cf64 (diff)
downloadgcc-f04596da7acdf62fd10b7cc69bedc50e1e28fbf7.tar.gz
* cp-tree.h (IDENTIFIER_CTOR_OR_DTOR_P): New macro.
(cp_tree_index): Add CPTI_PUSH_EXCEPTION_IDENTIFIER. (cp_push_exception_identifier): New macro. (DECL_COMPLETE_DESTRUCTOR_P): New macro. (DECL_BASE_DESTRUCTOR_P): Likewise. (DECL_DELETING_DESTRUCTOR_P): Likewise. (get_vtbl_decl_for_binfo): Fix formatting. (in_charge_arg_for_name): New macro. (maybe_build_cleanup_and_delete): Remove declaration. * call.c (build_field_call): Use IDENTIFIER_CTOR_OR_DTOR_P. (in_charge_arg_for_name): New function. (build_new_method_call): Use it. Handle cloned destructors. (build_clone): Don't make the base constructor virtual. Automatically defer generated functions. (clone_function_decl): Handle destructors, too. (clone_constructors_and_destructors): Likewise. (create_vtable_ptr): Don't create a vtable entry for a cloned function. * decl.c (predefined_identifier): Add ctor_or_dtor_p. (initialize_predefined_identifiers): Update appropriately. (finish_destructor_body): Simplify. (maybe_build_cleanup_and_delete): Remove. * except.c (expand_throw): Handle new-ABI destructors. * init.c (expand_cleanup_for_base): Use base_dtor_identifier. (build_dtor_call): New function. (build_delete): Use it. Simplify. * optimize.c (maybe_clone_body): Handle destructors. * search.c (lookup_field_queue_p): Use IDENTIFIER_CTOR_OR_DTOR_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r--gcc/cp/except.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 8e32659a302..dba1466eea0 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -888,14 +888,20 @@ expand_throw (exp)
/* First, decay it. */
exp = decay_conversion (exp);
- /* cleanup_type is void (*)(void *, int),
- the internal type of a destructor. */
+ /* The CLEANUP_TYPE is the internal type of a destructor. Under
+ the old ABI, destructors are two-argument functions; under
+ the new ABI they take only one argument. */
if (cleanup_type == NULL_TREE)
- cleanup_type = build_pointer_type
- (build_function_type
- (void_type_node, tree_cons
- (NULL_TREE, ptr_type_node, tree_cons
- (NULL_TREE, integer_type_node, void_list_node))));
+ {
+ tree arg_types;
+
+ arg_types = void_list_node;
+ if (!flag_new_abi)
+ arg_types = tree_cons (NULL_TREE, integer_type_node, arg_types);
+ arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
+ cleanup_type = (build_pointer_type
+ (build_function_type (void_type_node, arg_types)));
+ }
if (TYPE_PTR_P (TREE_TYPE (exp)))
throw_type = build_eh_type_type (TREE_TYPE (exp));
@@ -949,7 +955,10 @@ expand_throw (exp)
if (TYPE_HAS_DESTRUCTOR (TREE_TYPE (object)))
{
cleanup = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)),
- dtor_identifier, 0);
+ (flag_new_abi
+ ? complete_dtor_identifier
+ : dtor_identifier),
+ 0);
cleanup = TREE_VALUE (cleanup);
mark_used (cleanup);
mark_addressable (cleanup);
@@ -970,7 +979,7 @@ expand_throw (exp)
TREE_TYPE (cleanup) = cleanup_type;
}
- fn = get_identifier ("__cp_push_exception");
+ fn = cp_push_exception_identifier;
if (IDENTIFIER_GLOBAL_VALUE (fn))
fn = IDENTIFIER_GLOBAL_VALUE (fn);
else