const std::vector<Bstatement*>& statements,
source_location);
+ Bstatement*
+ compound_statement(Bstatement*, Bstatement*);
+
Bstatement*
statement_list(const std::vector<Bstatement*>&);
tree lhs_tree = lhs->get_tree();
tree rhs_tree = rhs->get_tree();
if (lhs_tree == error_mark_node || rhs_tree == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
return this->make_statement(fold_build2_loc(location, MODIFY_EXPR,
void_type_node,
lhs_tree, rhs_tree));
{
tree fntree = bfunction->get_tree();
if (fntree == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
tree result = DECL_RESULT(fntree);
if (result == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
tree ret;
if (vals.empty())
ret = fold_build1_loc(location, RETURN_EXPR, void_type_node, NULL_TREE);
{
tree val = vals.front()->get_tree();
if (val == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
result, vals.front()->get_tree());
ret = fold_build1_loc(location, RETURN_EXPR, void_type_node, set);
rettmp, field, NULL_TREE);
tree val = (*p)->get_tree();
if (val == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
tree set = fold_build2_loc(location, MODIFY_EXPR, void_type_node,
ref, (*p)->get_tree());
append_to_statement_list(set, &stmt_list);
if (cond_tree == error_mark_node
|| then_tree == error_mark_node
|| else_tree == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
tree ret = build3_loc(location, COND_EXPR, void_type_node, cond_tree,
then_tree, else_tree);
return this->make_statement(ret);
{
tree t = (*pcv)->get_tree();
if (t == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
source_location loc = EXPR_LOCATION(t);
tree label = create_artificial_label(loc);
tree c = build3_loc(loc, CASE_LABEL_EXPR, void_type_node,
{
tree t = (*ps)->get_tree();
if (t == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
append_to_statement_list(t, &stmt_list);
}
}
tree tv = value->get_tree();
if (tv == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
tree t = build3_loc(switch_location, SWITCH_EXPR, void_type_node,
tv, stmt_list, NULL_TREE);
return this->make_statement(t);
}
+// Pair of statements.
+
+Bstatement*
+Gcc_backend::compound_statement(Bstatement* s1, Bstatement* s2)
+{
+ tree stmt_list = NULL_TREE;
+ tree t = s1->get_tree();
+ if (t == error_mark_node)
+ return this->error_statement();
+ append_to_statement_list(t, &stmt_list);
+ t = s2->get_tree();
+ if (t == error_mark_node)
+ return this->error_statement();
+ append_to_statement_list(t, &stmt_list);
+ return this->make_statement(stmt_list);
+}
+
// List of statements.
Bstatement*
{
tree t = (*p)->get_tree();
if (t == error_mark_node)
- return this->make_statement(error_mark_node);
+ return this->error_statement();
append_to_statement_list(t, &stmt_list);
}
return this->make_statement(stmt_list);
else if (break_stat == NULL)
return statements;
else
- {
- std::vector<Bstatement*> list(2);
- list[0] = statements;
- list[1] = break_stat;
- return context->backend()->statement_list(list);
- }
+ return context->backend()->compound_statement(statements, break_stat);
}
// Class Case_clauses.
all_cases,
all_statements,
this->location());
-
- std::vector<Bstatement*> stats(2);
- stats[0] = switch_statement;
- stats[1] = break_label->get_definition(context);
- Bstatement* ret = context->backend()->statement_list(stats);
+ Bstatement* ldef = break_label->get_definition(context);
+ Bstatement* ret = context->backend()->compound_statement(switch_statement,
+ ldef);
return stat_to_tree(ret);
}
if (btemp == NULL)
return stat_to_tree(s);
else
- {
- std::vector<Bstatement*> stats(2);
- stats[0] = btemp;
- stats[1] = s;
- return stat_to_tree(context->backend()->statement_list(stats));
- }
+ return stat_to_tree(context->backend()->compound_statement(btemp, s));
}
// Make a send statement.
}
if (s == NULL)
return ldef;
- std::vector<Bstatement*> stats(2);
- stats[0] = s;
- stats[1] = ldef;
- return context->backend()->statement_list(stats);
+ return context->backend()->compound_statement(s, ldef);
}
gcc_assert(count > 0);
if (s == NULL)
(*clauses)[index] = g;
else
- {
- std::vector<Bstatement*> stats(2);
- stats[0] = s;
- stats[1] = g;
- (*clauses)[index] = context->backend()->statement_list(stats);
- }
+ (*clauses)[index] = context->backend()->compound_statement(s, g);
}
// Class Select_statement.