diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-07-17 21:27:31 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-07-17 21:27:31 +0000 |
commit | df7533b5e523a3def04b5c33b56361a94dd97d35 (patch) | |
tree | eb6b3bdbc20a65ef672764c3681b99b2111b6d6d /lib/Analysis/GRExprEngine.cpp | |
parent | 1f3846e3013a3b6679aeaa2e4c61de37a5c320ee (diff) |
Begin major changes to EvalXXX methods in GRTransferFuncs. Currently some of the methods only return an RVal; we want them to be able to create an arbitrary number of states.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index fa8009f3ef..e32fd0b331 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -121,7 +121,7 @@ GRExprEngine::GRExprEngine(CFG& cfg, Decl& CD, ASTContext& Ctx, Liveness(L), Builder(NULL), StateMgr(G.getContext(), CreateBasicStoreManager(G.getAllocator()), - G.getAllocator()), + G.getAllocator(), G.getCFG()), BasicVals(StateMgr.getBasicValueFactory()), TF(NULL), // FIXME SymMgr(StateMgr.getSymbolManager()), @@ -242,7 +242,10 @@ void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) { Builder = &builder; EntryNode = builder.getLastNode(); + + // FIXME: Consolidate. CurrentStmt = S; + StateMgr.CurrentStmt = S; // Set up our simple checks. if (BatchAuditor) @@ -296,7 +299,11 @@ void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) { // NULL out these variables to cleanup. CleanedState = NULL; EntryNode = NULL; - CurrentStmt = NULL; + + // FIXME: Consolidate. + StateMgr.CurrentStmt = 0; + CurrentStmt = 0; + Builder = NULL; } @@ -1802,8 +1809,13 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, } else { nonlval::ConcreteInt X(BasicVals.getValue(0, Ex->getType())); +#if 0 RVal Result = EvalBinOp(BinaryOperator::EQ, cast<NonLVal>(V), X); St = SetRVal(St, U, Result); +#else + EvalBinOp(Dst, U, BinaryOperator::EQ, cast<NonLVal>(V), X, *I); + continue; +#endif } break; @@ -2226,6 +2238,31 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B, } //===----------------------------------------------------------------------===// +// Transfer-function Helpers. +//===----------------------------------------------------------------------===// + +void GRExprEngine::EvalBinOp(ExplodedNodeSet<ValueState>& Dst, Expr* Ex, + BinaryOperator::Opcode Op, + NonLVal L, NonLVal R, + ExplodedNode<ValueState>* Pred) { + + if (!R.isValid()) { + MakeNode(Dst, Ex, Pred, SetRVal(GetState(Pred), Ex, R)); + return; + } + + assert (Builder && "GRStmtNodeBuilder must be defined."); + unsigned size = Dst.size(); + SaveOr OldHasGen(Builder->HasGeneratedNode); + + TF->EvalBinOpNN(Dst, *this, *Builder, Op, Ex, L, R, Pred); + + if (!Builder->BuildSinks && Dst.size() == size && + !Builder->HasGeneratedNode) + MakeNode(Dst, Ex, Pred, GetState(Pred)); +} + +//===----------------------------------------------------------------------===// // "Assume" logic. //===----------------------------------------------------------------------===// |