aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2001-05-21 11:39:19 -0400
committerJason Merrill <jason@gcc.gnu.org>2001-05-21 11:39:19 -0400
commit1a6025b4b81a386b54678f8641fbb00b144e6ddf (patch)
tree39cca1e9568d70f1c02863d9d447b7fd3eb0d235
parent0fd0b7ee985eb454ead3a28f6a017065780e9587 (diff)
downloadgcc-1a6025b4b81a386b54678f8641fbb00b144e6ddf.zip
gcc-1a6025b4b81a386b54678f8641fbb00b144e6ddf.tar.gz
gcc-1a6025b4b81a386b54678f8641fbb00b144e6ddf.tar.bz2
cp-tree.def (START_CATCH_STMT): Lose.
* 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
-rw-r--r--gcc/cp/ChangeLog24
-rw-r--r--gcc/cp/cp-tree.def8
-rw-r--r--gcc/cp/cp-tree.h8
-rw-r--r--gcc/cp/dump.c7
-rw-r--r--gcc/cp/except.c24
-rw-r--r--gcc/cp/parse.y6
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/cp/semantics.c48
-rw-r--r--gcc/cp/tree.c1
9 files changed, 52 insertions, 79 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a05a3ac..55427d6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,27 @@
+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
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index ee104f5..62f2632 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -229,14 +229,14 @@ DEFTREECODE (CTOR_STMT, "ctor_stmt", 'e', 0)
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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d0b34c9..91e723b 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3061,8 +3061,8 @@ enum ptrmemfunc_vbit_where_t
#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) \
@@ -4005,7 +4005,7 @@ extern cp_printer *cp_printers[256];
/* 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));
@@ -4271,9 +4271,9 @@ extern void finish_function_try_block PARAMS ((tree));
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));
diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c
index 3f0a118..6706ebf 100644
--- a/gcc/cp/dump.c
+++ b/gcc/cp/dump.c
@@ -230,6 +230,7 @@ cp_dump_tree (di, t)
case HANDLER:
dump_stmt (di, t);
+ dump_child ("parm", HANDLER_PARMS (t));
dump_child ("body", HANDLER_BODY (t));
dump_next_stmt (di, t);
break;
@@ -246,12 +247,6 @@ cp_dump_tree (di, t)
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));
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 6c7ede1..458590a 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -391,8 +391,6 @@ tree
expand_start_catch_block (decl)
tree decl;
{
- tree compound_stmt_1;
- tree compound_stmt_2;
tree exp = NULL_TREE;
tree type;
bool is_java;
@@ -404,16 +402,10 @@ expand_start_catch_block (decl)
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)
@@ -452,13 +444,10 @@ expand_start_catch_block (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;
}
@@ -467,12 +456,8 @@ expand_start_catch_block (decl)
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;
@@ -482,11 +467,6 @@ expand_end_catch_block (blocks)
&& (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
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index 70525e0..356e645 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -3518,11 +3518,11 @@ handler_seq:
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:
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index da0b0a6..19de961 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7448,7 +7448,6 @@ tsubst_expr (t, args, complain, in_decl)
case HANDLER:
{
tree decl;
- tree blocks;
prep_stmt (t);
stmt = begin_handler ();
@@ -7463,9 +7462,9 @@ tsubst_expr (t, args, complain, in_decl)
}
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;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 21290fe..fe62bc5 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -54,7 +54,6 @@ static void emit_associated_thunks PARAMS ((tree));
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));
@@ -721,6 +720,8 @@ genrtl_handler (t)
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 ();
@@ -734,7 +735,10 @@ begin_handler ()
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;
}
@@ -742,13 +746,12 @@ begin_handler ()
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)
@@ -757,47 +760,24 @@ finish_handler_parms (decl, handler)
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));
}
@@ -2167,10 +2147,6 @@ cp_expand_stmt (t)
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;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5de2b5d..65ba7f6 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1031,7 +1031,6 @@ cp_statement_code_p (code)
{
case SUBOBJECT:
case CLEANUP_STMT:
- case START_CATCH_STMT:
case CTOR_STMT:
case CTOR_INITIALIZER:
case RETURN_INIT: