ilya-palachev removed rL LLVM as the repository for this revision. ilya-palachev updated this revision to Diff 81221. ilya-palachev added a comment.
Fixed a typo https://reviews.llvm.org/D27710 Files: lib/StaticAnalyzer/Core/CoreEngine.cpp lib/StaticAnalyzer/Core/ExplodedGraph.cpp Index: lib/StaticAnalyzer/Core/ExplodedGraph.cpp =================================================================== --- lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -215,6 +215,11 @@ void ExplodedNode::addPredecessor(ExplodedNode *V, ExplodedGraph &G) { assert (!V->isSink()); + for (ExplodedNode *N : Preds) + assert(N != V && "Edge already exists"); + for (ExplodedNode *N : V->Succs) + assert(N != this && "Edge already exists"); + Preds.addNode(V, G); V->Succs.addNode(this, G); #ifndef NDEBUG Index: lib/StaticAnalyzer/Core/CoreEngine.cpp =================================================================== --- lib/StaticAnalyzer/Core/CoreEngine.cpp +++ lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -657,7 +657,17 @@ HasGeneratedNodes = true; bool IsNew; ExplodedNode *N = C.Eng.G.getNode(Loc, State, MarkAsSink, &IsNew); - N->addPredecessor(FromN, C.Eng.G); + + bool EdgeExists = false; + for (auto I = N->pred_begin(), E = N->pred_end(); I != E; ++I) + if (*I == FromN) { + EdgeExists = true; + break; + } + + if (!EdgeExists) + N->addPredecessor(FromN, C.Eng.G); + Frontier.erase(FromN); if (!IsNew)
Index: lib/StaticAnalyzer/Core/ExplodedGraph.cpp =================================================================== --- lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -215,6 +215,11 @@ void ExplodedNode::addPredecessor(ExplodedNode *V, ExplodedGraph &G) { assert (!V->isSink()); + for (ExplodedNode *N : Preds) + assert(N != V && "Edge already exists"); + for (ExplodedNode *N : V->Succs) + assert(N != this && "Edge already exists"); + Preds.addNode(V, G); V->Succs.addNode(this, G); #ifndef NDEBUG Index: lib/StaticAnalyzer/Core/CoreEngine.cpp =================================================================== --- lib/StaticAnalyzer/Core/CoreEngine.cpp +++ lib/StaticAnalyzer/Core/CoreEngine.cpp @@ -657,7 +657,17 @@ HasGeneratedNodes = true; bool IsNew; ExplodedNode *N = C.Eng.G.getNode(Loc, State, MarkAsSink, &IsNew); - N->addPredecessor(FromN, C.Eng.G); + + bool EdgeExists = false; + for (auto I = N->pred_begin(), E = N->pred_end(); I != E; ++I) + if (*I == FromN) { + EdgeExists = true; + break; + } + + if (!EdgeExists) + N->addPredecessor(FromN, C.Eng.G); + Frontier.erase(FromN); if (!IsNew)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits