diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-01-30 19:27:39 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-01-30 19:27:39 +0000 |
commit | 1e2b1fc4c4ae775adb2b236a8190f5a93b09ea12 (patch) | |
tree | c1e054756b41c1ed430598b887fa20a6cbfa3a0a | |
parent | e4173c25c28bee676cfa02aa8ecbf8db3517ef70 (diff) |
Move method out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63412 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRExprEngine.h | 31 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 30 |
2 files changed, 31 insertions, 30 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 05bb333cdc..d84d17c017 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -638,36 +638,7 @@ protected: void EvalBinOp(GRStateSet& OStates, const GRState* St, Expr* Ex, BinaryOperator::Opcode Op, NonLoc L, NonLoc R); - SVal 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)); - } - + SVal EvalBinOp(BinaryOperator::Opcode Op, SVal L, SVal R); void EvalCall(NodeSet& Dst, CallExpr* CE, SVal L, NodeTy* Pred) { assert (Builder && "GRStmtNodeBuilder must be defined."); 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. //===----------------------------------------------------------------------===// |