1 //===-- VMRange.cpp ---------------------------------------------*- C++ -*-===//
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::find_if(coll, [&](const VMRange &r) {
27 return r.Contains(value);
31 bool VMRange::ContainsRange(const VMRange::collection &coll,
32 const VMRange &range) {
33 return llvm::find_if(coll, [&](const VMRange &r) {
34 return r.Contains(range);
38 void VMRange::Dump(llvm::raw_ostream &s, lldb::addr_t offset,
39 uint32_t addr_width) const {
40 DumpAddressRange(s, offset + GetBaseAddress(), offset + GetEndAddress(),
44 bool lldb_private::operator==(const VMRange &lhs, const VMRange &rhs) {
45 return lhs.GetBaseAddress() == rhs.GetBaseAddress() &&
46 lhs.GetEndAddress() == rhs.GetEndAddress();
49 bool lldb_private::operator!=(const VMRange &lhs, const VMRange &rhs) {
53 bool lldb_private::operator<(const VMRange &lhs, const VMRange &rhs) {
54 if (lhs.GetBaseAddress() < rhs.GetBaseAddress())
56 else if (lhs.GetBaseAddress() > rhs.GetBaseAddress())
58 return lhs.GetEndAddress() < rhs.GetEndAddress();
61 bool lldb_private::operator<=(const VMRange &lhs, const VMRange &rhs) {
65 bool lldb_private::operator>(const VMRange &lhs, const VMRange &rhs) {
69 bool lldb_private::operator>=(const VMRange &lhs, const VMRange &rhs) {