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

Method getImpossibleValue

lib/programmemory.cpp:1698–1717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1696 return unknown();
1697 }
1698 static const ValueFlow::Value* getImpossibleValue(const Token* tok)
1699 {
1700 if (!tok)
1701 return nullptr;
1702 std::vector<const ValueFlow::Value*> values;
1703 for (const ValueFlow::Value& v : tok->values()) {
1704 if (!v.isImpossible())
1705 continue;
1706 if (v.isContainerSizeValue() || v.isIntValue()) {
1707 values.push_back(std::addressof(v));
1708 }
1709 }
1710 auto it =
1711 std::max_element(values.begin(), values.end(), [](const ValueFlow::Value* x, const ValueFlow::Value* y) {
1712 return x->intvalue < y->intvalue;
1713 });
1714 if (it == values.end())
1715 return nullptr;
1716 return *it;
1717 }
1718
1719 static bool updateValue(ValueFlow::Value& v, ValueFlow::Value x)
1720 {

Callers

nothing calls this directly

Calls 5

addressofFunction · 0.85
isImpossibleMethod · 0.80
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected