aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-03-03 09:13:53 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-03-03 11:08:17 +0000
commit17d4a75971a0afec0a9a2bdd123779431105b850 (patch)
tree75d64e1d0ff56fdce4869397419fca38cc783013 /gcc/rust/backend/rust-compile-expr.cc
parente35da26d8ed884b27050c6cbfe2460696e4c9ebe (diff)
downloadgcc-17d4a75971a0afec0a9a2bdd123779431105b850.zip
gcc-17d4a75971a0afec0a9a2bdd123779431105b850.tar.gz
gcc-17d4a75971a0afec0a9a2bdd123779431105b850.tar.bz2
Remove gcc abstraction for expression statement
The gcc abstraction contained a method of turning expressions into statements which used to contain their own types like Bstatement, Bexpression this produced awkward interfaces which we no longer require. This is part of a patch series to introduce the CPP front-end convert_to_void to port over the support for the nodiscard attribute which maps nicely over to Rust's must_use attribute.
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index bf47661..6d50c3f 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -63,8 +63,6 @@ CompileExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
void
CompileExpr::visit (HIR::CompoundAssignmentExpr &expr)
{
- fncontext fn = ctx->peek_fn ();
-
auto op = expr.get_expr_type ();
auto lhs = CompileExpr::Compile (expr.get_left_expr ().get (), ctx);
auto rhs = CompileExpr::Compile (expr.get_right_expr ().get (), ctx);
@@ -82,10 +80,7 @@ CompileExpr::visit (HIR::CompoundAssignmentExpr &expr)
= resolve_operator_overload (lang_item_type, expr, lhs, rhs,
expr.get_left_expr ().get (),
expr.get_right_expr ().get ());
- auto assignment
- = ctx->get_backend ()->expression_statement (fn.fndecl,
- compound_assignment);
- ctx->add_statement (assignment);
+ ctx->add_statement (compound_assignment);
return;
}
@@ -94,7 +89,7 @@ CompileExpr::visit (HIR::CompoundAssignmentExpr &expr)
= ctx->get_backend ()->arithmetic_or_logical_expression (op, lhs, rhs,
expr.get_locus ());
tree assignment
- = ctx->get_backend ()->assignment_statement (fn.fndecl, lhs, operator_expr,
+ = ctx->get_backend ()->assignment_statement (lhs, operator_expr,
expr.get_locus ());
ctx->add_statement (assignment);
}
@@ -304,8 +299,10 @@ CompileExpr::visit (HIR::MatchExpr &expr)
{
tree result_reference
= ctx->get_backend ()->var_expression (tmp, arm_locus);
- tree assignment = ctx->get_backend ()->assignment_statement (
- fnctx.fndecl, result_reference, kase_expr_tree, arm_locus);
+ tree assignment
+ = ctx->get_backend ()->assignment_statement (result_reference,
+ kase_expr_tree,
+ arm_locus);
ctx->add_statement (assignment);
}