diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-07-18 15:54:51 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-07-18 15:54:51 +0000 |
commit | 40fc5c7e235965af368a34cdbb6d32827cd1e1d8 (patch) | |
tree | 53e52252aa66b876dba1bd7e6b56df0cd4043216 /lib | |
parent | 1e38f85dc0ee7a6af439a268c7ce2c12fbd29441 (diff) |
Fix regression by explicitly checking if we are negating a SymIntConstantVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53753 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/GRSimpleVals.cpp | 7 | ||||
-rw-r--r-- | lib/Analysis/RValues.cpp | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp index 6cb714a86e..36e7233f25 100644 --- a/lib/Analysis/GRSimpleVals.cpp +++ b/lib/Analysis/GRSimpleVals.cpp @@ -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(); diff --git a/lib/Analysis/RValues.cpp b/lib/Analysis/RValues.cpp index 60c349420a..ed3dba925e 100644 --- a/lib/Analysis/RValues.cpp +++ b/lib/Analysis/RValues.cpp @@ -55,6 +55,20 @@ RVal::symbol_iterator RVal::symbol_end() const { } //===----------------------------------------------------------------------===// +// 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. //===----------------------------------------------------------------------===// |