[cfe-commits] r53753 - in /cfe/trunk: include/clang/Analysis/PathSensitive/RValues.h lib/Analysis/GRSimpleVals.cpp lib/Analysis/RValues.cpp
Ted Kremenek
kremenek at apple.com
Fri Jul 18 08:54:51 PDT 2008
Author: kremenek
Date: Fri Jul 18 10:54:51 2008
New Revision: 53753
URL: http://llvm.org/viewvc/llvm-project?rev=53753&view=rev
Log:
Fix regression by explicitly checking if we are negating a SymIntConstantVal.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h
cfe/trunk/lib/Analysis/GRSimpleVals.cpp
cfe/trunk/lib/Analysis/RValues.cpp
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h?rev=53753&r1=53752&r2=53753&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h Fri Jul 18 10:54:51 2008
@@ -83,6 +83,8 @@
return getRawKind() > UnknownKind;
}
+ bool isZeroConstant() const;
+
void print(std::ostream& OS) const;
void printStdErr() const;
Modified: cfe/trunk/lib/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRSimpleVals.cpp?rev=53753&r1=53752&r2=53753&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/lib/Analysis/GRSimpleVals.cpp Fri Jul 18 10:54:51 2008
@@ -472,11 +472,16 @@
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();
Modified: cfe/trunk/lib/Analysis/RValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RValues.cpp?rev=53753&r1=53752&r2=53753&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RValues.cpp (original)
+++ cfe/trunk/lib/Analysis/RValues.cpp Fri Jul 18 10:54:51 2008
@@ -55,6 +55,20 @@
}
//===----------------------------------------------------------------------===//
+// 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.
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list