1 //===-- VMRange.cpp -------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/VMRange.h"
11 #include "lldb/Utility/Stream.h"
12 #include "lldb/lldb-types.h"
22 using namespace lldb_private
;
24 bool VMRange::ContainsValue(const VMRange::collection
&coll
,
26 return llvm::any_of(coll
,
27 [&](const VMRange
&r
) { return r
.Contains(value
); });
30 bool VMRange::ContainsRange(const VMRange::collection
&coll
,
31 const VMRange
&range
) {
32 return llvm::any_of(coll
,
33 [&](const VMRange
&r
) { return r
.Contains(range
); });
36 void VMRange::Dump(llvm::raw_ostream
&s
, lldb::addr_t offset
,
37 uint32_t addr_width
) const {
38 DumpAddressRange(s
, offset
+ GetBaseAddress(), offset
+ GetEndAddress(),
42 bool lldb_private::operator==(const VMRange
&lhs
, const VMRange
&rhs
) {
43 return lhs
.GetBaseAddress() == rhs
.GetBaseAddress() &&
44 lhs
.GetEndAddress() == rhs
.GetEndAddress();
47 bool lldb_private::operator!=(const VMRange
&lhs
, const VMRange
&rhs
) {
51 bool lldb_private::operator<(const VMRange
&lhs
, const VMRange
&rhs
) {
52 if (lhs
.GetBaseAddress() < rhs
.GetBaseAddress())
54 else if (lhs
.GetBaseAddress() > rhs
.GetBaseAddress())
56 return lhs
.GetEndAddress() < rhs
.GetEndAddress();
59 bool lldb_private::operator<=(const VMRange
&lhs
, const VMRange
&rhs
) {
63 bool lldb_private::operator>(const VMRange
&lhs
, const VMRange
&rhs
) {
67 bool lldb_private::operator>=(const VMRange
&lhs
, const VMRange
&rhs
) {