diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-10-13 02:24:55 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-10-13 02:24:55 +0000 |
commit | 4e3c1f7c2a2053cf770f744846a87087415eb340 (patch) | |
tree | d5d82c80125b75271b19ef1e9c4681a4d6cc8c4f /lib/Analysis/RegionStore.cpp | |
parent | 72ad5f54dadf86fe1741dea1387e4f0d1cb1d5c7 (diff) |
Add an initial implementation of EnterStackFrame() to the StoreManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83934 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r-- | lib/Analysis/RegionStore.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index f0bf072fa4..63bfa97c4d 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -353,6 +353,9 @@ public: void RemoveDeadBindings(GRState &state, Stmt* Loc, SymbolReaper& SymReaper, llvm::SmallVectorImpl<const MemRegion*>& RegionRoots); + const GRState *EnterStackFrame(const GRState *state, + const StackFrameContext *frame); + //===------------------------------------------------------------------===// // Region "extents". //===------------------------------------------------------------------===// @@ -1820,6 +1823,25 @@ void RegionStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc, state.setStore(store); } +GRState const *RegionStoreManager::EnterStackFrame(GRState const *state, + StackFrameContext const *frame) { + FunctionDecl const *FD = cast<FunctionDecl>(frame->getDecl()); + CallExpr const *CE = cast<CallExpr>(frame->getCallSite()); + + FunctionDecl::param_const_iterator PI = FD->param_begin(); + + CallExpr::const_arg_iterator AI = CE->arg_begin(), AE = CE->arg_end(); + + // Copy the arg expression value to the arg variables. + for (; AI != AE; ++AI, ++PI) { + SVal ArgVal = state->getSVal(*AI); + MemRegion *R = MRMgr.getVarRegion(*PI, frame); + state = Bind(state, ValMgr.makeLoc(R), ArgVal); + } + + return state; +} + //===----------------------------------------------------------------------===// // Utility methods. //===----------------------------------------------------------------------===// |