Check if op is add/subtract targeting pointer_rprimitive and integer of the same size.
(op: IntOp)
| 225 | |
| 226 | |
| 227 | def is_pointer_arithmetic(op: IntOp) -> bool: |
| 228 | """Check if op is add/subtract targeting pointer_rprimitive and integer of the same size.""" |
| 229 | if op.op not in (IntOp.ADD, IntOp.SUB): |
| 230 | return False |
| 231 | if not is_pointer_rprimitive(op.type): |
| 232 | return False |
| 233 | left = op.lhs.type |
| 234 | right = op.rhs.type |
| 235 | if is_pointer_rprimitive(left): |
| 236 | return is_valid_ptr_displacement_type(right) |
| 237 | if is_pointer_rprimitive(right): |
| 238 | return is_valid_ptr_displacement_type(left) |
| 239 | return False |
| 240 | |
| 241 | |
| 242 | class OpChecker(OpVisitor[None]): |
no test coverage detected
searching dependent graphs…