ValueFlow: Clarify warnings when argument min/max values are used

This commit is contained in:
Daniel Marjamäki 2019-07-17 22:17:34 +02:00
parent a997a30824
commit f0aeb845e5
1 changed files with 6 additions and 2 deletions

View File

@ -5439,10 +5439,14 @@ static void valueFlowSafeFunctions(TokenList *tokenlist, SymbolDatabase *symbold
}
std::list<ValueFlow::Value> argValues;
if (isLow)
if (isLow) {
argValues.emplace_back(low);
if (isHigh)
argValues.back().errorPath.emplace_back(arg.nameToken(), "Assuming argument has value " + MathLib::toString(low));
}
if (isHigh) {
argValues.emplace_back(high);
argValues.back().errorPath.emplace_back(arg.nameToken(), "Assuming argument has value " + MathLib::toString(high));
}
if (!argValues.empty())
valueFlowForward(const_cast<Token *>(functionScope->bodyStart->next()),