summaryrefslogtreecommitdiffstats
path: root/clang/lib
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
commit0b0a64830a8f8517545190db1305c6a82d75a367 (patch)
tree70b382f9247d9e72910f1aa092bcb2194b6e0c3c /clang/lib
parent781db7a1ad4cd218f27d02040afb0a78cc204a5d (diff)
downloadbcm5719-llvm-0b0a64830a8f8517545190db1305c6a82d75a367.tar.gz
bcm5719-llvm-0b0a64830a8f8517545190db1305c6a82d75a367.zip
Move method out-of-line.
llvm-svn: 63412
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/GRExprEngine.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp
index d9bdd8be0b6..5268e1324f5 100644
--- a/clang/lib/Analysis/GRExprEngine.cpp
+++ b/clang/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.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud