[MLIR][NVVM] Add Op for TMA Store with reduction (#118853)
[llvm-project.git] / lldb / source / API / SBAddressRange.cpp
blob5834ebe5e63c00fed0bdb8717690b7b2aa4fcdb7
1 //===-- SBAddressRange.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 //===----------------------------------------------------------------------===//
9 #include "lldb/API/SBAddressRange.h"
10 #include "Utils.h"
11 #include "lldb/API/SBAddress.h"
12 #include "lldb/API/SBStream.h"
13 #include "lldb/API/SBTarget.h"
14 #include "lldb/Core/AddressRange.h"
15 #include "lldb/Core/Section.h"
16 #include "lldb/Utility/Instrumentation.h"
17 #include "lldb/Utility/Stream.h"
18 #include <cstddef>
19 #include <memory>
21 using namespace lldb;
22 using namespace lldb_private;
24 SBAddressRange::SBAddressRange()
25 : m_opaque_up(std::make_unique<AddressRange>()) {
26 LLDB_INSTRUMENT_VA(this);
29 SBAddressRange::SBAddressRange(const SBAddressRange &rhs) {
30 LLDB_INSTRUMENT_VA(this, rhs);
32 m_opaque_up = clone(rhs.m_opaque_up);
35 SBAddressRange::SBAddressRange(lldb::SBAddress addr, lldb::addr_t byte_size)
36 : m_opaque_up(std::make_unique<AddressRange>(addr.ref(), byte_size)) {
37 LLDB_INSTRUMENT_VA(this, addr, byte_size);
40 SBAddressRange::~SBAddressRange() = default;
42 const SBAddressRange &SBAddressRange::operator=(const SBAddressRange &rhs) {
43 LLDB_INSTRUMENT_VA(this, rhs);
45 if (this != &rhs)
46 m_opaque_up = clone(rhs.m_opaque_up);
47 return *this;
50 bool SBAddressRange::operator==(const SBAddressRange &rhs) {
51 LLDB_INSTRUMENT_VA(this, rhs);
53 return ref().operator==(rhs.ref());
56 bool SBAddressRange::operator!=(const SBAddressRange &rhs) {
57 LLDB_INSTRUMENT_VA(this, rhs);
59 return !(*this == rhs);
62 void SBAddressRange::Clear() {
63 LLDB_INSTRUMENT_VA(this);
65 ref().Clear();
68 bool SBAddressRange::IsValid() const {
69 LLDB_INSTRUMENT_VA(this);
71 return ref().IsValid();
74 lldb::SBAddress SBAddressRange::GetBaseAddress() const {
75 LLDB_INSTRUMENT_VA(this);
77 return lldb::SBAddress(ref().GetBaseAddress());
80 lldb::addr_t SBAddressRange::GetByteSize() const {
81 LLDB_INSTRUMENT_VA(this);
83 return ref().GetByteSize();
86 bool SBAddressRange::GetDescription(SBStream &description,
87 const SBTarget target) {
88 LLDB_INSTRUMENT_VA(this, description, target);
90 return ref().GetDescription(&description.ref(), target.GetSP().get());
93 lldb_private::AddressRange &SBAddressRange::ref() const {
94 assert(m_opaque_up && "opaque pointer must always be valid");
95 return *m_opaque_up;