tree
add_stmt (tree t)
{
- if (EXPR_P (t) || STATEMENT_CODE_P (TREE_CODE (t)))
+ enum tree_code code = TREE_CODE (t);
+
+ if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR)
{
- if (!EXPR_LOCUS (t))
- annotate_with_locus (t, input_location);
+ if (!EXPR_HAS_LOCATION (t))
+ SET_EXPR_LOCATION (t, input_location);
/* When we expand a statement-tree, we must know whether or not the
statements are full-expressions. We record that fact here. */
return t;
}
-/* Create a declaration statement for the declaration given by the
- DECL. */
-
-void
-add_decl_stmt (tree decl)
-{
- tree decl_stmt;
-
- /* We need the type to last until instantiation time. */
- decl_stmt = build_stmt (DECL_STMT, decl);
- add_stmt (decl_stmt);
-}
-
-/* Queue a cleanup. CLEANUP is an expression/statement to be executed
- when the current scope is exited. EH_ONLY is true when this is not
- meant to apply to normal control flow transfer. */
-
-void
-push_cleanup (tree decl, tree cleanup, bool eh_only)
-{
- tree stmt = build_stmt (CLEANUP_STMT, NULL, cleanup, decl);
- CLEANUP_EH_ONLY (stmt) = eh_only;
- add_stmt (stmt);
- CLEANUP_BODY (stmt) = push_stmt_list ();
-}
-
/* Build a generic statement based on the given type of node and
arguments. Similar to `build_nt', except that we set
- EXPR_LOCUS to be the current source location. */
+ EXPR_LOCATION to be the current source location. */
/* ??? This should be obsolete with the lineno_stmt productions
in the grammar. */
va_start (p, code);
ret = make_node (code);
+ TREE_TYPE (ret) = void_type_node;
length = TREE_CODE_LENGTH (code);
- annotate_with_locus (ret, input_location);
+ SET_EXPR_LOCATION (ret, input_location);
/* Most statements have implicit side effects all on their own,
such as control transfer. For those that do, we'll compute
}
}
-/* Build the node for a return statement and return it. */
-
-tree
-build_return_stmt (tree expr)
-{
- return (build_stmt (RETURN_STMT, expr));
-}
-
/* Build a break statement node and return it. */
tree
return (build_stmt (CONTINUE_STMT));
}
-/* Create a CASE_LABEL tree node and return it. */
+/* Create a CASE_LABEL_EXPR tree node and return it. */
tree
build_case_label (tree low_value, tree high_value, tree label_decl)
{
- return build_stmt (CASE_LABEL, low_value, high_value, label_decl);
-}
-
-/* We're about to expand T, a statement. Set up appropriate context
- for the substitution. */
-
-void
-prep_stmt (tree t)
-{
- if (EXPR_LOCUS (t))
- input_location = *EXPR_LOCUS (t);
- current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
+ return build_stmt (CASE_LABEL_EXPR, low_value, high_value, label_decl);
}