@@ -505,7 +505,7 @@ namespace {
505505 actions = Analyzer::Action::None;
506506 Outcome outer = std::move (parted);
507507 parted = Outcome{};
508- const Progress p = updateRange (endBlock->link (), endBlock, depth);
508+ const Progress p = updateRange (endBlock->link (), endBlock, false , depth);
509509 const Outcome paths = outcome (p);
510510 outer.add (parted, false );
511511 parted = std::move (outer);
@@ -578,7 +578,7 @@ namespace {
578578 }
579579
580580 // Walk a block on a fork of this traversal, on which the condition holds
581- Branch updateForkedBranch (ForwardTraversal& ft, const Token* condTok, Token* endBlock, int depth, bool split )
581+ Branch updateForkedBranch (ForwardTraversal& ft, const Token* condTok, Token* endBlock, bool split, int depth )
582582 {
583583 ft.actions = actions;
584584 if (split) {
@@ -606,15 +606,15 @@ namespace {
606606
607607 // Neither outcome of the condition is known: the then block is walked on a fork, the else
608608 // block on this traversal.
609- Progress updateIfBranches (const Token* condTok, Token* thenEnd, Token* elseEnd, const Token* end, int depth, bool split )
609+ Progress updateIfBranches (const Token* condTok, Token* thenEnd, Token* elseEnd, const Token* end, bool split, int depth )
610610 {
611611 const bool conditional = stopOnCondition (condTok);
612612 Token* ifEnd = elseEnd ? elseEnd : thenEnd;
613613 // The value only flows into the then block when the condition can split it; for an opaque
614614 // or correlated condition (e.g. 'if (f(x))') it does not, so the fork is analyze-only: the
615615 // block's effect is still tracked but nothing is reported in it.
616616 ForwardTraversal ft = fork (!analyzer->updateScope (thenEnd, false ));
617- const Branch thenBranch = updateForkedBranch (ft, condTok, thenEnd, depth - 1 , split );
617+ const Branch thenBranch = updateForkedBranch (ft, condTok, thenEnd, split, depth - 1 );
618618
619619 // The condition is an assumption on this path if the then path drops the value. If the
620620 // then path goes on past the if, the value is the same with and without it. Otherwise
@@ -642,13 +642,13 @@ namespace {
642642 analyzer->updateState (ifEnd->next ());
643643 }
644644 elseBranch.traversal = this ;
645- return continueAfterBranches ({thenBranch, elseBranch}, conditional, ifEnd->next (), end, depth, split );
645+ return continueAfterBranches ({thenBranch, elseBranch}, conditional, ifEnd->next (), end, split, depth );
646646 }
647647
648648 // The blocks of a branching statement were walked, each on a fork or on this traversal.
649649 // Decide which of the paths go on past the statement. split: every path goes on to the end
650650 // of the range on its own. Otherwise one path goes on for all of them.
651- Progress continueAfterBranches (const std::vector<Branch>& branches, bool conditional, Token* next, const Token* end, int depth, bool split )
651+ Progress continueAfterBranches (const std::vector<Branch>& branches, bool conditional, Token* next, const Token* end, bool split, int depth )
652652 {
653653 const Analyzer::Action action =
654654 std::accumulate (branches.cbegin (), branches.cend (), Analyzer::Action{}, [](Analyzer::Action a, const Branch& branch) {
@@ -865,7 +865,7 @@ namespace {
865865 if (!endBlock)
866866 return Break ();
867867 updateScopeState (endBlock);
868- return updateRange (endBlock->link (), endBlock, depth);
868+ return updateRange (endBlock->link (), endBlock, false , depth);
869869 }
870870
871871 Progress updateAllScopePaths (Token* endBlock, int depth = 20 )
@@ -879,7 +879,7 @@ namespace {
879879 // Walk this path and every path that parts from it to the end of the range
880880 Outcome updatePaths (Token* start, const Token* end, int depth)
881881 {
882- return outcome (updateRange (start, end, depth, true ));
882+ return outcome (updateRange (start, end, true , depth ));
883883 }
884884
885885 // As updatePaths(), and this traversal gets the joint result of the paths. It must not go on
@@ -901,7 +901,7 @@ namespace {
901901 * range on this traversal. Otherwise one path has to stand for all of them at its end.
902902 * @throws InternalError thrown on cyclic analysis
903903 */
904- Progress updateRange (Token* start, const Token* end, int depth = 20 , bool split = false ) {
904+ Progress updateRange (Token* start, const Token* end, bool split, int depth = 20 ) {
905905 if (depth < 0 )
906906 return Break (Analyzer::Terminate::Bail);
907907 std::size_t i = 0 ;
@@ -1069,7 +1069,7 @@ namespace {
10691069 } else if (checkElse) {
10701070 if (updateSingleIfBranch (elseEnd, endBlock, condTok, tok, depth) == Progress::Break)
10711071 return Break ();
1072- } else if (updateIfBranches (condTok, endBlock, elseEnd, end, depth, split && canFork ()) == Progress::Break) {
1072+ } else if (updateIfBranches (condTok, endBlock, elseEnd, end, split && canFork (), depth ) == Progress::Break) {
10731073 return Break ();
10741074 }
10751075 }
@@ -1124,7 +1124,7 @@ namespace {
11241124 return Break ();
11251125 // Since the call could be an unknown macro, traverse the tokens as a range instead of recursively
11261126 if (!Token::simpleMatch (callTok, " ( )" ) &&
1127- updateRange (callTok->next (), callTok->link (), depth - 1 ) == Progress::Break)
1127+ updateRange (callTok->next (), callTok->link (), false , depth - 1 ) == Progress::Break)
11281128 return Break ();
11291129 if (updateTok (callTok) == Progress::Break)
11301130 return Break ();
0 commit comments