From 0dde4175efc346c70069a8a090590d3e63be04fa Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 9 Aug 1999 10:45:00 +0000 Subject: semantics.c (begin_function_try_block, [...]): New fns. * semantics.c (begin_function_try_block, finish_function_try_block, finish_function_handler_sequence): New fns. * parse.y (function_try_block): Use them. * pt.c (instantiate_decl): Likewise. * cp-tree.h: Declare in_function_try_handler. * decl.c: Define it. (start_function): Clear it. (struct cp_function, push_cp_function_context): Save it. (pop_cp_function_context): Restore it. * parse.y (function_try_block): Set and clear it. * except.c (expand_end_catch_block): Rethrow if we reach the end of a function-try-block handler in a ctor or dtor. * typeck.c (c_expand_return): Complain about returning from a function-try-block handler of a ctor. * parse.y (function_try_block): Call end_protect_partials before expand_start_all_catch. From-SVN: r28624 --- gcc/cp/semantics.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'gcc/cp/semantics.c') diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 18575ee1d47..fe68ae8fb9d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -586,6 +586,27 @@ begin_try_block () } } +/* Likewise, for a function-try-block. */ + +tree +begin_function_try_block () +{ + if (processing_template_decl) + { + tree r = build_min_nt (TRY_BLOCK, NULL_TREE, + NULL_TREE); + add_tree (r); + return r; + } + else + { + if (! current_function_parms_stored) + store_parm_decls (); + expand_start_early_try_stmts (); + return NULL_TREE; + } +} + /* Finish a try-block, which may be given by TRY_BLOCK. */ void @@ -600,6 +621,22 @@ finish_try_block (try_block) } } +/* Likewise, for a function-try-block. */ + +void +finish_function_try_block (try_block) + tree try_block; +{ + if (processing_template_decl) + RECHAIN_STMTS_FROM_LAST (try_block, TRY_STMTS (try_block)); + else + { + end_protect_partials (); + expand_start_all_catch (); + in_function_try_handler = 1; + } +} + /* Finish a handler-sequence for a try-block, which may be given by TRY_BLOCK. */ @@ -615,6 +652,21 @@ finish_handler_sequence (try_block) } } +/* Likewise, for a function-try-block. */ + +void +finish_function_handler_sequence (try_block) + tree try_block; +{ + if (processing_template_decl) + RECHAIN_STMTS_FROM_CHAIN (try_block, TRY_HANDLERS (try_block)); + else + { + in_function_try_handler = 0; + expand_end_all_catch (); + } +} + /* Begin a handler. Returns a HANDLER if appropriate. */ tree -- cgit v1.2.1