1//===-- AddressRangeListImpl.cpp ------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Core/AddressRangeListImpl.h"
10
11using namespace lldb;
12using namespace lldb_private;
13
14AddressRangeListImpl::AddressRangeListImpl() : m_ranges() {}
15
16size_t AddressRangeListImpl::GetSize() const { return m_ranges.size(); }
17
18void AddressRangeListImpl::Reserve(size_t capacity) {
19 m_ranges.reserve(n: capacity);
20}
21
22void AddressRangeListImpl::Append(const AddressRange &sb_region) {
23 m_ranges.emplace_back(args: sb_region);
24}
25
26void AddressRangeListImpl::Append(const AddressRangeListImpl &list) {
27 Reserve(capacity: GetSize() + list.GetSize());
28
29 for (const auto &range : list.m_ranges)
30 Append(sb_region: range);
31}
32
33void AddressRangeListImpl::Clear() { m_ranges.clear(); }
34
35lldb_private::AddressRange
36AddressRangeListImpl::GetAddressRangeAtIndex(size_t index) {
37 if (index >= GetSize())
38 return AddressRange();
39 return m_ranges[index];
40}
41
42AddressRanges &AddressRangeListImpl::ref() { return m_ranges; }
43

source code of lldb/source/Core/AddressRangeListImpl.cpp