| 5040 | } |
| 5041 | |
| 5042 | static 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 | |
| 5064 | static void valueFlowInferCondition(TokenList& tokenlist, const Settings& settings) |
| 5065 | { |
no test coverage detected