From d4f1b294102808dc67d7a008d89dae28a4a9ff9e Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 11 Oct 2017 11:35:04 +0100 Subject: [PATCH] Add eq and neq operators to value_sett and related types --- src/pointer-analysis/value_set.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/pointer-analysis/value_set.h b/src/pointer-analysis/value_set.h index 2493b211101..aed52e05f2e 100644 --- a/src/pointer-analysis/value_set.h +++ b/src/pointer-analysis/value_set.h @@ -56,6 +56,17 @@ class value_sett bool offset_is_set; bool offset_is_zero() const { return offset_is_set && offset.is_zero(); } + + bool operator==(const objectt &other) const + { + return + offset_is_set==other.offset_is_set && + (!offset_is_set || offset==other.offset); + } + bool operator!=(const objectt &other) const + { + return !(*this==other); + } }; class object_map_dt @@ -101,6 +112,15 @@ class value_sett object_map_dt()=default; + bool operator==(const object_map_dt &other) const + { + return data==other.data; + } + bool operator!=(const object_map_dt &other) const + { + return !(*this==other); + } + protected: ~object_map_dt()=default; }; @@ -157,6 +177,18 @@ class value_sett suffix(_suffix) { } + + bool operator==(const entryt &other) const + { + return + identifier==other.identifier && + suffix==other.suffix && + object_map==other.object_map; + } + bool operator!=(const entryt &other) const + { + return !(*this==other); + } }; typedef std::set expr_sett;