we automatically generate a new successor node along an edge if the checker
did not explicitly do so (i.e., we just propagate the current state).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46536
91177308-0d34-0410-b5e6-
96231b3b80d8
/// ProcessBranch - Called by GREngine. Used to generate successor
/// nodes by processing the 'effects' of a branch condition.
- void ProcessBranch(Stmt* Condition, Stmt* Term, BranchNodeBuilder& builder)
- {}
+ void ProcessBranch(Stmt* Condition, Stmt* Term, BranchNodeBuilder& builder);
/// RemoveDeadBindings - Return a new state that is the same as 'M' except
/// that all subexpression mappings are removed and that any
} // end anonymous namespace
+void GRConstants::ProcessBranch(Stmt* Condition, Stmt* Term,
+ BranchNodeBuilder& builder) {
+
+
+}
+
void GRConstants::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) {
Builder = &builder;
Succ->addPredecessor(Pred);
+ if (branch) GeneratedTrue = true;
+ else GeneratedFalse = true;
+
if (IsNew)
Eng.WList->Enqueue(GRWorkListUnit(Succ));
}
+
+GRBranchNodeBuilderImpl::~GRBranchNodeBuilderImpl() {
+ if (!GeneratedTrue) generateNodeImpl(Pred->State, true);
+ if (!GeneratedFalse) generateNodeImpl(Pred->State, false);
+}
CFGBlock* DstF;
ExplodedNodeImpl* Pred;
+ bool GeneratedTrue;
+ bool GeneratedFalse;
+
public:
GRBranchNodeBuilderImpl(CFGBlock* src, CFGBlock* dstT, CFGBlock* dstF,
ExplodedNodeImpl* pred, GREngineImpl* e)
- : Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred) {}
+ : Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred),
+ GeneratedTrue(false), GeneratedFalse(false) {}
- ~GRBranchNodeBuilderImpl() {}
+ ~GRBranchNodeBuilderImpl();
const ExplodedGraphImpl& getGraph() const { return *Eng.G; }