diff --git a/include/abg-ir.h b/include/abg-ir.h index 38341382..a2bb4b2d 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -458,6 +458,9 @@ public: bool operator==(const translation_unit&) const; + bool + operator!=(const translation_unit&) const; + void bind_function_type_life_time(function_type_sptr) const; @@ -490,7 +493,10 @@ bool is_cplus_plus_language(translation_unit::language l); bool -operator==(translation_unit_sptr, translation_unit_sptr); +operator==(const translation_unit_sptr&, const translation_unit_sptr&); + +bool +operator!=(const translation_unit_sptr&, const translation_unit_sptr&); /// Access specifier for class members. enum access_specifier @@ -727,6 +733,9 @@ string_to_elf_symbol_binding(const string&, elf_symbol::binding&); bool operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs); +bool +operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs); + bool elf_symbols_alias(const elf_symbol& s1, const elf_symbol& s2); @@ -769,6 +778,9 @@ public: bool operator==(const version& o) const; + bool + operator!=(const version& o) const; + version& operator=(const version& o); };// end class elf_symbol::version @@ -843,6 +855,17 @@ public: && is_static_ == o.is_static_); } + /// Inequality operator. + /// + /// @param o the other instance of @ref context_rel to compare the + /// current instance against. + /// + /// @return true iff the current instance of @ref context_rel is + /// different from @p o. + bool + operator!=(const context_rel& o) const + {return !operator==(o);} + virtual ~context_rel(); };// end class context_rel @@ -949,6 +972,9 @@ operator==(const type_or_decl_base&, const type_or_decl_base&); bool operator==(const type_or_decl_base_sptr&, const type_or_decl_base_sptr&); +bool +operator!=(const type_or_decl_base_sptr&, const type_or_decl_base_sptr&); + void set_environment_for_artifact(type_or_decl_base* artifact, environment* env); @@ -1039,6 +1065,9 @@ public: virtual bool operator==(const decl_base&) const; + virtual bool + operator!=(const decl_base&) const; + virtual bool traverse(ir_node_visitor& v); @@ -1154,6 +1183,9 @@ operator==(const decl_base_sptr&, const decl_base_sptr&); bool operator==(const type_base_sptr&, const type_base_sptr&); +bool +operator!=(const type_base_sptr&, const type_base_sptr&); + std::ostream& operator<<(std::ostream&, decl_base::visibility); @@ -1257,7 +1289,10 @@ public: };//end class scope_decl bool -operator==(scope_decl_sptr, scope_decl_sptr); +operator==(const scope_decl_sptr&, const scope_decl_sptr&); + +bool +operator!=(const scope_decl_sptr&, const scope_decl_sptr&); /// Hasher for the @ref scope_decl type. struct scope_decl::hash @@ -1352,6 +1387,9 @@ public: virtual bool operator==(const type_base&) const; + virtual bool + operator!=(const type_base&) const; + virtual bool traverse(ir_node_visitor&); @@ -1453,6 +1491,8 @@ public: virtual bool operator==(const type_decl&) const; + bool operator!=(const type_decl&)const; + virtual string get_pretty_representation(bool internal = false) const; @@ -1468,6 +1508,9 @@ equals(const scope_type_decl&, const scope_type_decl&, change_kind*); bool operator==(const type_decl_sptr&, const type_decl_sptr&); +bool +operator!=(const type_decl_sptr&, const type_decl_sptr&); + /// A type that introduces a scope. class scope_type_decl : public scope_decl, public virtual type_base { @@ -1591,6 +1634,9 @@ public: bool operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&); +bool +operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&); + qualified_type_def::CV operator|(qualified_type_def::CV, qualified_type_def::CV); @@ -1655,6 +1701,9 @@ public: bool operator==(const pointer_type_def_sptr&, const pointer_type_def_sptr&); +bool +operator!=(const pointer_type_def_sptr&, const pointer_type_def_sptr&); + bool equals(const reference_type_def&, const reference_type_def&, change_kind*); @@ -1709,6 +1758,9 @@ public: bool operator==(const reference_type_def_sptr&, const reference_type_def_sptr&); +bool +operator!=(const reference_type_def_sptr&, const reference_type_def_sptr&); + bool equals(const array_type_def&, const array_type_def&, change_kind*); @@ -1781,6 +1833,9 @@ public: bool operator==(const subrange_type& o) const; + bool + operator!=(const subrange_type& o) const; + const location& get_location() const; }; @@ -1912,6 +1967,10 @@ public: bool operator==(const enum_type_decl_sptr& l, const enum_type_decl_sptr& r); + +bool +operator!=(const enum_type_decl_sptr& l, const enum_type_decl_sptr& r); + /// The abstraction of an enumerator class enum_type_decl::enumerator { @@ -1931,6 +1990,9 @@ public: bool operator==(const enumerator& other) const; + bool + operator!=(const enumerator& other) const; + const string& get_name() const; @@ -2068,6 +2130,10 @@ public: && offset_in_bits_ == o.offset_in_bits_); } + bool + operator!=(const dm_context_rel& o) const + {return !operator==(o);} + virtual ~dm_context_rel(); };// end class class_decl::dm_context_rel @@ -2590,6 +2656,9 @@ class template_parameter virtual bool operator==(const template_parameter&) const; + bool + operator!=(const template_parameter&) const; + unsigned get_index() const; @@ -3157,6 +3226,9 @@ operator<<(std::ostream&, access_specifier); bool operator==(const class_decl_sptr& l, const class_decl_sptr& r); +bool +operator!=(const class_decl_sptr& l, const class_decl_sptr& r); + /// The base class for member types, data members and member /// functions. Its purpose is mainly to carry the access specifier /// (and possibly other properties that might be shared by all class @@ -3260,8 +3332,12 @@ public: };// end class class_decl::base_spec bool -operator==(const class_decl::base_spec_sptr l, - const class_decl::base_spec_sptr r); +operator==(const class_decl::base_spec_sptr& l, + const class_decl::base_spec_sptr& r); + +bool +operator!=(const class_decl::base_spec_sptr& l, + const class_decl::base_spec_sptr& r); class_decl::base_spec* is_class_base_spec(type_or_decl_base*); @@ -3545,8 +3621,12 @@ public: };// end class class_decl::member_function_template bool -operator==(class_decl::member_function_template_sptr l, - class_decl::member_function_template_sptr r); +operator==(const class_decl::member_function_template_sptr& l, + const class_decl::member_function_template_sptr& r); + +bool +operator!=(const class_decl::member_function_template_sptr& l, + const class_decl::member_function_template_sptr& r); /// Abstracts a member class template template class class_decl::member_class_template @@ -3588,8 +3668,12 @@ public: };// end class class_decl::member_class_template bool -operator==(class_decl::member_class_template_sptr l, - class_decl::member_class_template_sptr r); +operator==(const class_decl::member_class_template_sptr& l, + const class_decl::member_class_template_sptr& r); + +bool +operator!=(const class_decl::member_class_template_sptr& l, + const class_decl::member_class_template_sptr& r); // Forward declarations for select nested hashers. struct type_base::shared_ptr_hash diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 72fb88dc..93cf23d4 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -501,6 +501,16 @@ translation_unit::operator==(const translation_unit& other)const return *get_global_scope() == *other.get_global_scope(); } +/// Inequality operator. +/// +/// @param o the instance of @ref translation_unit to compare the +/// current instance against. +/// +/// @return true iff the current instance is different from @p o. +bool +translation_unit::operator!=(const translation_unit& o) const +{return ! operator==(o);} + /// Ensure that the life time of a function type is bound to the life /// time of the current translation unit. /// @@ -710,7 +720,7 @@ is_cplus_plus_language(translation_unit::language l) /// /// @return true if the two translation units are equal, false otherwise. bool -operator==(translation_unit_sptr l, translation_unit_sptr r) +operator==(const translation_unit_sptr& l, const translation_unit_sptr& r) { if (l.get() == r.get()) return true; @@ -721,6 +731,17 @@ operator==(translation_unit_sptr l, translation_unit_sptr r) return *l == *r; } +/// A deep inequality operator for pointers to translation units. +/// +/// @param l the first translation unit to consider for the comparison. +/// +/// @param r the second translation unit to consider for the comparison. +/// +/// @return true iff the two translation units are different. +bool +operator!=(const translation_unit_sptr& l, const translation_unit_sptr& r) +{return !operator==(l, r);} + // // @@ -1499,6 +1520,17 @@ operator==(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs) return *lhs == *rhs; } +/// Inequality operator for smart pointers to elf_symbol. +/// +/// @param lhs the first elf symbol to consider. +/// +/// @param rhs the second elf symbol to consider. +/// +/// @return true iff @p lhs is different from @p rhs. +bool +operator!=(const elf_symbol_sptr& lhs, const elf_symbol_sptr& rhs) +{return !operator==(lhs, rhs);} + /// Test if two symbols alias. /// /// @param s1 the first symbol to consider. @@ -1797,6 +1829,15 @@ bool elf_symbol::version::operator==(const elf_symbol::version& o) const {return str() == o.str();} +/// Inequality operator. +/// +/// @param o the version to compare against the current one. +/// +/// @return true iff both versions are different. +bool +elf_symbol::version::operator!=(const version& o) const +{return !operator==(o);} + /// Assign a version to the current one. /// /// @param o the other version to assign to this one. @@ -2095,6 +2136,17 @@ operator==(const type_or_decl_base_sptr& l, const type_or_decl_base_sptr& r) return *r == *l; } +/// Non-member inequality operator for the @type_or_decl_base type. +/// +/// @param l the left-hand operand of the equality. +/// +/// @param r the right-hand operatnr of the equality. +/// +/// @return true iff @p l is different from @p r. +bool +operator!=(const type_or_decl_base_sptr& l, const type_or_decl_base_sptr& r) +{return !operator==(l, r);} + // // @@ -2584,6 +2636,17 @@ bool decl_base::operator==(const decl_base& other) const {return equals(*this, other, 0);} +/// Inequality operator. +/// +/// @param other to other instance of @ref decl_base to compare the +/// current instance to. +/// +/// @return true iff the current instance of @ref decl_base is +/// different from @p other. +bool +decl_base::operator!=(const decl_base& other) const +{return !operator==(other);} + /// Destructor of the @ref decl_base type. decl_base::~decl_base() {delete priv_;} @@ -2724,6 +2787,21 @@ operator==(const type_base_sptr& l, const type_base_sptr& r) return *l == *r; } +/// Turn inequality of shared_ptr of type_base into a deep equality; +/// that is, make it compare the pointed to objects.. +/// +/// @param l the shared_ptr of type_base on left-hand-side of the +/// equality. +/// +/// @param r the shared_ptr of type_base on right-hand-side of the +/// equality. +/// +/// @return true iff the type_base pointed to by the shared_ptrs are +/// different. +bool +operator!=(const type_base_sptr& l, const type_base_sptr& r) +{return !operator==(l, r);} + /// Tests if a declaration has got a scope. /// /// @param d the decalaration to consider. @@ -4090,7 +4168,7 @@ scope_decl::operator==(const decl_base& o) const /// /// @return true iff @p l equals @p r. bool -operator==(scope_decl_sptr l, scope_decl_sptr r) +operator==(const scope_decl_sptr& l, const scope_decl_sptr& r) { if (!!l != !!r) return false; @@ -4099,6 +4177,17 @@ operator==(scope_decl_sptr l, scope_decl_sptr r) return *l == *r; } +/// Inequality operator for @ref scope_decl_sptr. +/// +/// @param l the left hand side operand of the equality operator. +/// +/// @pram r the right hand side operand of the equalify operator. +/// +/// @return true iff @p l equals @p r. +bool +operator!=(const scope_decl_sptr& l, const scope_decl_sptr& r) +{return !operator==(l, r);} + /// Find a member of the current scope and return an iterator on it. /// /// @param decl the scope member to find. @@ -6778,6 +6867,16 @@ bool type_base::operator==(const type_base& other) const {return equals(*this, other, 0);} +/// Inequality operator. +/// +///@param other the instance of @ref type_base to compare the current +/// instance against. +/// +/// @return true iff the current instance is different from @p other. +bool +type_base::operator!=(const type_base& other) const +{return !operator==(other);} + /// Setter for the size of the type. /// /// @param s the new size -- in bits. @@ -6920,6 +7019,15 @@ type_decl::operator==(const type_decl& o) const return *this == other; } +/// Inequality operator. +/// +/// @param o the other type to compare against. +/// +/// @return true iff the current instance is different from @p o. +bool +type_decl::operator!=(const type_decl& o) const +{return !operator==(o);} + /// Equality operator for @ref type_decl_sptr. /// /// @param l the first operand to compare. @@ -6937,6 +7045,17 @@ operator==(const type_decl_sptr& l, const type_decl_sptr& r) return *l == *r; } +/// Inequality operator for @ref type_decl_sptr. +/// +/// @param l the first operand to compare. +/// +/// @param r the second operand to compare. +/// +/// @return true iff @p l is different from @p r. +bool +operator!=(const type_decl_sptr& l, const type_decl_sptr& r) +{return !operator==(l, r);} + /// Get the pretty representation of the current instance of @ref /// type_decl. /// @@ -7545,6 +7664,17 @@ operator==(const qualified_type_def_sptr& l, const qualified_type_def_sptr& r) return *l == *r; } +/// Non-member inequality operator for @ref qualified_type_def +/// +/// @param l the left-hand side of the equality operator +/// +/// @param r the right-hand side of the equality operator +/// +/// @return true iff @p l and @p r equals. +bool +operator!=(const qualified_type_def_sptr& l, const qualified_type_def_sptr& r) +{return ! operator==(l, r);} + /// Overloaded bitwise OR operator for cv qualifiers. qualified_type_def::CV operator| (qualified_type_def::CV lhs, @@ -7844,6 +7974,21 @@ operator==(const pointer_type_def_sptr& l, const pointer_type_def_sptr& r) return *l == *r; } +/// Turn inequality of shared_ptr of @ref pointer_type_def into a deep +/// equality; that is, make it compare the pointed to objects too. +/// +/// @param l the shared_ptr of @ref pointer_type_def on left-hand-side +/// of the equality. +/// +/// @param r the shared_ptr of @ref pointer_type_def on +/// right-hand-side of the equality. +/// +/// @return true iff the @ref pointer_type_def pointed to by the +/// shared_ptrs are different. +bool +operator!=(const pointer_type_def_sptr& l, const pointer_type_def_sptr& r) +{return !operator==(l, r);} + // // @@ -8071,6 +8216,21 @@ operator==(const reference_type_def_sptr& l, const reference_type_def_sptr& r) return *l == *r; } +/// Turn inequality of shared_ptr of @ref reference_type_def into a deep +/// equality; that is, make it compare the pointed to objects too. +/// +/// @param l the shared_ptr of @ref reference_type_def on left-hand-side +/// of the equality. +/// +/// @param r the shared_ptr of @ref reference_type_def on +/// right-hand-side of the equality. +/// +/// @return true iff the @ref reference_type_def pointed to by the +/// shared_ptrs are different. +bool +operator!=(const reference_type_def_sptr& l, const reference_type_def_sptr& r) +{return !operator==(l, r);} + // // @@ -8130,6 +8290,16 @@ array_type_def::subrange_type::operator==(const subrange_type& o) const && get_upper_bound() == o.get_upper_bound()); } +/// Inequality operator. +/// +/// @param o the other @ref subrange_type to compare against. +/// +/// @return true iff @p o is different from the current instance of +/// @ref subrange_type. +bool +array_type_def::subrange_type::operator!=(const subrange_type& o) const +{return !operator==(o);} + const location& array_type_def::subrange_type::get_location() const {return priv_->location_;} @@ -8673,6 +8843,17 @@ operator==(const enum_type_decl_sptr& l, const enum_type_decl_sptr& r) return *l == *o; } +/// Inequality operator for @ref enum_type_decl_sptr. +/// +/// @param l the first operand to compare. +/// +/// @param r the second operand to compare. +/// +/// @return true iff @p l equals @p r. +bool +operator!=(const enum_type_decl_sptr& l, const enum_type_decl_sptr& r) +{return !operator==(l, r);} + /// The type of the private data of an @ref /// enum_type_decl::enumerator. class enum_type_decl::enumerator::priv @@ -8732,6 +8913,15 @@ enum_type_decl::enumerator::operator==(const enumerator& other) const {return (get_name() == other.get_name() && get_value() == other.get_value());} +/// Inequality operator. +/// +/// @param other the other instance to compare against. +/// +/// @return true iff @p other is different from the current instance. +bool +enum_type_decl::enumerator::operator!=(const enumerator& other) const +{return !operator==(other);} + /// Getter for the name of the current instance of /// enum_type_decl::enumerator. /// @@ -10727,6 +10917,18 @@ operator==(const function_decl::parameter_sptr& l, return *l == *r; } +/// Non-member inequality operator for @ref function_decl::parameter. +/// +/// @param l the left-hand side of the equality operator +/// +/// @param r the right-hand side of the equality operator +/// +/// @return true iff @p l and @p r different. +bool +operator!=(const function_decl::parameter_sptr& l, + const function_decl::parameter_sptr& r) +{return !operator==(l, r);} + /// Traverse the diff sub-tree under the current instance /// function_decl. /// @@ -12505,6 +12707,18 @@ operator==(const class_decl_sptr& l, const class_decl_sptr& r) return *l == *r; } +/// Inequality operator for the @ref class_decl::member_class_template +/// type. +/// +/// @param l the first argument of the operator. +/// +/// @param r the second argument of the operator. +/// +/// @return true iff the two instances are equal. +bool +operator!=(const class_decl_sptr& l, const class_decl_sptr& r) +{return !operator==(l, r);} + /// This implements the ir_traversable_base::traverse pure virtual /// function. /// @@ -12607,8 +12821,8 @@ class_decl::member_base::operator==(const member_base& o) const } bool -operator==(const class_decl::base_spec_sptr l, - const class_decl::base_spec_sptr r) +operator==(const class_decl::base_spec_sptr& l, + const class_decl::base_spec_sptr& r) { if (l.get() == r.get()) return true; @@ -12618,6 +12832,21 @@ operator==(const class_decl::base_spec_sptr l, return *l == static_cast(*r); } +/// Inequality operator for smart pointers to @ref +/// class_decl::base_specs. +/// +/// This compares the pointed-to objects. +/// +/// @param l the first instance to consider. +/// +/// @param r the second instance to consider. +/// +/// @return true iff @p l is different from @p r. +bool +operator!=(const class_decl::base_spec_sptr& l, + const class_decl::base_spec_sptr& r) +{return !operator==(l, r);} + /// Test if an ABI artifact is a class base specifier. /// /// @param tod the ABI artifact to consider. @@ -12666,9 +12895,18 @@ class_decl::member_function_template::operator==(const member_base& other) const return false; } +/// Equality operator for smart pointers to @ref +/// class_decl::member_function_template. This is compares the +/// pointed-to instances. +/// +/// @param l the first instance to consider. +/// +/// @param r the second instance to consider. +/// +/// @return true iff @p l equals @p r. bool -operator==(class_decl::member_function_template_sptr l, - class_decl::member_function_template_sptr r) +operator==(const class_decl::member_function_template_sptr& l, + const class_decl::member_function_template_sptr& r) { if (l.get() == r.get()) return true; @@ -12678,6 +12916,20 @@ operator==(class_decl::member_function_template_sptr l, return *l == *r; } +/// Inequality operator for smart pointers to @ref +/// class_decl::member_function_template. This is compares the +/// pointed-to instances. +/// +/// @param l the first instance to consider. +/// +/// @param r the second instance to consider. +/// +/// @return true iff @p l equals @p r. +bool +operator!=(const class_decl::member_function_template_sptr& l, + const class_decl::member_function_template_sptr& r) +{return !operator==(l, r);} + /// This implements the ir_traversable_base::traverse pure virtual /// function. /// @@ -12743,8 +12995,8 @@ class_decl::member_class_template::operator== /// /// @return true iff the two instances are equal. bool -operator==(class_decl::member_class_template_sptr l, - class_decl::member_class_template_sptr r) +operator==(const class_decl::member_class_template_sptr& l, + const class_decl::member_class_template_sptr& r) { if (l.get() == r.get()) return true; @@ -12754,6 +13006,22 @@ operator==(class_decl::member_class_template_sptr l, return *l == *r; } +/// Turn inequality of shared_ptr of class_decl into a deep equality; +/// that is, make it compare the pointed to objects too. +/// +/// @param l the shared_ptr of class_decl on left-hand-side of the +/// equality. +/// +/// @param r the shared_ptr of class_decl on right-hand-side of the +/// equality. +/// +/// @return true if the class_decl pointed to by the shared_ptrs are +/// different, false otherwise. +bool +operator!=(const class_decl::member_class_template_sptr& l, + const class_decl::member_class_template_sptr& r) +{return !operator==(l, r);} + /// This implements the ir_traversable_base::traverse pure virtual /// function. /// @@ -13046,6 +13314,17 @@ template_parameter::operator==(const template_parameter& o) const return result; } +/// Inequality operator. +/// +/// @param other the other instance to compare against. +/// +/// @return true iff the other instance is different from the current +/// one. +bool +template_parameter::operator!=(const template_parameter& other) const +{return !operator==(other);} + +/// Destructor. template_parameter::~template_parameter() {}