Commit 545f261b by Nathan Froyd Committed by Nathan Froyd

cp-tree.def (IF_STMT): Add an extra operand.

	* cp-tree.def (IF_STMT): Add an extra operand.
	* cp-objcp-common.c (cp_common_init_ts): Mark it as TS_TYPED.
	* cp-tree.h (IF_SCOPE): Define.
	* semantics.c (begin_if_stmt): Pass scope to build_stmt.
	(finish_if_stmt): Use IF_SCOPE instead of TREE_CHAIN.

From-SVN: r172437
parent 40e71fc7
2011-04-14 Nathan Froyd <froydnj@codesourcery.com> 2011-04-14 Nathan Froyd <froydnj@codesourcery.com>
* cp-tree.def (IF_STMT): Add an extra operand.
* cp-objcp-common.c (cp_common_init_ts): Mark it as TS_TYPED.
* cp-tree.h (IF_SCOPE): Define.
* semantics.c (begin_if_stmt): Pass scope to build_stmt.
(finish_if_stmt): Use IF_SCOPE instead of TREE_CHAIN.
2011-04-14 Nathan Froyd <froydnj@codesourcery.com>
* cp-tree.def (FOR_STMT, RANGE_FOR_STMT): Add an extra operand. * cp-tree.def (FOR_STMT, RANGE_FOR_STMT): Add an extra operand.
* cp-objcp-common.c (cp_common_init_ts): Mark them as TS_TYPED. * cp-objcp-common.c (cp_common_init_ts): Mark them as TS_TYPED.
* cp-tree.h (FOR_SCOPE, RANGE_FOR_SCOPE): Define. * cp-tree.h (FOR_SCOPE, RANGE_FOR_SCOPE): Define.
......
...@@ -238,7 +238,6 @@ cp_common_init_ts (void) ...@@ -238,7 +238,6 @@ cp_common_init_ts (void)
MARK_TS_COMMON (TEMPLATE_INFO); MARK_TS_COMMON (TEMPLATE_INFO);
MARK_TS_COMMON (TYPENAME_TYPE); MARK_TS_COMMON (TYPENAME_TYPE);
MARK_TS_COMMON (TYPEOF_TYPE); MARK_TS_COMMON (TYPEOF_TYPE);
MARK_TS_COMMON (IF_STMT);
MARK_TS_COMMON (BASELINK); MARK_TS_COMMON (BASELINK);
MARK_TS_COMMON (SWITCH_STMT); MARK_TS_COMMON (SWITCH_STMT);
MARK_TS_COMMON (TYPE_PACK_EXPANSION); MARK_TS_COMMON (TYPE_PACK_EXPANSION);
...@@ -247,6 +246,7 @@ cp_common_init_ts (void) ...@@ -247,6 +246,7 @@ cp_common_init_ts (void)
MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM); MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE); MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
MARK_TS_TYPED (IF_STMT);
MARK_TS_TYPED (FOR_STMT); MARK_TS_TYPED (FOR_STMT);
MARK_TS_TYPED (RANGE_FOR_STMT); MARK_TS_TYPED (RANGE_FOR_STMT);
MARK_TS_TYPED (AGGR_INIT_EXPR); MARK_TS_TYPED (AGGR_INIT_EXPR);
......
...@@ -284,10 +284,10 @@ DEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", tcc_expression, 1) ...@@ -284,10 +284,10 @@ DEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", tcc_expression, 1)
DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", tcc_statement, 3) DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", tcc_statement, 3)
/* Represents an 'if' statement. The operands are IF_COND, /* Represents an 'if' statement. The operands are IF_COND,
THEN_CLAUSE, and ELSE_CLAUSE, respectively. */ THEN_CLAUSE, and ELSE_CLAUSE, and the current scope, respectively. */
/* ??? It is currently still necessary to distinguish between IF_STMT /* ??? It is currently still necessary to distinguish between IF_STMT
and COND_EXPR for the benefit of templates. */ and COND_EXPR for the benefit of templates. */
DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 3) DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 4)
/* Used to represent a `for' statement. The operands are /* Used to represent a `for' statement. The operands are
FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively. */ FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively. */
......
...@@ -3792,6 +3792,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) ...@@ -3792,6 +3792,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0) #define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
#define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1) #define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
#define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2) #define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
#define IF_SCOPE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 3)
/* WHILE_STMT accessors. These give access to the condition of the /* WHILE_STMT accessors. These give access to the condition of the
while statement and the body of the while statement, respectively. */ while statement and the body of the while statement, respectively. */
......
...@@ -662,8 +662,8 @@ begin_if_stmt (void) ...@@ -662,8 +662,8 @@ begin_if_stmt (void)
{ {
tree r, scope; tree r, scope;
scope = do_pushlevel (sk_block); scope = do_pushlevel (sk_block);
r = build_stmt (input_location, IF_STMT, NULL_TREE, NULL_TREE, NULL_TREE); r = build_stmt (input_location, IF_STMT, NULL_TREE,
TREE_CHAIN (r) = scope; NULL_TREE, NULL_TREE, scope);
begin_cond (&IF_COND (r)); begin_cond (&IF_COND (r));
return r; return r;
} }
...@@ -711,8 +711,8 @@ finish_else_clause (tree if_stmt) ...@@ -711,8 +711,8 @@ finish_else_clause (tree if_stmt)
void void
finish_if_stmt (tree if_stmt) finish_if_stmt (tree if_stmt)
{ {
tree scope = TREE_CHAIN (if_stmt); tree scope = IF_SCOPE (if_stmt);
TREE_CHAIN (if_stmt) = NULL; IF_SCOPE (if_stmt) = NULL;
add_stmt (do_poplevel (scope)); add_stmt (do_poplevel (scope));
finish_stmt (); finish_stmt ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment