From 1e2b1fc4c4ae775adb2b236a8190f5a93b09ea12 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 30 Jan 2009 19:27:39 +0000 Subject: [PATCH] Move method out-of-line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63412 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Analysis/PathSensitive/GRExprEngine.h | 31 +------------------ 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(L)) { - if (isa(R)) - return getTF().EvalBinOp(*this, Op, cast(L), cast(R)); - else - return getTF().EvalBinOp(*this, Op, cast(L), cast(R)); - } - - if (isa(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(R), - cast(L)); - } - else - return getTF().DetermEvalBinOpNN(*this, Op, cast(L), - cast(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(L)) { + if (isa(R)) + return getTF().EvalBinOp(*this, Op, cast(L), cast(R)); + else + return getTF().EvalBinOp(*this, Op, cast(L), cast(R)); + } + + if (isa(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(R), + cast(L)); + } + else + return getTF().DetermEvalBinOpNN(*this, Op, cast(L), + cast(R)); +} + //===----------------------------------------------------------------------===// // Visualization. //===----------------------------------------------------------------------===// -- 2.50.1