aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngine.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-30 19:27:39 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-30 19:27:39 +0000
commit1e2b1fc4c4ae775adb2b236a8190f5a93b09ea12 (patch)
treec1e054756b41c1ed430598b887fa20a6cbfa3a0a /lib/Analysis/GRExprEngine.cpp
parente4173c25c28bee676cfa02aa8ecbf8db3517ef70 (diff)
Move method out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r--lib/Analysis/GRExprEngine.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index d9bdd8be0b..5268e1324f 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -2691,6 +2691,36 @@ void GRExprEngine::EvalBinOp(GRStateSet& OStates, const GRState* St,
if (R.isValid()) getTF().EvalBinOpNN(OStates, *this, St, Ex, Op, L, R);
}
+SVal GRExprEngine::EvalBinOp(BinaryOperator::Opcode Op, SVal L, SVal R) {
+
+ if (L.isUndef() || R.isUndef())
+ return UndefinedVal();
+
+ if (L.isUnknown() || R.isUnknown())
+ return UnknownVal();
+
+ if (isa<Loc>(L)) {
+ if (isa<Loc>(R))
+ return getTF().EvalBinOp(*this, Op, cast<Loc>(L), cast<Loc>(R));
+ else
+ return getTF().EvalBinOp(*this, Op, cast<Loc>(L), cast<NonLoc>(R));
+ }
+
+ if (isa<Loc>(R)) {
+ // Support pointer arithmetic where the increment/decrement operand
+ // is on the left and the pointer on the right.
+
+ assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub);
+
+ // Commute the operands.
+ return getTF().EvalBinOp(*this, Op, cast<Loc>(R),
+ cast<NonLoc>(L));
+ }
+ else
+ return getTF().DetermEvalBinOpNN(*this, Op, cast<NonLoc>(L),
+ cast<NonLoc>(R));
+}
+
//===----------------------------------------------------------------------===//
// Visualization.
//===----------------------------------------------------------------------===//