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

Function getComparisonTokens

lib/checkleakautovar.cpp:294–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294static std::vector<const Token*> getComparisonTokens(const Token* tok)
295{
296 std::vector<const Token*> result{ tok };
297 if (tok->hasKnownValue(ValueFlow::Value::ValueType::SYMBOLIC))
298 result.push_back(tok->getKnownValue(ValueFlow::Value::ValueType::SYMBOLIC)->tokvalue);
299 for (const Token* op : { tok->astOperand1(), tok->astOperand2() }) {
300 if (op && op->hasKnownValue(ValueFlow::Value::ValueType::SYMBOLIC))
301 result.push_back(op->getKnownValue(ValueFlow::Value::ValueType::SYMBOLIC)->tokvalue);
302 }
303 return result;
304}
305
306bool CheckLeakAutoVarImpl::checkScope(const Token * const startToken,
307 VarInfo &varInfo,

Callers 1

checkScopeMethod · 0.85

Calls 5

hasKnownValueMethod · 0.80
getKnownValueMethod · 0.80
astOperand1Method · 0.80
astOperand2Method · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected