aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-25 19:56:54 +0000
committerAnna Zaks <ganna@apple.com>2011-10-25 19:56:54 +0000
commitf236b6503a4dbc44c1fccb8756bd57c9d0efdf05 (patch)
treef22c7a0ddbc24d0e3bf43f12b98215bd6d34e60a /lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
parentaf498a28797c075c48d7e943df5f5a8e78ed8eb0 (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/Checkers/UndefBranchChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
index d030469459..afb79b5d16 100644
--- a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
@@ -49,27 +49,18 @@ class UndefBranchChecker : public Checker<check::BranchCondition> {
};
public:
- void checkBranchCondition(const Stmt *Condition, NodeBuilder &Builder,
- ExplodedNode *Pred, ExprEngine &Eng) const;
+ void checkBranchCondition(const Stmt *Condition, CheckerContext &Ctx) const;
};
}
void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
- NodeBuilder &Builder,
- ExplodedNode *Pred,
- ExprEngine &Eng) const {
- const ProgramState *state = Pred->getState();
- SVal X = state->getSVal(Condition);
+ CheckerContext &Ctx) const {
+ SVal X = Ctx.getState()->getSVal(Condition);
if (X.isUndef()) {
- // TODO: The PP will be generated with the correct tag by the CheckerManager
- // after we migrate the callback to CheckerContext.
- const ProgramPointTag *Tag = 0;
- ProgramPoint PP = PostCondition(Condition, Pred->getLocationContext(), Tag);
// Generate a sink node, which implicitly marks both outgoing branches as
// infeasible.
- ExplodedNode *N = Builder.generateNode(PP, state,
- Pred, true);
+ ExplodedNode *N = Ctx.generateSink();
if (N) {
if (!BT)
BT.reset(
@@ -107,7 +98,7 @@ void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
R->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N, Ex));
R->addRange(Ex->getSourceRange());
- Eng.getBugReporter().EmitReport(R);
+ Ctx.EmitReport(R);
}
}
}