| 3658 | } |
| 3659 | |
| 3660 | bool isNullOperand(const Token *expr) |
| 3661 | { |
| 3662 | if (!expr) |
| 3663 | return false; |
| 3664 | if (expr->isCpp() && Token::Match(expr, "static_cast|const_cast|dynamic_cast|reinterpret_cast <")) |
| 3665 | expr = expr->astParent(); |
| 3666 | else if (!expr->isCast()) |
| 3667 | return Token::Match(expr, "NULL|nullptr"); |
| 3668 | if (expr->valueType() && expr->valueType()->pointer == 0) |
| 3669 | return false; |
| 3670 | const Token *castOp = expr->astOperand2() ? expr->astOperand2() : expr->astOperand1(); |
| 3671 | return Token::Match(castOp, "NULL|nullptr") || (MathLib::isInt(castOp->str()) && MathLib::isNullValue(castOp->str())); |
| 3672 | } |
| 3673 | |
| 3674 | bool isGlobalData(const Token *expr) |
| 3675 | { |