@@ -237,13 +237,13 @@ cp_common_init_ts (void)
MARK_TS_COMMON (TYPENAME_TYPE);
MARK_TS_COMMON (TYPEOF_TYPE);
MARK_TS_COMMON (BASELINK);
- MARK_TS_COMMON (SWITCH_STMT);
MARK_TS_COMMON (TYPE_PACK_EXPANSION);
MARK_TS_COMMON (EXPR_PACK_EXPANSION);
MARK_TS_COMMON (DECLTYPE_TYPE);
MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
+ MARK_TS_TYPED (SWITCH_STMT);
MARK_TS_TYPED (IF_STMT);
MARK_TS_TYPED (FOR_STMT);
MARK_TS_TYPED (RANGE_FOR_STMT);
@@ -313,8 +313,9 @@ DEFTREECODE (BREAK_STMT, "break_stmt", tcc_statement, 0)
DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_statement, 0)
/* Used to represent a 'switch' statement. The operands are
- SWITCH_STMT_COND, SWITCH_STMT_BODY and SWITCH_STMT_TYPE, respectively. */
-DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_statement, 3)
+ SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE, and
+ SWITCH_STMT_SCOPE, respectively. */
+DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_statement, 4)
/* Used to represent an expression statement. Use `EXPR_STMT_EXPR' to
obtain the expression. */
@@ -3812,6 +3812,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
+#define SWITCH_STMT_SCOPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3)
/* STMT_EXPR accessor. */
#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
@@ -1018,10 +1018,9 @@ begin_switch_stmt (void)
{
tree r, scope;
- r = build_stmt (input_location, SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
-
scope = do_pushlevel (sk_block);
- TREE_CHAIN (r) = scope;
+ r = build_stmt (input_location, SWITCH_STMT, NULL_TREE, NULL_TREE, NULL_TREE, scope);
+
begin_cond (&SWITCH_STMT_COND (r));
return r;
@@ -1077,8 +1076,8 @@ finish_switch_stmt (tree switch_stmt)
pop_switch ();
finish_stmt ();
- scope = TREE_CHAIN (switch_stmt);
- TREE_CHAIN (switch_stmt) = NULL;
+ scope = SWITCH_STMT_SCOPE (switch_stmt);
+ SWITCH_STMT_SCOPE (switch_stmt) = NULL;
add_stmt (do_poplevel (scope));
}