Beispiel #1
0
void
genrtl_switch_stmt (tree t)
{
    tree cond;
    genrtl_do_pushlevel ();

    cond = expand_cond (SWITCH_COND (t));
    if (cond == error_mark_node)
        /* The code is in error, but we don't want expand_end_case to
           crash.  */
        cond = truthvalue_false_node;

    emit_line_note (input_location);
    expand_start_case (1, cond, TREE_TYPE (cond), "switch statement");
    expand_stmt (expand_unreachable_stmt (SWITCH_BODY (t), warn_notreached));
    expand_end_case_type (cond, SWITCH_TYPE (t));
}
Beispiel #2
0
static enum gimplify_status
gimplify_switch_stmt (tree *stmt_p)
{
  tree stmt = *stmt_p;
  tree break_block, body;
  location_t stmt_locus = input_location;

  break_block = begin_bc_block (bc_break);

  body = SWITCH_BODY (stmt);
  if (!body)
    body = build_empty_stmt ();

  *stmt_p = build3 (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
		    body, NULL_TREE);
  SET_EXPR_LOCATION (*stmt_p, stmt_locus);
  gimplify_stmt (stmt_p);

  *stmt_p = finish_bc_block (break_block, *stmt_p);
  return GS_ALL_DONE;
}