diff options
| author | Ted Kremenek <kremenek@apple.com> | 2012-01-07 00:00:59 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2012-01-07 00:00:59 +0000 |
| commit | aee86cee357a5839c5d01633187590c4a5e4ce71 (patch) | |
| tree | 8f3c612490d9a93d283878c68f14d052593ff49c /clang/lib/StaticAnalyzer | |
| parent | 73a3fab480de3804b755d50e427f5d2cda0b6866 (diff) | |
| download | bcm5719-llvm-aee86cee357a5839c5d01633187590c4a5e4ce71.tar.gz bcm5719-llvm-aee86cee357a5839c5d01633187590c4a5e4ce71.zip | |
[analyzer] Remove CallExitNodeBuilder, and have ExprEngine::processCallExit() do the work manually. This is a nice simplification.
Along the way, fix Exprengine::processCallExit() to also perform the postStmt callback for checkers for CallExprs.
llvm-svn: 147697
Diffstat (limited to 'clang/lib/StaticAnalyzer')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/CoreEngine.cpp | 18 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp | 22 |
2 files changed, 18 insertions, 22 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp index bf4bf2db886..c505c44a971 100644 --- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -254,8 +254,7 @@ void CoreEngine::HandleCallEnter(const CallEnter &L, const CFGBlock *Block, } void CoreEngine::HandleCallExit(const CallExit &L, ExplodedNode *Pred) { - CallExitNodeBuilder Builder(*this, Pred); - SubEng.processCallExit(Builder); + SubEng.processCallExit(Pred); } void CoreEngine::HandleBlockEdge(const BlockEdge &L, ExplodedNode *Pred) { @@ -707,18 +706,3 @@ void CallEnterNodeBuilder::generateNode(const ProgramState *state) { if (isNew) Eng.WList->enqueue(Node); } - -void CallExitNodeBuilder::generateNode(const ProgramState *state) { - // Get the callee's location context. - const StackFrameContext *LocCtx - = cast<StackFrameContext>(Pred->getLocationContext()); - // When exiting an implicit automatic obj dtor call, the callsite is the Stmt - // that triggers the dtor. - PostStmt Loc(LocCtx->getCallSite(), LocCtx->getParent()); - bool isNew; - ExplodedNode *Node = Eng.G->getNode(Loc, state, false, &isNew); - Node->addPredecessor(const_cast<ExplodedNode*>(Pred), *Eng.G); - if (isNew) - Eng.WList->enqueue(Node, LocCtx->getCallSiteBlock(), - LocCtx->getIndex() + 1); -} diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index 3b508d28994..8e9cc3c91f3 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -34,11 +34,10 @@ void ExprEngine::processCallEnter(CallEnterNodeBuilder &B) { B.generateNode(state); } -void ExprEngine::processCallExit(CallExitNodeBuilder &B) { - const ProgramState *state = B.getState(); - const ExplodedNode *Pred = B.getPredecessor(); +void ExprEngine::processCallExit(ExplodedNode *Pred) { + const ProgramState *state = Pred->getState(); const StackFrameContext *calleeCtx = - cast<StackFrameContext>(Pred->getLocationContext()); + Pred->getLocationContext()->getCurrentStackFrame(); const Stmt *CE = calleeCtx->getCallSite(); // If the callee returns an expression, bind its value to CallExpr. @@ -60,8 +59,21 @@ void ExprEngine::processCallExit(CallExitNodeBuilder &B) { // Always bind the region to the CXXConstructExpr. state = state->BindExpr(CCE, Pred->getLocationContext(), ThisV); } + - B.generateNode(state); + PostStmt Loc(CE, calleeCtx->getParent()); + bool isNew; + ExplodedNode *N = G.getNode(Loc, state, false, &isNew); + N->addPredecessor(Pred, G); + if (!isNew) + return; + + // Perform the post-condition check of the CallExpr. + ExplodedNodeSet Dst; + getCheckerManager().runCheckersForPostStmt(Dst, N, CE, *this); + + // Enqueue nodes in Dst on the worklist. + Engine.enqueue(Dst); } static bool isPointerToConst(const ParmVarDecl *ParamDecl) { |

