diff options
author | Thomas Young <wenzhang5800@gmail.com> | 2021-06-27 00:48:07 +0800 |
---|---|---|
committer | Thomas Young <wenzhang5800@gmail.com> | 2021-06-27 01:08:22 +0800 |
commit | a89ee61180a95a9d67f074d5f165e33d8e345bc9 (patch) | |
tree | 8c61c14be8fc50e3aecca0754bec186889843205 /gcc | |
parent | 6952f9871f74f60090fa311c709bf66c4bb3a3d9 (diff) | |
download | gcc-a89ee61180a95a9d67f074d5f165e33d8e345bc9.zip gcc-a89ee61180a95a9d67f074d5f165e33d8e345bc9.tar.gz gcc-a89ee61180a95a9d67f074d5f165e33d8e345bc9.tar.bz2 |
mark live symbol in return expr
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/lint/rust-lint-marklive.h | 6 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/torture/return_function.rs | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/rust/lint/rust-lint-marklive.h b/gcc/rust/lint/rust-lint-marklive.h index 27dfe36..4952c9a 100644 --- a/gcc/rust/lint/rust-lint-marklive.h +++ b/gcc/rust/lint/rust-lint-marklive.h @@ -119,6 +119,12 @@ public: function.get_definition ().get ()->accept_vis (*this); } + void visit (HIR::ReturnExpr &expr) override + { + if (expr.has_return_expr ()) + expr.get_expr ()->accept_vis (*this); + } + void visit (HIR::ExprStmtWithoutBlock &stmt) override { stmt.get_expr ()->accept_vis (*this); diff --git a/gcc/testsuite/rust/compile/torture/return_function.rs b/gcc/testsuite/rust/compile/torture/return_function.rs new file mode 100644 index 0000000..084adaf --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/return_function.rs @@ -0,0 +1,5 @@ +fn foo() {} + +fn main() { + return foo(); +} |