[analyzer] Make NodeBuilder and Pred node loosely coupled
NodeBuilder should not assume it's dealing with a single predecessor. Remove predecessor getters. Modify the BranchNodeBuilder to not be responsible for doing auto-transitions (which depend on a predecessor).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142453 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
index 451fa91..d030469 100644
--- a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
@@ -50,26 +50,26 @@
public:
void checkBranchCondition(const Stmt *Condition, NodeBuilder &Builder,
- ExprEngine &Eng) const;
+ ExplodedNode *Pred, ExprEngine &Eng) const;
};
}
void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
NodeBuilder &Builder,
+ ExplodedNode *Pred,
ExprEngine &Eng) const {
- const ProgramState *state = Builder.getState();
+ const ProgramState *state = Pred->getState();
SVal X = state->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,
- Builder.getPredecessor()->getLocationContext(), Tag);
+ 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,
- Builder.getPredecessor(), true);
+ Pred, true);
if (N) {
if (!BT)
BT.reset(