================ @@ -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(); } + bool VisitReturnStmt(ReturnStmt *) { return activate(); } + bool VisitGotoStmt(GotoStmt *) { return activate(); } + }; ---------------- AaronBallman wrote:
Should we consider `throw` to be a kind of branching control flow 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