diff options
author | Anna Zaks <ganna@apple.com> | 2011-10-25 19:56:54 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-10-25 19:56:54 +0000 |
commit | f236b6503a4dbc44c1fccb8756bd57c9d0efdf05 (patch) | |
tree | f22c7a0ddbc24d0e3bf43f12b98215bd6d34e60a /lib/StaticAnalyzer/Core/ExprEngine.cpp | |
parent | af498a28797c075c48d7e943df5f5a8e78ed8eb0 (diff) |
[analyzer] Make branch for condition callback use CheckerContext
Now, all the path sensitive checkers use CheckerContext!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngine.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index 3e5a31cda0..8ba2cd80a2 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -217,10 +217,13 @@ void ExprEngine::processCFGElement(const CFGElement E, ExplodedNode *Pred, ProcessImplicitDtor(*E.getAs<CFGImplicitDtor>(), Pred); return; } + currentStmtIdx = 0; + currentBuilderContext = 0; } const Stmt *ExprEngine::getStmt() const { - const CFGStmt *CS = (*currentBuilderContext->getBlock())[currentStmtIdx].getAs<CFGStmt>(); + const CFGStmt *CS = (*currentBuilderContext->getBlock())[currentStmtIdx] + .getAs<CFGStmt>(); return CS ? CS->getStmt() : 0; } @@ -1033,6 +1036,8 @@ void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term, ExplodedNodeSet &Dst, const CFGBlock *DstT, const CFGBlock *DstF) { + currentBuilderContext = &BldCtx; + // Check for NULL conditions; e.g. "for(;;)" if (!Condition) { BranchNodeBuilder NullCondBldr(Pred, Dst, BldCtx, DstT, DstF); @@ -1045,17 +1050,16 @@ void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term, Condition->getLocStart(), "Error evaluating branch"); - ExplodedNodeSet TmpCheckersOut; - NodeBuilder CheckerBldr(Pred, TmpCheckersOut, BldCtx); - getCheckerManager().runCheckersForBranchCondition(Condition, CheckerBldr, + ExplodedNodeSet CheckersOutSet; + getCheckerManager().runCheckersForBranchCondition(Condition, CheckersOutSet, Pred, *this); // We generated only sinks. - if (TmpCheckersOut.empty()) + if (CheckersOutSet.empty()) return; - BranchNodeBuilder builder(CheckerBldr.getResults(), Dst, BldCtx, DstT, DstF); - for (NodeBuilder::iterator I = CheckerBldr.begin(), - E = CheckerBldr.end(); E != I; ++I) { + BranchNodeBuilder builder(CheckersOutSet, Dst, BldCtx, DstT, DstF); + for (NodeBuilder::iterator I = CheckersOutSet.begin(), + E = CheckersOutSet.end(); E != I; ++I) { ExplodedNode *PredI = *I; if (PredI->isSink()) @@ -1107,6 +1111,7 @@ void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term, builder.markInfeasible(false); } } + currentBuilderContext = 0; } /// processIndirectGoto - Called by CoreEngine. Used to generate successor |