[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
diff --git a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
index d030469..afb79b5 100644
--- a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
@@ -49,27 +49,18 @@
};
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 @@
R->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N, Ex));
R->addRange(Ex->getSourceRange());
- Eng.getBugReporter().EmitReport(R);
+ Ctx.EmitReport(R);
}
}
}