[VMRange] Implement comparison operators using `==` and `<`.

llvm-svn: 305109
This commit is contained in:
Davide Italiano 2017-06-09 20:49:11 +00:00
parent 3226fe95bb
commit e8111778c1
1 changed files with 4 additions and 17 deletions

View File

@ -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);
}