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

Function isIntegralOrPointer

lib/valueflow.cpp:5042–5062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5040}
5041
5042static bool isIntegralOrPointer(const Token* tok)
5043{
5044 if (!tok)
5045 return false;
5046 if (astIsIntegral(tok, false))
5047 return true;
5048 if (astIsPointer(tok))
5049 return true;
5050 if (Token::Match(tok, "NULL|nullptr"))
5051 return true;
5052 if (tok->valueType())
5053 return false;
5054 // These operators only work on integers
5055 if (isIntegralOnlyOperator(tok))
5056 return true;
5057 if (isIntegralOnlyOperator(tok->astParent()))
5058 return true;
5059 if (Token::Match(tok, "+|-|*|/") && tok->isBinaryOp())
5060 return isIntegralOrPointer(tok->astOperand1()) && isIntegralOrPointer(tok->astOperand2());
5061 return false;
5062}
5063
5064static void valueFlowInferCondition(TokenList& tokenlist, const Settings& settings)
5065{

Callers 1

valueFlowInferConditionFunction · 0.85

Calls 7

astIsIntegralFunction · 0.85
astIsPointerFunction · 0.85
isIntegralOnlyOperatorFunction · 0.85
astParentMethod · 0.80
isBinaryOpMethod · 0.80
astOperand1Method · 0.80
astOperand2Method · 0.80

Tested by

no test coverage detected