Skip to content

Commit c43b4f4

Browse files
committed
Use common implementation of instruction/goto program equality
1 parent 5bf334e commit c43b4f4

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/goto-diff/syntactic_diff.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ bool syntactic_difft::operator()()
6767
continue;
6868
}
6969

70-
if(it->second.body.instructions.size() !=
71-
f_it->second.body.instructions.size())
70+
if(!it->second.body.equal(f_it->second.body))
7271
{
7372
modified_functions.insert(it->first);
7473
continue;
@@ -82,22 +81,7 @@ bool syntactic_difft::operator()()
8281
i_it2!=f_it->second.body.instructions.end();
8382
++i_it1, ++i_it2)
8483
{
85-
long jump_difference1 = 0;
86-
if(!i_it1->targets.empty())
87-
{
88-
jump_difference1 =
89-
i_it1->get_target()->location_number - i_it1->location_number;
90-
}
91-
long jump_difference2 = 0;
92-
if(!i_it2->targets.empty())
93-
{
94-
jump_difference2 =
95-
i_it2->get_target()->location_number - i_it2->location_number;
96-
}
97-
if(
98-
i_it1->code != i_it2->code || i_it1->function != i_it2->function ||
99-
i_it1->type != i_it2->type || i_it1->guard != i_it2->guard ||
100-
jump_difference1 != jump_difference2)
84+
if(i_it1->function != i_it2->function)
10185
{
10286
modified_functions.insert(it->first);
10387
break;

src/goto-diff/unified_diff.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ bool unified_difft::instructions_equal(
393393
const goto_programt::instructiont &ins1,
394394
const goto_programt::instructiont &ins2)
395395
{
396-
return ins1.code == ins2.code && ins1.function == ins2.function &&
397-
ins1.type == ins2.type && ins1.guard == ins2.guard &&
398-
ins1.targets.size() == ins2.targets.size() &&
396+
return ins1.equal(ins2) && ins1.function == ins2.function &&
399397
(ins1.targets.empty() ||
400398
instructions_equal(*ins1.get_target(), *ins2.get_target()));
401399
}

0 commit comments

Comments
 (0)