aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RValues.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-18 15:54:51 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-18 15:54:51 +0000
commit40fc5c7e235965af368a34cdbb6d32827cd1e1d8 (patch)
tree53e52252aa66b876dba1bd7e6b56df0cd4043216 /lib/Analysis/RValues.cpp
parent1e38f85dc0ee7a6af439a268c7ce2c12fbd29441 (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/Analysis/RValues.cpp')
-rw-r--r--lib/Analysis/RValues.cpp14
1 files changed, 14 insertions, 0 deletions
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.
//===----------------------------------------------------------------------===//