aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Young <wenzhang5800@gmail.com>2021-06-25 13:47:30 +0800
committerThomas Young <wenzhang5800@gmail.com>2021-06-26 11:59:54 +0800
commit0f486127e1ebbae32834f4edf5265efe012b968a (patch)
treec2fb53ce01754b9437083ce0ff8b527df9f584ff
parent99bc27d278359be9aec5597504807a6456a88a6c (diff)
downloadgcc-0f486127e1ebbae32834f4edf5265efe012b968a.zip
gcc-0f486127e1ebbae32834f4edf5265efe012b968a.tar.gz
gcc-0f486127e1ebbae32834f4edf5265efe012b968a.tar.bz2
mark live symbol in lazyBooleanExpr
-rw-r--r--gcc/rust/lint/rust-lint-marklive.h6
-rw-r--r--gcc/testsuite/rust/compile/torture/lazybooleanexpr_function.rs14
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/rust/lint/rust-lint-marklive.h b/gcc/rust/lint/rust-lint-marklive.h
index 74cf0d3..ea246ce 100644
--- a/gcc/rust/lint/rust-lint-marklive.h
+++ b/gcc/rust/lint/rust-lint-marklive.h
@@ -54,6 +54,12 @@ public:
expr.get_expr ().get ()->accept_vis (*this);
}
+ void visit (HIR::LazyBooleanExpr &expr) override
+ {
+ expr.get_lhs()->accept_vis(*this);
+ expr.get_rhs()->accept_vis(*this);
+ }
+
void visit (HIR::BlockExpr &expr) override
{
expr.iterate_stmts ([&] (HIR::Stmt *s) mutable -> bool {
diff --git a/gcc/testsuite/rust/compile/torture/lazybooleanexpr_function.rs b/gcc/testsuite/rust/compile/torture/lazybooleanexpr_function.rs
new file mode 100644
index 0000000..1be5127
--- /dev/null
+++ b/gcc/testsuite/rust/compile/torture/lazybooleanexpr_function.rs
@@ -0,0 +1,14 @@
+fn foo() -> bool {
+ return true;
+}
+
+fn bar() -> bool {
+ return false;
+}
+
+
+
+fn main() {
+ let _a = true && foo();
+ let _b = true || bar();
+} \ No newline at end of file