[lld][WebAssembly] Perform data relocations during start function
[llvm-project.git] / lldb / source / Utility / DataBufferLLVM.cpp
blobc5aeddd683f4db3ee976495d03305503b140ab0a
1 //===-- DataBufferLLVM.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/Utility/DataBufferLLVM.h"
11 #include "llvm/Support/MemoryBuffer.h"
13 #include <cassert>
15 using namespace lldb_private;
17 DataBufferLLVM::DataBufferLLVM(
18 std::unique_ptr<llvm::WritableMemoryBuffer> MemBuffer)
19 : Buffer(std::move(MemBuffer)) {
20 assert(Buffer != nullptr &&
21 "Cannot construct a DataBufferLLVM with a null buffer");
24 DataBufferLLVM::~DataBufferLLVM() = default;
26 uint8_t *DataBufferLLVM::GetBytes() {
27 return reinterpret_cast<uint8_t *>(Buffer->getBufferStart());
30 const uint8_t *DataBufferLLVM::GetBytes() const {
31 return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
34 lldb::offset_t DataBufferLLVM::GetByteSize() const {
35 return Buffer->getBufferSize();