Allow only one return statement
This commit is contained in:
@ -1297,13 +1297,12 @@ namespace elna::gcc
|
||||
|
||||
void generic_visitor::visit(boot::while_statement *statement)
|
||||
{
|
||||
std::string loop_identifier = statement->label.value_or("while");
|
||||
location_t prerequisite_location = get_location(&statement->body().prerequisite().position());
|
||||
tree prerequisite_label_decl = build_label_decl(loop_identifier.c_str(), prerequisite_location);
|
||||
tree prerequisite_label_decl = build_label_decl("while_do", prerequisite_location);
|
||||
auto prerequisite_label_expr = build1_loc(prerequisite_location, LABEL_EXPR,
|
||||
void_type_node, prerequisite_label_decl);
|
||||
auto goto_check = build1(GOTO_EXPR, void_type_node, prerequisite_label_decl);
|
||||
tree branch_end_declaration = build_label_decl(loop_identifier.c_str(), UNKNOWN_LOCATION);
|
||||
tree branch_end_declaration = build_label_decl("while_end", UNKNOWN_LOCATION);
|
||||
tree branch_end_expression = build1_loc(UNKNOWN_LOCATION, LABEL_EXPR, void_type_node, branch_end_declaration);
|
||||
|
||||
append_statement(prerequisite_label_expr);
|
||||
@ -1340,7 +1339,7 @@ namespace elna::gcc
|
||||
|
||||
void generic_visitor::visit(boot::return_statement *statement)
|
||||
{
|
||||
boot::expression *return_expression = statement->return_expression;
|
||||
boot::expression *return_expression = &statement->return_expression();
|
||||
location_t statement_position = get_location(&statement->position());
|
||||
tree set_result{ NULL_TREE };
|
||||
tree return_type = TREE_TYPE(TREE_TYPE(current_function_decl));
|
||||
|
Reference in New Issue
Block a user