[binutils-gdb] gdb/dwarf: implement section_and_offset comparison using operator==
Simon Marchi via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=06a03c076ce0d85ae039727a4004330054d585cb commit 06a03c076ce0d85ae039727a4004330054d585cb Author: Simon Marchi <[email protected]> Date: Tue Mar 10 13:44:57 2026 -0400 gdb/dwarf: implement section_and_offset comparison using operator== This was suggested during review. Change-Id: Iabe893f5b7ee1c4dce9655cbc323e3640e061aa3 Approved-By: Tom Tromey <[email protected]> Diff: --- gdb/dwarf2/section.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/section.h b/gdb/dwarf2/section.h index 34a1810a387..588d7b9226f 100644 --- a/gdb/dwarf2/section.h +++ b/gdb/dwarf2/section.h @@ -122,6 +122,10 @@ using dwarf2_section_info_up = std::unique_ptr<dwarf2_section_info>; struct section_and_offset { + friend bool operator== (const section_and_offset &lhs, + const section_and_offset &rhs) noexcept + { return lhs.section == rhs.section && lhs.offset == rhs.offset; } + const dwarf2_section_info *section; sect_offset offset; }; @@ -141,18 +145,9 @@ struct section_and_offset_hash } }; -/* Equality function for section_and_offset. */ - -struct section_and_offset_eq -{ - bool operator() (const section_and_offset &a, - const section_and_offset &b) const noexcept - { return a.section == b.section && a.offset == b.offset; } -}; - template<typename Value> using unordered_section_and_offset_map = gdb::unordered_map<section_and_offset, Value, - section_and_offset_hash, section_and_offset_eq>; + section_and_offset_hash>; #endif /* GDB_DWARF2_SECTION_H */