Skip to content

Commit d4f1b29

Browse files
committed
Add eq and neq operators to value_sett and related types
1 parent 64d5dd2 commit d4f1b29

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/pointer-analysis/value_set.h

+32
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ class value_sett
5656
bool offset_is_set;
5757
bool offset_is_zero() const
5858
{ return offset_is_set && offset.is_zero(); }
59+
60+
bool operator==(const objectt &other) const
61+
{
62+
return
63+
offset_is_set==other.offset_is_set &&
64+
(!offset_is_set || offset==other.offset);
65+
}
66+
bool operator!=(const objectt &other) const
67+
{
68+
return !(*this==other);
69+
}
5970
};
6071

6172
class object_map_dt
@@ -101,6 +112,15 @@ class value_sett
101112

102113
object_map_dt()=default;
103114

115+
bool operator==(const object_map_dt &other) const
116+
{
117+
return data==other.data;
118+
}
119+
bool operator!=(const object_map_dt &other) const
120+
{
121+
return !(*this==other);
122+
}
123+
104124
protected:
105125
~object_map_dt()=default;
106126
};
@@ -157,6 +177,18 @@ class value_sett
157177
suffix(_suffix)
158178
{
159179
}
180+
181+
bool operator==(const entryt &other) const
182+
{
183+
return
184+
identifier==other.identifier &&
185+
suffix==other.suffix &&
186+
object_map==other.object_map;
187+
}
188+
bool operator!=(const entryt &other) const
189+
{
190+
return !(*this==other);
191+
}
160192
};
161193

162194
typedef std::set<exprt> expr_sett;

0 commit comments

Comments
 (0)