[clang] [codegen] Emit missing cleanups for stmt-expr and coro suspensions [take-2] (PR #85398)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 05:42:46 PDT 2024


================
@@ -2503,6 +2505,26 @@ Stmt *BlockExpr::getBody() {
 // Generic Expression Routines
 //===----------------------------------------------------------------------===//
 
+bool Expr::mayBranchOut() const {
+  struct BranchDetector : public RecursiveASTVisitor<BranchDetector> {
+    bool HasBranch = false;
+    bool activate() {
+      HasBranch = true;
+      return false;
+    }
+    // Coroutine suspensions.
+    bool VisitCoawaitExpr(CoawaitExpr *) { return activate(); }
+    bool VisitCoyieldExpr(CoyieldExpr *) { return activate(); }
----------------
AaronBallman wrote:

Should this also handle `co_return` statements?

https://github.com/llvm/llvm-project/pull/85398


More information about the cfe-commits mailing list