Fix regression by explicitly checking if we are negating a SymIntConstantVal.
llvm-svn: 53753
This commit is contained in:
parent
6a62d908c3
commit
b1c91bfc45
|
@ -83,6 +83,8 @@ public:
|
|||
return getRawKind() > UnknownKind;
|
||||
}
|
||||
|
||||
bool isZeroConstant() const;
|
||||
|
||||
void print(std::ostream& OS) const;
|
||||
void printStdErr() const;
|
||||
|
||||
|
|
|
@ -472,11 +472,16 @@ RVal GRSimpleVals::DetermEvalBinOpNN(ValueStateManager& StateMgr,
|
|||
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();
|
||||
|
||||
|
|
|
@ -54,6 +54,20 @@ RVal::symbol_iterator RVal::symbol_end() const {
|
|||
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.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue