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

Method pointerArithBoolCond

lib/checkbool.cpp:430–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430void CheckBoolImpl::pointerArithBoolCond(const Token *tok)
431{
432 if (!tok)
433 return;
434 if (Token::Match(tok, "&&|%oror%")) {
435 pointerArithBoolCond(tok->astOperand1());
436 pointerArithBoolCond(tok->astOperand2());
437 return;
438 }
439 if (tok->str() != "+" && tok->str() != "-")
440 return;
441
442 if (tok->isBinaryOp() &&
443 tok->astOperand1()->isName() &&
444 tok->astOperand1()->variable() &&
445 tok->astOperand1()->variable()->isPointer() &&
446 tok->astOperand2()->isNumber())
447 pointerArithBoolError(tok);
448}
449
450void CheckBoolImpl::pointerArithBoolError(const Token *tok)
451{

Callers

nothing calls this directly

Calls 5

astOperand1Method · 0.80
astOperand2Method · 0.80
isBinaryOpMethod · 0.80
variableMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected