Skip to content

Commit d7428d3

Browse files
committed
Updates requested in PR 110: Added comments.
1 parent 936bda1 commit d7428d3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/taint-slicer/propagation_chains.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,29 @@ taint_propagation_chainst::erase_node(const node_idt nid)
279279
}
280280

281281
for(const auto &pred_nid : get_predecessors_map().at(nodes.size()))
282-
if(pred_nid!=nodes.size())
282+
if(pred_nid!=nodes.size()) // We have to exclude here the situation, when
283+
// the node 'nodes.size()' (i.e. the one
284+
// replacing the removed node 'nid') is its own
285+
// predecessor. We handle that situation later.
283286
{
284287
auto &edges=successors.at(pred_nid);
285288
edges[nid].insert(edges[nodes.size()].begin(), edges[nodes.size()].end());
286289
edges.erase(nodes.size());
287290
}
288291
for(const auto &nid_fns : get_successors_map().at(nodes.size()))
289-
if(nid_fns.first!=nodes.size())
292+
if(nid_fns.first!=nodes.size()) // We have to exclude here the situation,
293+
// when the node 'nodes.size()' (i.e. the
294+
// one replacing the removed node 'nid')
295+
// is its own predecessor. We handle that
296+
// situation later.
290297
{
291298
auto &edges=predecessors.at(nid_fns.first);
292299
edges.insert(nid);
293300
edges.erase(nodes.size());
294301
}
302+
// Here we handle the situation, when the node 'nodes.size()' (i.e. the one
303+
// replacing the removed node 'nid') is its own predecessor and successor
304+
// (i.e. when this node has a loop edge).
295305
if(get_predecessors_map().at(nodes.size()).count(nodes.size())!=0UL)
296306
{
297307
{
@@ -305,6 +315,9 @@ taint_propagation_chainst::erase_node(const node_idt nid)
305315
edges.erase(nodes.size());
306316
}
307317
}
318+
// Now we finally remove in- and out-edges of the node 'nid' (by replacing
319+
// them by the last node 'nodes.size()', which will become the new node
320+
// 'nid').
308321
successors.at(nid)=successors.at(nodes.size());
309322
successors.erase(nodes.size());
310323
predecessors.at(nid)=predecessors.at(nodes.size());

0 commit comments

Comments
 (0)