Skip to content

Commit 6eca4c2

Browse files
author
Your Name
committed
Cleanup
1 parent 32749c6 commit 6eca4c2

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

lib/forwardanalyzer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ namespace {
7777
bool check = false;
7878
bool escape = false;
7979
bool escapeUnknown = false;
80-
bool active = false;
8180
bool isEscape() const {
8281
return escape || escapeUnknown;
8382
}
@@ -802,14 +801,14 @@ namespace {
802801
}
803802
// Carry the then-fork forward, unless a limit is hit - then only the linear main
804803
// path continues (no bail). forkDepth bounds nesting, forkBudget total. <0 = off.
804+
assert(forkBudget != nullptr);
805805
const int forkDepthLimit = settings.vfOptions.maxForwardConditionForkDepth;
806806
const int forkBudgetLimit = settings.vfOptions.maxForwardConditionForks;
807807
const bool depthOk = forkDepthLimit < 0 || forkDepth < forkDepthLimit;
808-
const bool budgetOk = forkBudgetLimit < 0 || !forkBudget || *forkBudget < forkBudgetLimit;
808+
const bool budgetOk = forkBudgetLimit < 0 || *forkBudget < forkBudgetLimit;
809809
if (pThen != Progress::Break && !thenBranch.isEscape() && depthOk && budgetOk) {
810-
if (forkBudget)
811-
++(*forkBudget);
812-
ft.forkDepth = forkDepth + 1;
810+
++(*forkBudget);
811+
++ft.forkDepth;
813812
ft.updateRange(thenBranch.endBlock, end, depth - 1);
814813
}
815814
if (pElse == Progress::Break)

lib/programmemory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ ProgramMemoryState::FindChangedFn ProgramMemoryState::getCachedFindExpressionCha
589589
using EvalCache = std::map<const Token*, std::vector<MathLib::bigint>>;
590590
const std::shared_ptr<ChangedCache> cache = changedCache;
591591
const Settings* const sp = &settings;
592-
ProgramMemory snapshot = skipDeadCode ? state : ProgramMemory{};
593-
const std::shared_ptr<EvalCache> evalCache = std::make_shared<EvalCache>();
592+
ProgramMemory snapshot = state;
593+
const std::shared_ptr<EvalCache> evalCache = skipDeadCode ? std::make_shared<EvalCache>() : nullptr;
594594
return [cache, sp, snapshot, skipDeadCode, evalCache](const Token* expr,
595595
const Token* start,
596596
const Token* end) -> const Token* {

0 commit comments

Comments
 (0)