diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-11-24 08:53:20 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-11-24 08:53:20 +0000 |
commit | 19b78d9e3dbbc27bbcbdd8c3017a00fe88849ecd (patch) | |
tree | 313c72a34a82e178a70c3e47e395c0ae564cb99a /lib/Checker/GRExprEngine.cpp | |
parent | 5281b8ed0e395603e5ff15ecc01ee0d0dff2e0fd (diff) |
Use StackFrameContext directly in CallEnter program point. Then we don't need
to remake the stackframe everytime in GRExprEngine::ProcessCallEnter().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/GRExprEngine.cpp')
-rw-r--r-- | lib/Checker/GRExprEngine.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp index 30ac9cefbb..f0aa38b07c 100644 --- a/lib/Checker/GRExprEngine.cpp +++ b/lib/Checker/GRExprEngine.cpp @@ -1619,24 +1619,16 @@ void GRExprEngine::ProcessSwitch(GRSwitchNodeBuilder& builder) { } void GRExprEngine::ProcessCallEnter(GRCallEnterNodeBuilder &B) { - const StackFrameContext *LocCtx - = AMgr.getStackFrame(B.getCalleeContext(), - B.getLocationContext(), - B.getCallExpr(), - B.getBlock(), - B.getIndex()); - - const GRState *state = B.getState()->EnterStackFrame(LocCtx); - - B.GenerateNode(state, LocCtx); + const GRState *state = B.getState()->EnterStackFrame(B.getCalleeContext()); + B.GenerateNode(state); } void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) { const GRState *state = B.getState(); const ExplodedNode *Pred = B.getPredecessor(); - const StackFrameContext *LocCtx = + const StackFrameContext *calleeCtx = cast<StackFrameContext>(Pred->getLocationContext()); - const Stmt *CE = LocCtx->getCallSite(); + const Stmt *CE = calleeCtx->getCallSite(); // If the callee returns an expression, bind its value to CallExpr. const Stmt *ReturnedExpr = state->get<ReturnExpr>(); @@ -1650,7 +1642,7 @@ void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) { // Bind the constructed object value to CXXConstructExpr. if (const CXXConstructExpr *CCE = dyn_cast<CXXConstructExpr>(CE)) { const CXXThisRegion *ThisR = - getCXXThisRegion(CCE->getConstructor()->getParent(), LocCtx); + getCXXThisRegion(CCE->getConstructor()->getParent(), calleeCtx); // We might not have 'this' region in the binding if we didn't inline // the ctor call. SVal ThisV = state->getSVal(ThisR); @@ -2078,8 +2070,12 @@ bool GRExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, // Check if the function definition is in the same translation unit. if (FD->hasBody(FD)) { + const StackFrameContext *stackFrame = + AMgr.getStackFrame(AMgr.getAnalysisContext(FD), + Pred->getLocationContext(), + CE, Builder->getBlock(), Builder->getIndex()); // Now we have the definition of the callee, create a CallEnter node. - CallEnter Loc(CE, AMgr.getAnalysisContext(FD), Pred->getLocationContext()); + CallEnter Loc(CE, stackFrame, Pred->getLocationContext()); ExplodedNode *N = Builder->generateNode(Loc, state, Pred); Dst.Add(N); @@ -2088,11 +2084,13 @@ bool GRExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE, // Check if we can find the function definition in other translation units. if (AMgr.hasIndexer()) { - const AnalysisContext *C = AMgr.getAnalysisContextInAnotherTU(FD); + AnalysisContext *C = AMgr.getAnalysisContextInAnotherTU(FD); if (C == 0) return false; - - CallEnter Loc(CE, C, Pred->getLocationContext()); + const StackFrameContext *stackFrame = + AMgr.getStackFrame(C, Pred->getLocationContext(), + CE, Builder->getBlock(), Builder->getIndex()); + CallEnter Loc(CE, stackFrame, Pred->getLocationContext()); ExplodedNode *N = Builder->generateNode(Loc, state, Pred); Dst.Add(N); return true; |