[PATCH] D27710: [analyzer] Prohibit ExplodedGraph's edges duplicating
Ilya Palachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 13 05:59:45 PST 2016
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27710.81221.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161213/83d90dcc/attachment.bin>
More information about the cfe-commits
mailing list