]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: expand: Convert last statement to tail expr
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 12 Jun 2023 14:36:51 +0000 (16:36 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:29 +0000 (18:46 +0100)
commit128c042dcf36f28bbff612d30f1627a5c5b09a9a
tree1978d301a51da2c9bccd7643f26955d3ab33ef78
parent0974798a3f5259b14b95edf9ddbe9c81af76ecff
gccrs: expand: Convert last statement to tail expr

Some inner statements may be expanded to statements as well as a tail
expression, which should then be propagated to the parent tail
expression field.

gcc/rust/ChangeLog:

* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Change
call to expand_inner_stmts.
(expand_tail_expr): Change argument name and try to expand the
last statement as a tail expression once all statements have
been expanded.
* expand/rust-expand-visitor.h: Change prototype to accept
parent class.
* ast/rust-expr.h: Add try_convert_last_stmt function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-expr.h
gcc/rust/expand/rust-expand-visitor.cc
gcc/rust/expand/rust-expand-visitor.h