diff options
| author | Davide Italiano <davide@freebsd.org> | 2017-06-09 20:49:11 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2017-06-09 20:49:11 +0000 |
| commit | e8111778c12ba39492bd87be07c23b6d715f5692 (patch) | |
| tree | f5f64134c72e93a6a3b97c59ef9b30afa13aa8e9 | |
| parent | 3226fe95bbb8b6bcc477ce7ec4f158a20669694d (diff) | |
| download | bcm5719-llvm-e8111778c12ba39492bd87be07c23b6d715f5692.tar.gz bcm5719-llvm-e8111778c12ba39492bd87be07c23b6d715f5692.zip | |
[VMRange] Implement comparison operators using `==` and `<`.
llvm-svn: 305109
| -rw-r--r-- | lldb/source/Utility/VMRange.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/lldb/source/Utility/VMRange.cpp b/lldb/source/Utility/VMRange.cpp index 3f053129768..112106b6e5c 100644 --- a/lldb/source/Utility/VMRange.cpp +++ b/lldb/source/Utility/VMRange.cpp @@ -56,8 +56,7 @@ bool lldb_private::operator==(const VMRange &lhs, const VMRange &rhs) { } bool lldb_private::operator!=(const VMRange &lhs, const VMRange &rhs) { - return lhs.GetBaseAddress() != rhs.GetBaseAddress() || - lhs.GetEndAddress() != rhs.GetEndAddress(); + return !(lhs == rhs); } bool lldb_private::operator<(const VMRange &lhs, const VMRange &rhs) { @@ -69,25 +68,13 @@ bool lldb_private::operator<(const VMRange &lhs, const VMRange &rhs) { } bool lldb_private::operator<=(const VMRange &lhs, const VMRange &rhs) { - if (lhs.GetBaseAddress() < rhs.GetBaseAddress()) - return true; - else if (lhs.GetBaseAddress() > rhs.GetBaseAddress()) - return false; - return lhs.GetEndAddress() <= rhs.GetEndAddress(); + return !(lhs > rhs); } bool lldb_private::operator>(const VMRange &lhs, const VMRange &rhs) { - if (lhs.GetBaseAddress() > rhs.GetBaseAddress()) - return true; - else if (lhs.GetBaseAddress() < rhs.GetBaseAddress()) - return false; - return lhs.GetEndAddress() > rhs.GetEndAddress(); + return rhs < lhs; } bool lldb_private::operator>=(const VMRange &lhs, const VMRange &rhs) { - if (lhs.GetBaseAddress() > rhs.GetBaseAddress()) - return true; - else if (lhs.GetBaseAddress() < rhs.GetBaseAddress()) - return false; - return lhs.GetEndAddress() >= rhs.GetEndAddress(); + return !(lhs < rhs); } |

