forked from OSchip/llvm-project
Move the dead bindings removal logic from CallInliner to GRExprEngine::ProcessCallExit().
llvm-svn: 97129
This commit is contained in:
parent
8fa1e7eec4
commit
9516feac36
clang
include/clang/Checker/PathSensitive
lib/Checker
|
@ -502,7 +502,11 @@ public:
|
|||
GRCallExitNodeBuilder(GRCoreEngine &eng, const ExplodedNode *pred)
|
||||
: Eng(eng), Pred(pred) {}
|
||||
|
||||
void GenerateNode();
|
||||
const ExplodedNode *getPredecessor() const { return Pred; }
|
||||
|
||||
const GRState *getState() const { return Pred->getState(); }
|
||||
|
||||
void GenerateNode(const GRState *state);
|
||||
};
|
||||
} // end clang namespace
|
||||
|
||||
|
|
|
@ -60,20 +60,10 @@ void CallInliner::EvalEndPath(GREndPathNodeBuilder &B, void *tag,
|
|||
ExplodedNode *Pred = B.getPredecessor();
|
||||
|
||||
const StackFrameContext *LocCtx =
|
||||
cast<StackFrameContext>(Pred->getLocationContext());
|
||||
cast<StackFrameContext>(Pred->getLocationContext());
|
||||
// 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();
|
||||
// FIXME: move this logic to GRExprEngine::ProcessCallExit().
|
||||
state = Eng.getStateManager().RemoveDeadBindings(state, const_cast<Stmt*>(CE),
|
||||
SymReaper);
|
||||
return;
|
||||
|
||||
B.GenerateCallExitNode(state);
|
||||
}
|
||||
|
|
|
@ -674,14 +674,14 @@ void GRCallEnterNodeBuilder::GenerateNode(const GRState *state,
|
|||
Eng.WList->Enqueue(Node);
|
||||
}
|
||||
|
||||
void GRCallExitNodeBuilder::GenerateNode() {
|
||||
void GRCallExitNodeBuilder::GenerateNode(const GRState *state) {
|
||||
// Get the callee's location context.
|
||||
const StackFrameContext *LocCtx
|
||||
= cast<StackFrameContext>(Pred->getLocationContext());
|
||||
|
||||
PostStmt Loc(LocCtx->getCallSite(), LocCtx->getParent());
|
||||
bool isNew;
|
||||
ExplodedNode *Node = Eng.G->getNode(Loc, Pred->getState(), &isNew);
|
||||
ExplodedNode *Node = Eng.G->getNode(Loc, state, &isNew);
|
||||
Node->addPredecessor(const_cast<ExplodedNode*>(Pred), *Eng.G);
|
||||
if (isNew)
|
||||
Eng.WList->Enqueue(Node, *const_cast<CFGBlock*>(LocCtx->getCallSiteBlock()),
|
||||
|
|
|
@ -1305,7 +1305,21 @@ void GRExprEngine::ProcessCallEnter(GRCallEnterNodeBuilder &B) {
|
|||
}
|
||||
|
||||
void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
|
||||
B.GenerateNode();
|
||||
const GRState *state = B.getState();
|
||||
const ExplodedNode *Pred = B.getPredecessor();
|
||||
const StackFrameContext *LocCtx =
|
||||
cast<StackFrameContext>(Pred->getLocationContext());
|
||||
const StackFrameContext *ParentSF =
|
||||
cast<StackFrameContext>(LocCtx->getParent());
|
||||
|
||||
SymbolReaper SymReaper(*ParentSF->getLiveVariables(), getSymbolManager(),
|
||||
ParentSF);
|
||||
const Stmt *CE = LocCtx->getCallSite();
|
||||
|
||||
state = getStateManager().RemoveDeadBindings(state, const_cast<Stmt*>(CE),
|
||||
SymReaper);
|
||||
|
||||
B.GenerateNode(state);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue