* cp-tree.def (START_CATCH_STMT): Lose.
* dump.c (cp_dump_tree): Don't dump it. Do dump HANDLER_PARMS.
* tree.c (cp_statement_code_p): Don't case it.
* semantics.c (cp_expand_stmt): Likewise.
* except.c (expand_start_catch_block): Don't start any blocks.
Return the type.
(expand_end_catch_block): Don't end any blocks.
* parse.y (handler): Don't pass anything from finish_handler_parms
to finish_handler.
* pt.c (tsubst_expr): Likewise.
* semantics.c (begin_handler): Call note_level_for_catch here.
(finish_handler_parms): Don't return anything.
(genrtl_catch_block, begin_catch_block): Lose.
(genrtl_handler): Call expand_start_catch here.
* cp-tree.h (START_CATCH_TYPE): Lose.
(HANDLER_TYPE): New.
From-SVN: r42388
+2001-05-21 Jason Merrill <jason_merrill@redhat.com>
+
+ * cp-tree.def (START_CATCH_STMT): Lose.
+ * dump.c (cp_dump_tree): Don't dump it. Do dump HANDLER_PARMS.
+ * tree.c (cp_statement_code_p): Don't case it.
+ * semantics.c (cp_expand_stmt): Likewise.
+ * cp-tree.h (START_CATCH_TYPE): Lose.
+ (HANDLER_TYPE): New.
+ * except.c (expand_start_catch_block): Don't start any blocks.
+ Return the type.
+ (expand_end_catch_block): Don't end any blocks.
+ * parse.y (handler): Don't pass anything from finish_handler_parms
+ to finish_handler.
+ * pt.c (tsubst_expr): Likewise.
+ * semantics.c (begin_handler): Call note_level_for_catch here.
+ (finish_handler_parms): Don't return anything.
+ (genrtl_catch_block, begin_catch_block): Lose.
+ (genrtl_handler): Call expand_start_catch here.
+
+2001-05-18 Jason Merrill <jason_merrill@redhat.com>
+
+ * class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here.
+ (get_vtable_decl, build_vtt): Not here.
+
2001-05-20 Nathan Sidwell <nathan@codesourcery.com>
PR c++/2781
constructed. If, after this point, the CLEANUP_DECL goes out of
scope, the CLEANUP_EXPR must be run. */
DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", 'e', 2)
-/* A START_CATCH_STMT marks the beginning of a catch handler for the
- the START_CATCH_TYPE. If this is CATCH_ALL_TYPE, then the handler
- catches all types. */
-DEFTREECODE (START_CATCH_STMT, "start_catch_stmt", 'e', 0)
DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2)
DEFTREECODE (RETURN_INIT, "return_init", 'e', 2)
DEFTREECODE (TRY_BLOCK, "try_block", 'e', 2)
DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", 'e', 2)
+/* A HANDLER wraps a catch handler for the HANDLER_TYPE. If this is
+ CATCH_ALL_TYPE, then the handler catches all types. The declaration of
+ the catch variable is in HANDLER_PARMS, and the body block in
+ HANDLER_BODY. */
DEFTREECODE (HANDLER, "handler", 'e', 2)
/* A MUST_NOT_THROW_EXPR wraps an expression that may not
#define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
+#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
#define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (SUBOBJECT_CHECK (NODE), 0)
-#define START_CATCH_TYPE(NODE) TREE_TYPE (START_CATCH_STMT_CHECK (NODE))
/* Nonzero if this CTOR_STMT is for the beginning of a constructor. */
#define CTOR_BEGIN_P(NODE) \
/* in except.c */
extern void init_exception_processing PARAMS ((void));
extern tree expand_start_catch_block PARAMS ((tree));
-extern void expand_end_catch_block PARAMS ((tree));
+extern void expand_end_catch_block PARAMS ((void));
extern void expand_builtin_throw PARAMS ((void));
extern void expand_eh_spec_block PARAMS ((tree));
extern void expand_exception_blocks PARAMS ((void));
extern void finish_function_handler_sequence PARAMS ((tree));
extern void finish_cleanup_try_block PARAMS ((tree));
extern tree begin_handler PARAMS ((void));
-extern tree finish_handler_parms PARAMS ((tree, tree));
+extern void finish_handler_parms PARAMS ((tree, tree));
extern void begin_catch_block PARAMS ((tree));
-extern void finish_handler PARAMS ((tree, tree));
+extern void finish_handler PARAMS ((tree));
extern void finish_cleanup PARAMS ((tree, tree));
extern tree begin_compound_stmt PARAMS ((int));
extern tree finish_compound_stmt PARAMS ((int, tree));
case HANDLER:
dump_stmt (di, t);
+ dump_child ("parm", HANDLER_PARMS (t));
dump_child ("body", HANDLER_BODY (t));
dump_next_stmt (di, t);
break;
dump_next_stmt (di, t);
break;
- case START_CATCH_STMT:
- dump_stmt (di, t);
- queue_and_dump_type (di, t);
- dump_next_stmt (di, t);
- break;
-
case USING_STMT:
dump_stmt (di, t);
dump_child ("nmsp", USING_STMT_NAMESPACE (t));
expand_start_catch_block (decl)
tree decl;
{
- tree compound_stmt_1;
- tree compound_stmt_2;
tree exp = NULL_TREE;
tree type;
bool is_java;
if (decl && !complete_ptr_ref_or_void_ptr_p (TREE_TYPE (decl), NULL_TREE))
decl = NULL_TREE;
- /* Create a binding level for the eh_info and the exception object
- cleanup. */
- compound_stmt_1 = begin_compound_stmt (/*has_no_scope=*/0);
- note_level_for_catch ();
-
if (decl)
type = prepare_eh_type (TREE_TYPE (decl));
else
type = NULL_TREE;
- begin_catch_block (type);
is_java = false;
if (decl)
if (! is_java)
push_eh_cleanup (type);
- /* Create a binding level for the parm. */
- compound_stmt_2 = begin_compound_stmt (/*has_no_scope=*/0);
-
if (decl)
initialize_handler_parm (decl, exp);
- return build_tree_list (compound_stmt_1, compound_stmt_2);
+ return type;
}
the label to jump to if this catch block didn't match. */
void
-expand_end_catch_block (blocks)
- tree blocks;
+expand_end_catch_block ()
{
- tree compound_stmt_1 = blocks ? TREE_PURPOSE (blocks): NULL_TREE;
- tree compound_stmt_2 = blocks ? TREE_VALUE (blocks): NULL_TREE;
-
if (! doing_eh (1))
return;
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|| DECL_DESTRUCTOR_P (current_function_decl)))
finish_expr_stmt (build_throw (NULL_TREE));
-
- /* Cleanup the EH parameter. */
- finish_compound_stmt (/*has_no_scope=*/0, compound_stmt_2);
- /* Cleanup the EH object. */
- finish_compound_stmt (/*has_no_scope=*/0, compound_stmt_1);
}
tree
handler:
CATCH
- { $<ttype>$ = begin_handler(); }
+ { $<ttype>$ = begin_handler (); }
handler_args
- { $<ttype>$ = finish_handler_parms ($3, $<ttype>2); }
+ { finish_handler_parms ($3, $<ttype>2); }
compstmt
- { finish_handler ($<ttype>4, $<ttype>2); }
+ { finish_handler ($<ttype>2); }
;
type_specifier_seq:
case HANDLER:
{
tree decl;
- tree blocks;
prep_stmt (t);
stmt = begin_handler ();
}
else
decl = NULL_TREE;
- blocks = finish_handler_parms (decl, stmt);
+ finish_handler_parms (decl, stmt);
tsubst_expr (HANDLER_BODY (t), args, complain, in_decl);
- finish_handler (blocks, stmt);
+ finish_handler (stmt);
}
break;
static void genrtl_try_block PARAMS ((tree));
static void genrtl_eh_spec_block PARAMS ((tree));
static void genrtl_handler PARAMS ((tree));
-static void genrtl_catch_block PARAMS ((tree));
static void genrtl_ctor_stmt PARAMS ((tree));
static void genrtl_subobject PARAMS ((tree));
static void genrtl_named_return_value PARAMS ((void));
tree t;
{
genrtl_do_pushlevel ();
+ if (!processing_template_decl)
+ expand_start_catch (HANDLER_TYPE (t));
expand_stmt (HANDLER_BODY (t));
if (!processing_template_decl)
expand_end_catch ();
tree r;
r = build_stmt (HANDLER, NULL_TREE, NULL_TREE);
add_stmt (r);
+ /* Create a binding level for the eh_info and the exception object
+ cleanup. */
do_pushlevel ();
+ note_level_for_catch ();
return r;
}
HANDLER. DECL is the declaration for the catch parameter, or NULL
if this is a `catch (...)' clause. */
-tree
+void
finish_handler_parms (decl, handler)
tree decl;
tree handler;
{
- tree blocks = NULL_TREE;
-
+ tree type = NULL_TREE;
if (processing_template_decl)
{
if (decl)
decl = push_template_decl (decl);
add_decl_stmt (decl);
RECHAIN_STMTS (handler, HANDLER_PARMS (handler));
+ type = TREE_TYPE (decl);
}
}
else
- blocks = expand_start_catch_block (decl);
-
- if (decl)
- TREE_TYPE (handler) = TREE_TYPE (decl);
+ type = expand_start_catch_block (decl);
- return blocks;
-}
-
-/* Generate the RTL for a START_CATCH_STMT. */
-
-static void
-genrtl_catch_block (type)
- tree type;
-{
- expand_start_catch (type);
-}
-
-/* Note the beginning of a handler for TYPE. This function is called
- at the point to which control should be transferred when an
- appropriately-typed exception is thrown. */
-
-void
-begin_catch_block (type)
- tree type;
-{
- add_stmt (build (START_CATCH_STMT, type));
+ HANDLER_TYPE (handler) = type;
}
/* Finish a handler, which may be given by HANDLER. The BLOCKs are
the return value from the matching call to finish_handler_parms. */
void
-finish_handler (blocks, handler)
- tree blocks;
+finish_handler (handler)
tree handler;
{
if (!processing_template_decl)
- expand_end_catch_block (blocks);
+ expand_end_catch_block ();
do_poplevel ();
RECHAIN_STMTS (handler, HANDLER_BODY (handler));
}
genrtl_decl_cleanup (CLEANUP_DECL (t), CLEANUP_EXPR (t));
break;
- case START_CATCH_STMT:
- genrtl_catch_block (TREE_TYPE (t));
- break;
-
case CTOR_STMT:
genrtl_ctor_stmt (t);
break;
{
case SUBOBJECT:
case CLEANUP_STMT:
- case START_CATCH_STMT:
case CTOR_STMT:
case CTOR_INITIALIZER:
case RETURN_INIT: