@@ -426,9 +426,8 @@ namespace {
426426 branch.escape = true ;
427427 branch.escapeUnknown = false ;
428428 } else {
429- // Detect an escape that the traversal did not flag (e.g. an unknown noreturn call);
430- // isEscapeScope also reports a possible (unknown) escape via escapeUnknown. Such a
431- // branch may not fall through, so the fork must not continue past it.
429+ // Detect an escape the traversal did not flag (e.g. an unknown noreturn call);
430+ // escapeUnknown reports a possible (unknown) escape.
432431 branch.escape = isEscapeScope (branch.endBlock , branch.escapeUnknown );
433432 if (terminate != Analyzer::Terminate::None && terminate != Analyzer::Terminate::Modified) {
434433 branch.action |= analyzeScope (branch.endBlock );
@@ -679,10 +678,9 @@ namespace {
679678 Token* condTok = getCondTokFromEnd (tok);
680679 if (!condTok)
681680 return Break ();
682- // When leaving the 'then' branch, control only reaches here when the
683- // condition was true if the 'else' branch escapes (e.g. it returns). In that
684- // case the value established in 'then' is still definite, so keep it known
685- // instead of lowering it to possible.
681+ // When the 'else' branch escapes (e.g. returns), control can only continue
682+ // here via the 'then' branch, so the value established there is still
683+ // definite - keep it known instead of lowering to possible.
686684 bool elseEscape = false ;
687685 bool unknownEscape = false ;
688686 if (!inLoop && !inElse && hasElse)
@@ -788,18 +786,18 @@ namespace {
788786 } else {
789787 const bool conditional = stopOnCondition (condTok);
790788 // The value only flows into the then-branch when the condition can split
791- // it. For an opaque or correlated condition (e.g. 'if (f(x))' or
792- // 'if (do_write)') it does not really reach there , so fork in analyze-only
793- // mode: the branch's effect is still tracked but nothing is reported in it.
789+ // it; for an opaque or correlated condition (e.g. 'if (f(x))') it does
790+ // not, so fork in analyze-only mode: the branch's effect is still tracked
791+ // but nothing is reported in it.
794792 ForwardTraversal ft = fork (!analyzer->updateScope (thenBranch.endBlock , false ));
795793 // The branch is traversed below, so don't record its boundary state here.
796794 ft.analyzer ->assume (condTok, true , Analyzer::Assume::Pending);
797795 Progress pThen = ft.updateBranch (thenBranch, depth - 1 );
798796
799- // Only commit the condition as false on the main path when it actually
800- // matters. With an else the else block is traversed below (so suppress the
801- // boundary state); without one the false path continues past the closing
802- // brace and must record the assumed state there.
797+ // Commit the condition as false on the main path only when the then-branch
798+ // is dead. The else block, if any, is traversed separately (Pending); with
799+ // no else the false path continues past the closing brace, so record the
800+ // assumed state there (None) .
803801 if (thenBranch.isDead ())
804802 analyzer->assume (condTok, false , hasElse ? Analyzer::Assume::Pending : Analyzer::Assume::None);
805803 // The else block is traversed on the main path. If it kills the value
0 commit comments