diff options
-rw-r--r-- | gcc/rust/rust-backend.h | 46 | ||||
-rw-r--r-- | gcc/rust/rust-gcc.cc | 23 |
2 files changed, 22 insertions, 47 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index 81fd130..6b265cc 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -281,40 +281,38 @@ public: // Create a variable initialization statement in the specified // function. This initializes a local variable at the point in the // program flow where it is declared. - virtual tree init_statement (tree, Bvariable *var, tree init) = 0; + tree init_statement (tree, Bvariable *var, tree init); // Create an assignment statement within the specified function. - virtual tree assignment_statement (tree lhs, tree rhs, location_t) = 0; + tree assignment_statement (tree lhs, tree rhs, location_t); // Create return statement for an decl for a value (can be NULL_TREE) at a // location - virtual tree return_statement (tree fndecl, tree val, location_t) = 0; + tree return_statement (tree fndecl, tree val, location_t); // Create an if statement within a function. ELSE_BLOCK may be NULL. - virtual tree if_statement (tree, tree condition, tree then_block, - tree else_block, location_t) - = 0; + tree if_statement (tree, tree condition, tree then_block, tree else_block, + location_t); // infinite loop expressions - virtual tree loop_expression (tree body, location_t) = 0; + tree loop_expression (tree body, location_t); // exit expressions - virtual tree exit_expression (tree condition, location_t) = 0; + tree exit_expression (tree condition, location_t); // Create a single statement from two statements. - virtual tree compound_statement (tree, tree) = 0; + tree compound_statement (tree, tree); // Create a single statement from a list of statements. - virtual tree statement_list (const std::vector<tree> &) = 0; + tree statement_list (const std::vector<tree> &); // Create a statement that attempts to execute BSTAT and calls EXCEPT_STMT if // an exception occurs. EXCEPT_STMT may be NULL. FINALLY_STMT may be NULL and // if not NULL, it will always be executed. This is used for handling defers // in Go functions. In C++, the resulting code is of this form: // try { BSTAT; } catch { EXCEPT_STMT; } finally { FINALLY_STMT; } - virtual tree exception_handler_statement (tree bstat, tree except_stmt, - tree finally_stmt, location_t) - = 0; + tree exception_handler_statement (tree bstat, tree except_stmt, + tree finally_stmt, location_t); // Blocks. @@ -539,28 +537,6 @@ public: tree call_expression (tree fn, const std::vector<tree> &args, tree static_chain, location_t); - // Statements. - - tree init_statement (tree, Bvariable *var, tree init); - - tree assignment_statement (tree lhs, tree rhs, location_t); - - tree return_statement (tree fndecl, tree val, location_t locus); - - tree if_statement (tree, tree condition, tree then_block, tree else_block, - location_t); - - tree compound_statement (tree, tree); - - tree statement_list (const std::vector<tree> &); - - tree exception_handler_statement (tree bstat, tree except_stmt, - tree finally_stmt, location_t); - - tree loop_expression (tree body, location_t); - - tree exit_expression (tree condition, location_t); - // Blocks. tree block (tree, tree, const std::vector<Bvariable *> &, location_t, diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 23c2f21..7ef442b 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -1695,7 +1695,7 @@ Gcc_backend::call_expression (tree fn, const std::vector<tree> &fn_args, // Variable initialization. tree -Gcc_backend::init_statement (tree, Bvariable *var, tree init_tree) +Backend::init_statement (tree, Bvariable *var, tree init_tree) { tree var_tree = var->get_decl (); if (var_tree == error_mark_node || init_tree == error_mark_node) @@ -1727,7 +1727,7 @@ Gcc_backend::init_statement (tree, Bvariable *var, tree init_tree) // Assignment. tree -Gcc_backend::assignment_statement (tree lhs, tree rhs, location_t location) +Backend::assignment_statement (tree lhs, tree rhs, location_t location) { if (lhs == error_mark_node || rhs == error_mark_node) return error_mark_node; @@ -1752,7 +1752,7 @@ Gcc_backend::assignment_statement (tree lhs, tree rhs, location_t location) // Return. tree -Gcc_backend::return_statement (tree fntree, tree val, location_t location) +Backend::return_statement (tree fntree, tree val, location_t location) { if (fntree == error_mark_node) return error_mark_node; @@ -1776,9 +1776,8 @@ Gcc_backend::return_statement (tree fntree, tree val, location_t location) // try { BSTAT; } catch { EXCEPT_STMT; } finally { FINALLY_STMT; } tree -Gcc_backend::exception_handler_statement (tree try_stmt, tree except_stmt, - tree finally_stmt, - location_t location) +Backend::exception_handler_statement (tree try_stmt, tree except_stmt, + tree finally_stmt, location_t location) { if (try_stmt == error_mark_node || except_stmt == error_mark_node || finally_stmt == error_mark_node) @@ -1797,8 +1796,8 @@ Gcc_backend::exception_handler_statement (tree try_stmt, tree except_stmt, // If. tree -Gcc_backend::if_statement (tree, tree cond_tree, tree then_tree, tree else_tree, - location_t location) +Backend::if_statement (tree, tree cond_tree, tree then_tree, tree else_tree, + location_t location) { if (cond_tree == error_mark_node || then_tree == error_mark_node || else_tree == error_mark_node) @@ -1811,13 +1810,13 @@ Gcc_backend::if_statement (tree, tree cond_tree, tree then_tree, tree else_tree, // Loops tree -Gcc_backend::loop_expression (tree body, location_t locus) +Backend::loop_expression (tree body, location_t locus) { return fold_build1_loc (locus, LOOP_EXPR, void_type_node, body); } tree -Gcc_backend::exit_expression (tree cond_tree, location_t locus) +Backend::exit_expression (tree cond_tree, location_t locus) { return fold_build1_loc (locus, EXIT_EXPR, void_type_node, cond_tree); } @@ -1825,7 +1824,7 @@ Gcc_backend::exit_expression (tree cond_tree, location_t locus) // Pair of statements. tree -Gcc_backend::compound_statement (tree s1, tree s2) +Backend::compound_statement (tree s1, tree s2) { tree stmt_list = NULL_TREE; tree t = s1; @@ -1848,7 +1847,7 @@ Gcc_backend::compound_statement (tree s1, tree s2) // List of statements. tree -Gcc_backend::statement_list (const std::vector<tree> &statements) +Backend::statement_list (const std::vector<tree> &statements) { tree stmt_list = NULL_TREE; for (std::vector<tree>::const_iterator p = statements.begin (); |