@@ -624,33 +624,32 @@ struct CheckFallThroughDiagnostics {
624624 }
625625};
626626
627- } // anonymous namespace
628-
629- static bool isKnownToAlwaysThrow (const FunctionDecl *FD) {
630- if (!FD->hasBody ())
631- return false ;
632- const Stmt *Body = FD->getBody ();
633- const Stmt *OnlyStmt = nullptr ;
634-
635- if (const auto *Compound = dyn_cast<CompoundStmt>(Body)) {
636- if (Compound->size () != 1 )
637- return false ; // More than one statement, can't be known to always throw.
638- OnlyStmt = *Compound->body_begin ();
639- } else {
640- OnlyStmt = Body;
641- }
627+ bool isKnownToAlwaysThrow (const FunctionDecl *FD) {
628+ if (!FD->hasBody ())
629+ return false ;
630+ const Stmt *Body = FD->getBody ();
631+ const Stmt *OnlyStmt = nullptr ;
632+
633+ if (const auto *Compound = dyn_cast<CompoundStmt>(Body)) {
634+ if (Compound->size () != 1 )
635+ return false ; // More than one statement, can't be known to always throw.
636+ OnlyStmt = *Compound->body_begin ();
637+ } else {
638+ OnlyStmt = Body;
639+ }
642640
643- // Unwrap ExprWithCleanups if necessary.
644- if (const auto *EWC = dyn_cast<ExprWithCleanups>(OnlyStmt)) {
645- OnlyStmt = EWC->getSubExpr ();
646- }
647- // Check if the only statement is a throw expression.
648- if (isa<CXXThrowExpr>(OnlyStmt)) {
649- return true ; // Known to always throw.
641+ // Unwrap ExprWithCleanups if necessary.
642+ if (const auto *EWC = dyn_cast<ExprWithCleanups>(OnlyStmt)) {
643+ OnlyStmt = EWC->getSubExpr ();
644+ }
645+ // Check if the only statement is a throw expression.
646+ if (isa<CXXThrowExpr>(OnlyStmt)) {
647+ return true ; // Known to always throw.
648+ }
649+ return false ; // Not known to always throw.
650650 }
651- return false ; // Not known to always throw.
652- }
653651
652+ } // anonymous namespace
654653// / CheckFallThroughForBody - Check that we don't fall off the end of a
655654// / function that should return a value. Check that we don't fall off the end
656655// / of a noreturn function. We assume that functions and blocks not marked
0 commit comments