diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-12-20 06:32:12 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2008-12-20 06:32:12 +0000 |
commit | 4193eca10ce0cc8b2dae887e935a43b26f492b5b (patch) | |
tree | 33cef340f16cf56312c13fef38e99d749d76db7f /lib/Analysis/GRState.cpp | |
parent | 848b34baf2094a377ad2929d0d47cdc833ecdfca (diff) |
Lazy bingding for region-store manager.
* Now Bind() methods take and return GRState* because binding could
also alter GDM.
* No variables are initialized except those declared with initial
values.
* failed C test cases are due to bugs in RemoveDeadBindings(),
which removes constraints that is still alive. This will be fixed in later
patch.
* default value of array and struct regions will be implemented in later patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRState.cpp')
-rw-r--r-- | lib/Analysis/GRState.cpp | 52 |
1 files changed, 7 insertions, 45 deletions
diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 221ab064d3..8e49ebb63d 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -59,51 +59,6 @@ GRStateManager::RemoveDeadBindings(const GRState* state, Stmt* Loc, LSymbols, DSymbols); } -const GRState* GRStateManager::BindLoc(const GRState* St, Loc LV, SVal V) { - - Store OldStore = St->getStore(); - Store NewStore = StoreMgr->Bind(OldStore, LV, V); - - if (NewStore == OldStore) - return St; - - GRState NewSt = *St; - NewSt.St = NewStore; - return getPersistentState(NewSt); -} - -const GRState* GRStateManager::BindDecl(const GRState* St, const VarDecl* VD, - SVal* InitVal, unsigned Count) { - Store OldStore = St->getStore(); - Store NewStore = StoreMgr->BindDecl(OldStore, VD, InitVal, Count); - - if (NewStore == OldStore) - return St; - - GRState NewSt = *St; - NewSt.St = NewStore; - return getPersistentState(NewSt); -} - -/// BindCompoundLiteral - Return the store that has the bindings currently -/// in 'store' plus the bindings for the CompoundLiteral. 'R' is the region -/// for the compound literal and 'BegInit' and 'EndInit' represent an -/// array of initializer values. -const GRState* -GRStateManager::BindCompoundLiteral(const GRState* state, - const CompoundLiteralExpr* CL, SVal ILV) { - - Store oldStore = state->getStore(); - Store newStore = StoreMgr->BindCompoundLiteral(oldStore, CL, ILV); - - if (newStore == oldStore) - return state; - - GRState newState = *state; - newState.St = newStore; - return getPersistentState(newState); -} - const GRState* GRStateManager::Unbind(const GRState* St, Loc LV) { Store OldStore = St->getStore(); Store NewStore = StoreMgr->Remove(OldStore, LV); @@ -140,6 +95,13 @@ const GRState* GRStateManager::getPersistentState(GRState& State) { return I; } +const GRState* GRStateManager::MakeStateWithStore(const GRState* St, + Store store) { + GRState NewSt = *St; + NewSt.St = store; + return getPersistentState(NewSt); +} + //===----------------------------------------------------------------------===// // State pretty-printing. |