Skip to content

Commit ca32cf1

Browse files
committed
Fix handling of --performance-valueflow-max-time=T
1 parent 8686997 commit ca32cf1

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/valueflow.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8860,6 +8860,12 @@ static std::size_t getTotalValues(TokenList *tokenlist)
88608860
return n;
88618861
}
88628862

8863+
static std::uint64_t getValueFlowStopTime(const Settings* settings) {
8864+
if (settings->performanceValueFlowMaxTime >= 0)
8865+
return std::time(nullptr) + settings->performanceValueFlowMaxTime;
8866+
return ~0ULL;
8867+
}
8868+
88638869
void ValueFlow::setValues(TokenList *tokenlist, SymbolDatabase* symboldatabase, ErrorLogger *errorLogger, const Settings *settings)
88648870
{
88658871
for (Token *tok = tokenlist->front(); tok; tok = tok->next())
@@ -8881,7 +8887,7 @@ void ValueFlow::setValues(TokenList *tokenlist, SymbolDatabase* symboldatabase,
88818887
valueFlowSameExpressions(tokenlist);
88828888
valueFlowConditionExpressions(tokenlist, symboldatabase, errorLogger, settings);
88838889

8884-
const std::time_t stopTime = (settings->performanceValueFlowMaxTime >= 0) ? (std::time(nullptr) + settings->performanceValueFlowMaxTime) : (~0ULL/2);
8890+
const std::uint64_t stopTime = getValueFlowStopTime(settings);
88858891

88868892
std::size_t values = 0;
88878893
std::size_t n = 4;

0 commit comments

Comments
 (0)