MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getCompareValue

Function getCompareValue

lib/token.cpp:2582–2599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2580
2581template<class Compare>
2582static const ValueFlow::Value* getCompareValue(const std::list<ValueFlow::Value>& values,
2583 bool condition,
2584 MathLib::bigint path,
2585 Compare compare)
2586{
2587 const ValueFlow::Value* ret = nullptr;
2588 for (const ValueFlow::Value& value : values) {
2589 if (!value.isIntValue())
2590 continue;
2591 if (value.isImpossible())
2592 continue;
2593 if (path > -0 && value.path != 0 && value.path != path)
2594 continue;
2595 if ((!ret || compare(value.intvalue, ret->intvalue)) && ((value.condition != nullptr) == condition))
2596 ret = &value;
2597 }
2598 return ret;
2599}
2600
2601const ValueFlow::Value* Token::getMaxValue(bool condition, MathLib::bigint path) const
2602{

Callers 2

getMaxValueMethod · 0.70
getMinValueMethod · 0.70

Calls 1

isImpossibleMethod · 0.80

Tested by

no test coverage detected