@@ -771,6 +771,7 @@ Function: abstract_environmentt::environment_diff
771
771
std::vector<symbol_exprt> abstract_environmentt::modified_symbols (
772
772
const abstract_environmentt &first, const abstract_environmentt &second)
773
773
{
774
+ // Find all symbols who have different write locations in each map
774
775
std::vector<symbol_exprt> symbols_diff;
775
776
for (const auto &entry : first.map )
776
777
{
@@ -782,19 +783,10 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
782
783
// in the other
783
784
// Since a set can assume at most one match
784
785
785
- #if 0
786
- const auto location_matcher=
787
- [&](
788
- goto_programt::const_targett instruction,
789
- goto_programt::const_targett other_instruction)
790
- {
791
- return other_instruction->location_number<instruction->location_number;
792
- };
793
- #endif
794
-
795
-
796
- const abstract_objectt::locationst &a=entry.second ->get_last_written_locations ();
797
- const abstract_objectt::locationst &b=second_entry->second ->get_last_written_locations ();
786
+ const abstract_objectt::locationst &first_write_locations=
787
+ entry.second ->get_last_written_locations ();
788
+ const abstract_objectt::locationst &second_write_locations=
789
+ second_entry->second ->get_last_written_locations ();
798
790
799
791
class location_ordert
800
792
{
@@ -803,21 +795,23 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
803
795
goto_programt::const_targett instruction,
804
796
goto_programt::const_targett other_instruction)
805
797
{
806
- return instruction->location_number >other_instruction->location_number ;
798
+ return instruction->location_number >
799
+ other_instruction->location_number ;
807
800
}
808
801
};
809
802
810
- typedef std::set<goto_programt::const_targett, location_ordert> sorted_locationst;
803
+ typedef std::set<goto_programt::const_targett, location_ordert>
804
+ sorted_locationst;
811
805
812
806
sorted_locationst lhs_location;
813
- for (const auto &entry:a )
807
+ for (const auto &entry:first_write_locations )
814
808
{
815
809
lhs_location.insert (entry);
816
810
}
817
811
818
812
819
813
sorted_locationst rhs_location;
820
- for (const auto &entry:b )
814
+ for (const auto &entry:second_write_locations )
821
815
{
822
816
rhs_location.insert (entry);
823
817
}
@@ -830,23 +824,8 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
830
824
rhs_location.cend (),
831
825
std::inserter (intersection, intersection.end ()),
832
826
location_ordert ());
833
- bool all_matched=intersection.size ()==a.size () &&
834
- intersection.size ()==b.size ();
835
-
836
- #if 0
837
- std::cout << entry.first.get_identifier() << ": {";
838
- for(const auto &entry:lhs_location)
839
- {
840
- std::cout << entry->location_number << ", ";
841
- }
842
-
843
- std::cout << " } vs { ";
844
- for(const auto &entry:rhs_location)
845
- {
846
- std::cout << entry->location_number << ", ";
847
- }
848
- std::cout << " }" << std::endl;
849
- #endif
827
+ bool all_matched=intersection.size ()==first_write_locations.size () &&
828
+ intersection.size ()==second_write_locations.size ();
850
829
851
830
if (!all_matched)
852
831
{
@@ -855,6 +834,7 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
855
834
}
856
835
}
857
836
837
+ // Add any symbols that are only in the second map
858
838
for (const auto &entry : second.map )
859
839
{
860
840
const auto &second_entry = first.map .find (entry.first );
0 commit comments