[Lldb-commits] [lldb] r305109 - [VMRange] Implement comparison operators using `==` and `<`.
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 9 13:49:11 PDT 2017
Author: davide
Date: Fri Jun 9 15:49:11 2017
New Revision: 305109
URL: http://llvm.org/viewvc/llvm-project?rev=305109&view=rev
Log:
[VMRange] Implement comparison operators using `==` and `<`.
Modified:
lldb/trunk/source/Utility/VMRange.cpp
Modified: lldb/trunk/source/Utility/VMRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/VMRange.cpp?rev=305109&r1=305108&r2=305109&view=diff
==============================================================================
--- lldb/trunk/source/Utility/VMRange.cpp (original)
+++ lldb/trunk/source/Utility/VMRange.cpp Fri Jun 9 15:49:11 2017
@@ -56,8 +56,7 @@ bool lldb_private::operator==(const VMRa
}
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 VMRan
}
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);
}
More information about the lldb-commits
mailing list