================
@@ -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(); }
+    // Control flow in stmt-expressions.
+    bool VisitBreakStmt(BreakStmt *) { return activate(); }
----------------
usx95 wrote:

Yes. Added a test case for it as well.

https://github.com/llvm/llvm-project/pull/85398
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to