return UnknownVal();
case nonlval::SymIntConstraintValKind: {
+
+ // Logical not?
+ if (!(Op == BinaryOperator::EQ && R.isZeroConstant()))
+ return UnknownVal();
+
const SymIntConstraint& C =
cast<nonlval::SymIntConstraintVal>(L).getConstraint();
BinaryOperator::Opcode Opc = C.getOpcode();
-
+
if (Opc < BinaryOperator::LT || Opc > BinaryOperator::NE)
return UnknownVal();
return X ? X+1 : NULL;
}
+//===----------------------------------------------------------------------===//
+// Useful predicates.
+//===----------------------------------------------------------------------===//
+
+bool RVal::isZeroConstant() const {
+ if (isa<lval::ConcreteInt>(*this))
+ return cast<lval::ConcreteInt>(*this).getValue() == 0;
+ else if (isa<nonlval::ConcreteInt>(*this))
+ return cast<nonlval::ConcreteInt>(*this).getValue() == 0;
+ else
+ return false;
+}
+
+
//===----------------------------------------------------------------------===//
// Transfer function dispatch for Non-LVals.
//===----------------------------------------------------------------------===//