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 | f380534a1abb84f829846b7eda21318fa4666df3 (patch) | |
tree | 7edb8575e26b81a85a9fc652d1e595fef858cd22 /clang/lib/StaticAnalyzer/Core/CheckerManager.cpp | |
parent | 3eae33412d18c4a4a4a8592898b3e65ad5946a89 (diff) | |
download | bcm5719-llvm-f380534a1abb84f829846b7eda21318fa4666df3.tar.gz bcm5719-llvm-f380534a1abb84f829846b7eda21318fa4666df3.zip |
[analyzer] Make branch for condition callback use CheckerContext
Now, all the path sensitive checkers use CheckerContext!
llvm-svn: 142944
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CheckerManager.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/CheckerManager.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp index 67fe4d6ca21..ecb1a7a4ce3 100644 --- a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp @@ -320,15 +320,39 @@ void CheckerManager::runCheckersForEndPath(NodeBuilderContext &BC, } } +namespace { + struct CheckBranchConditionContext { + typedef std::vector<CheckerManager::CheckBranchConditionFunc> CheckersTy; + const CheckersTy &Checkers; + const Stmt *Condition; + ExprEngine &Eng; + + CheckersTy::const_iterator checkers_begin() { return Checkers.begin(); } + CheckersTy::const_iterator checkers_end() { return Checkers.end(); } + + CheckBranchConditionContext(const CheckersTy &checkers, + const Stmt *Cond, ExprEngine &eng) + : Checkers(checkers), Condition(Cond), Eng(eng) {} + + void runChecker(CheckerManager::CheckBranchConditionFunc checkFn, + NodeBuilder &Bldr, ExplodedNode *Pred) { + ProgramPoint L = PostCondition(Condition, Pred->getLocationContext(), + checkFn.Checker); + CheckerContext C(Bldr, Eng, Pred, L, 0); + checkFn(Condition, C); + } + }; +} + /// \brief Run checkers for branch condition. -void CheckerManager::runCheckersForBranchCondition(const Stmt *condition, - NodeBuilder &B, +void CheckerManager::runCheckersForBranchCondition(const Stmt *Condition, + ExplodedNodeSet &Dst, ExplodedNode *Pred, ExprEngine &Eng) { - for (unsigned i = 0, e = BranchConditionCheckers.size(); i != e; ++i) { - CheckBranchConditionFunc fn = BranchConditionCheckers[i]; - fn(condition, B, Pred, Eng); - } + ExplodedNodeSet Src; + Src.insert(Pred); + CheckBranchConditionContext C(BranchConditionCheckers, Condition, Eng); + expandGraphWithCheckers(C, Dst, Src); } /// \brief Run checkers for live symbols. |