Path: blob/main/contrib/llvm-project/lldb/source/Utility/DataBufferLLVM.cpp
39587 views
//===-- DataBufferLLVM.cpp ------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Utility/DataBufferLLVM.h"910#include "llvm/Support/MemoryBuffer.h"1112#include <cassert>1314using namespace lldb_private;1516DataBufferLLVM::DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> MemBuffer)17: Buffer(std::move(MemBuffer)) {18assert(Buffer != nullptr &&19"Cannot construct a DataBufferLLVM with a null buffer");20}2122DataBufferLLVM::~DataBufferLLVM() = default;2324const uint8_t *DataBufferLLVM::GetBytesImpl() const {25return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());26}2728lldb::offset_t DataBufferLLVM::GetByteSize() const {29return Buffer->getBufferSize();30}3132WritableDataBufferLLVM::WritableDataBufferLLVM(33std::unique_ptr<llvm::WritableMemoryBuffer> MemBuffer)34: Buffer(std::move(MemBuffer)) {35assert(Buffer != nullptr &&36"Cannot construct a WritableDataBufferLLVM with a null buffer");37}3839WritableDataBufferLLVM::~WritableDataBufferLLVM() = default;4041const uint8_t *WritableDataBufferLLVM::GetBytesImpl() const {42return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());43}4445lldb::offset_t WritableDataBufferLLVM::GetByteSize() const {46return Buffer->getBufferSize();47}4849char DataBufferLLVM::ID;50char WritableDataBufferLLVM::ID;515253