diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-07 18:24:14 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-03-11 08:39:51 -0700 |
commit | 6e6ac32dde61fd3019b05adaeec372eb16c12bff (patch) | |
tree | e2d571fa24a342eeaac29d8eec2600535d7b2248 /gdb/symtab.h | |
parent | 1afdbb1e986157a73a7bf1cf4fa03b9426e824e8 (diff) | |
download | gdb-6e6ac32dde61fd3019b05adaeec372eb16c12bff.zip gdb-6e6ac32dde61fd3019b05adaeec372eb16c12bff.tar.gz gdb-6e6ac32dde61fd3019b05adaeec372eb16c12bff.tar.bz2 |
Add operator< and operator== to linetable_entry
This adds a couple of comparison operators to linetable_entry, and
simplifies both the calls to sort and one other spot that checks for
equality.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r-- | gdb/symtab.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h index c565bc8..69f0eaa 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1547,6 +1547,19 @@ struct rust_vtable_symbol : public symbol struct linetable_entry { + bool operator< (const linetable_entry &other) const + { + if (pc == other.pc + && (line != 0) != (other.line != 0)) + return line == 0; + return pc < other.pc; + } + + /* Two entries are equal if they have the same line and PC. The + other members are ignored. */ + bool operator== (const linetable_entry &other) const + { return line == other.line && pc == other.pc; } + /* The line number for this entry. */ int line; |