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

Function notvar

lib/checkmemoryleak.cpp:385–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383
384
385static bool notvar(const Token *tok, nonneg int varid)
386{
387 if (!tok)
388 return false;
389 if (Token::Match(tok, "&&|;"))
390 return notvar(tok->astOperand1(),varid) || notvar(tok->astOperand2(),varid);
391 if (tok->str() == "(" && Token::Match(tok->astOperand1(), "UNLIKELY|LIKELY"))
392 return notvar(tok->astOperand2(), varid);
393 const Token *vartok = astIsVariableComparison(tok, "==", "0");
394 return vartok && (vartok->varId() == varid);
395}
396
397static bool ifvar(const Token *tok, nonneg int varid, const std::string &comp, const std::string &rhs)
398{

Callers 2

checkReallocUsageMethod · 0.85
checkStructVariableMethod · 0.85

Calls 4

astIsVariableComparisonFunction · 0.85
astOperand1Method · 0.80
astOperand2Method · 0.80
strMethod · 0.45

Tested by

no test coverage detected