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

Function getKnownValueFromToken

lib/valueflow.cpp:5778–5788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5776}
5777
5778static const ValueFlow::Value* getKnownValueFromToken(const Token* tok)
5779{
5780 if (!tok)
5781 return nullptr;
5782 auto it = std::find_if(tok->values().begin(), tok->values().end(), [&](const ValueFlow::Value& v) {
5783 return (v.isIntValue() || v.isContainerSizeValue() || v.isFloatValue()) && v.isKnown();
5784 });
5785 if (it == tok->values().end())
5786 return nullptr;
5787 return std::addressof(*it);
5788}
5789
5790static std::vector<ValueFlow::Value> getCommonValuesFromTokens(const std::vector<const Token*>& toks)
5791{

Callers 1

valueFlowFunctionReturnFunction · 0.85

Calls 4

addressofFunction · 0.85
isKnownMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected