Skip to content

Commit 375a2a8

Browse files
Filter out duplicate source locations in witness
1 parent 4156c4f commit 375a2a8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/goto-programs/graphml_witness.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Author: Daniel Kroening
66
77
\*******************************************************************/
88

9-
#include <iostream>
10-
119
#include <util/base_type.h>
1210
#include <util/byte_operators.h>
1311
#include <util/config.h>
@@ -179,6 +177,7 @@ void graphml_witnesst::operator()(const goto_tracet &goto_trace)
179177
// step numbers start at 1
180178
std::vector<std::size_t> step_to_node(goto_trace.steps.size()+1, 0);
181179

180+
goto_tracet::stepst::const_iterator prev_it=goto_trace.steps.end();
182181
for(goto_tracet::stepst::const_iterator
183182
it=goto_trace.steps.begin();
184183
it!=goto_trace.steps.end();
@@ -188,6 +187,11 @@ void graphml_witnesst::operator()(const goto_tracet &goto_trace)
188187

189188
if(it->hidden ||
190189
(!it->is_assignment() && !it->is_goto() && !it->is_assert()) ||
190+
// we filter out steps with the same source location
191+
// TODO: if these are assignments we should accumulate them into
192+
// a single edge
193+
(prev_it!=goto_trace.steps.end() &&
194+
prev_it->pc->source_location==it->pc->source_location) ||
191195
(it->is_goto() && it->pc->guard.is_true()) ||
192196
source_location.is_nil() ||
193197
source_location.get_file().empty() ||
@@ -212,6 +216,8 @@ void graphml_witnesst::operator()(const goto_tracet &goto_trace)
212216
continue;
213217
}
214218

219+
prev_it=it;
220+
215221
const graphmlt::node_indext node=graphml.add_node();
216222
graphml[node].node_name=
217223
i2string(it->pc->location_number)+"."+i2string(it->step_nr);

0 commit comments

Comments
 (0)