From f0aeb845e5d21f9dc0637a0bee9b31928e0f44ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 17 Jul 2019 22:17:34 +0200 Subject: [PATCH] ValueFlow: Clarify warnings when argument min/max values are used --- lib/valueflow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 8732c6908..b8749cc8f 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5439,10 +5439,14 @@ static void valueFlowSafeFunctions(TokenList *tokenlist, SymbolDatabase *symbold } std::list 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(functionScope->bodyStart->next()),