diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-02-17 08:50:05 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-02-17 08:50:05 +0000 |
commit | df3a61bb5148361254c253eccd91aa4517cc8eaa (patch) | |
tree | 1aedde373ebeaac955a82ed8b243c93f3cf541bc /lib/Checker/CallInliner.cpp | |
parent | c30470dd245e2c3b367d3d806e75bf6cc20fc18c (diff) |
In symbol reaper, a variable is live if its stack frame is the parent of the
current stack frame.
When leaving a callee, remove all bindings belonging to that callee.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/CallInliner.cpp')
-rw-r--r-- | lib/Checker/CallInliner.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Checker/CallInliner.cpp b/lib/Checker/CallInliner.cpp index d94994b194..0279d46f22 100644 --- a/lib/Checker/CallInliner.cpp +++ b/lib/Checker/CallInliner.cpp @@ -65,6 +65,7 @@ bool CallInliner::EvalCallExpr(CheckerContext &C, const CallExpr *CE) { BlockEdge Loc(Entry, SuccB, LocCtx); state = C.getStoreManager().EnterStackFrame(state, LocCtx); + // This is a hack. We really should not use the GRStmtNodeBuilder. bool isNew; GRExprEngine &Eng = C.getEngine(); @@ -86,16 +87,26 @@ bool CallInliner::EvalCallExpr(CheckerContext &C, const CallExpr *CE) { void CallInliner::EvalEndPath(GREndPathNodeBuilder &B, void *tag, GRExprEngine &Eng) { const GRState *state = B.getState(); + ExplodedNode *Pred = B.getPredecessor(); + const StackFrameContext *LocCtx = cast<StackFrameContext>(Pred->getLocationContext()); - - const Stmt *CE = LocCtx->getCallSite(); - // Check if this is the top level stack frame. if (!LocCtx->getParent()) return; + const StackFrameContext *ParentSF = + cast<StackFrameContext>(LocCtx->getParent()); + + SymbolReaper SymReaper(*ParentSF->getLiveVariables(), Eng.getSymbolManager(), + ParentSF); + const Stmt *CE = LocCtx->getCallSite(); + + state = Eng.getStateManager().RemoveDeadBindings(state, const_cast<Stmt*>(CE), + SymReaper); + + PostStmt NodeLoc(CE, LocCtx->getParent()); bool isNew; |