@@ -27,14 +27,12 @@ unified_difft::unified_difft(
27
27
{
28
28
}
29
29
30
- void unified_difft::get_diff ( const irep_idt &function, goto_program_difft &dest)
31
- const
30
+ unified_difft::goto_program_difft
31
+ unified_difft::get_diff ( const irep_idt &function) const
32
32
{
33
- dest.clear ();
34
-
35
33
differences_mapt::const_iterator entry = differences_map_.find (function);
36
34
if (entry == differences_map_.end ())
37
- return ;
35
+ return {} ;
38
36
39
37
goto_functionst::function_mapt::const_iterator old_fit =
40
38
old_goto_functions.function_map .find (function);
@@ -50,20 +48,21 @@ void unified_difft::get_diff(const irep_idt &function, goto_program_difft &dest)
50
48
new_fit == new_goto_functions.function_map .end () ? empty
51
49
: new_fit->second .body ;
52
50
53
- get_diff (old_goto_program, new_goto_program, entry->second , dest );
51
+ return get_diff (old_goto_program, new_goto_program, entry->second );
54
52
}
55
53
56
- void unified_difft::get_diff (
54
+ unified_difft::goto_program_difft unified_difft::get_diff (
57
55
const goto_programt &old_goto_program,
58
56
const goto_programt &new_goto_program,
59
- const differencest &differences,
60
- goto_program_difft &dest) const
57
+ const differencest &differences) const
61
58
{
62
59
goto_programt::instructionst::const_iterator old_it =
63
60
old_goto_program.instructions .begin ();
64
61
goto_programt::instructionst::const_iterator new_it =
65
62
new_goto_program.instructions .begin ();
66
63
64
+ goto_program_difft dest;
65
+
67
66
for (differencest::const_reverse_iterator rit = differences.rbegin ();
68
67
rit != differences.rend ();
69
68
++rit)
@@ -89,6 +88,8 @@ void unified_difft::get_diff(
89
88
break ;
90
89
}
91
90
}
91
+
92
+ return dest;
92
93
}
93
94
94
95
void unified_difft::output_diff (
@@ -98,8 +99,8 @@ void unified_difft::output_diff(
98
99
const differencest &differences,
99
100
std::ostream &os) const
100
101
{
101
- goto_program_difft diff;
102
- get_diff (old_goto_program, new_goto_program, differences, diff );
102
+ goto_program_difft diff =
103
+ get_diff (old_goto_program, new_goto_program, differences);
103
104
104
105
bool has_diff = false ;
105
106
for (const auto &d : diff)
0 commit comments