operator!= fixes for C++-20

Without these changes, more recent versions of Clang will start to
emit diagnostics:

src/abg-ir.cc:15407:13: error: member 'operator!=' found in multiple base classes of different types
 15407 |   return *l == *r;
       |             ^
src/abg-ir.cc:14123:12: note: member found by ambiguous name lookup
 14123 | type_base::operator!=(const type_base& other) const
       |            ^
src/abg-ir.cc:5162:12: note: member found by ambiguous name lookup
 5162 | decl_base::operator!=(const decl_base& other) const
      |            ^

This fix was contributed by Ilya Biryukov.

	* include/abg-ir.h
	(qualified_typedef): Add definition of operator!=.
	(pointer_type_def): Likewise.
	(reference_type_def): Likewise.
	(class_or_union): Likewise.

Reported-by: Ilya Biryukov <ibiryukov@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Giuliano Procida 2023-08-31 16:59:15 +01:00 committed by Dodji Seketeli
parent 320ab7fdab
commit 9ac01c4141
1 changed files with 20 additions and 0 deletions

View File

@ -2252,6 +2252,11 @@ public:
virtual bool virtual bool
operator==(const qualified_type_def&) const; operator==(const qualified_type_def&) const;
virtual bool
operator!=(const qualified_type_def& other) const {
return !(*this == other);
}
CV CV
get_cv_quals() const; get_cv_quals() const;
@ -2354,6 +2359,11 @@ public:
bool bool
operator==(const pointer_type_def&) const; operator==(const pointer_type_def&) const;
bool
operator!=(const pointer_type_def& other) const {
return !(*this == other);
}
const type_base_sptr const type_base_sptr
get_pointed_to_type() const; get_pointed_to_type() const;
@ -2418,6 +2428,11 @@ public:
bool bool
operator==(const reference_type_def&) const; operator==(const reference_type_def&) const;
bool
operator!=(const reference_type_def& other) const {
return !(*this == other);
}
type_base_sptr type_base_sptr
get_pointed_to_type() const; get_pointed_to_type() const;
@ -4092,6 +4107,11 @@ public:
virtual bool virtual bool
operator==(const class_or_union&) const; operator==(const class_or_union&) const;
virtual bool
operator !=(const class_or_union& other) const {
return !(*this == other);
}
virtual bool virtual bool
traverse(ir_node_visitor& v); traverse(ir_node_visitor& v);