@@ -54,7 +54,7 @@ unified_difft::get_diff(const irep_idt &function) const
54
54
unified_difft::goto_program_difft unified_difft::get_diff (
55
55
const goto_programt &old_goto_program,
56
56
const goto_programt &new_goto_program,
57
- const differencest &differences) const
57
+ const differencest &differences)
58
58
{
59
59
goto_programt::instructionst::const_iterator old_it =
60
60
old_goto_program.instructions .begin ();
@@ -144,15 +144,15 @@ void unified_difft::output_diff(
144
144
}
145
145
}
146
146
147
- void unified_difft::lcss (
147
+ unified_difft::differencest unified_difft::lcss (
148
148
const irep_idt &identifier,
149
149
const goto_programt &old_goto_program,
150
- const goto_programt &new_goto_program,
151
- differencest &differences) const
150
+ const goto_programt &new_goto_program)
152
151
{
153
152
std::size_t old_count = old_goto_program.instructions .size ();
154
153
std::size_t new_count = new_goto_program.instructions .size ();
155
154
155
+ differencest differences;
156
156
differences.reserve (old_count + new_count);
157
157
158
158
// skip common prefix
@@ -200,7 +200,7 @@ void unified_difft::lcss(
200
200
// the common tail
201
201
202
202
if (old_count == 0 && new_count == 0 )
203
- return ;
203
+ return differences ;
204
204
205
205
// apply longest common subsequence (LCSS)
206
206
typedef std::vector<std::vector<std::size_t >> lcss_matrixt;
@@ -293,6 +293,8 @@ void unified_difft::lcss(
293
293
// add common prefix (if any)
294
294
for (; old_it != old_goto_program.instructions .begin (); --old_it)
295
295
differences.push_back (differencet::SAME);
296
+
297
+ return differences;
296
298
}
297
299
298
300
void unified_difft::unified_diff (
@@ -315,7 +317,7 @@ void unified_difft::unified_diff(
315
317
new_goto_program.instructions .size (), differencet::NEW);
316
318
}
317
319
else
318
- lcss (identifier, old_goto_program, new_goto_program, differences );
320
+ differences= lcss (identifier, old_goto_program, new_goto_program);
319
321
}
320
322
321
323
bool unified_difft::operator ()()
0 commit comments