1 //===--- DataBufferLLVM.cpp -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Utility/DataBufferLLVM.h"
12 #include "llvm/ADT/Twine.h"
13 #include "llvm/Support/FileSystem.h"
14 #include "llvm/Support/MemoryBuffer.h"
17 #include <type_traits>
19 using namespace lldb_private;
21 DataBufferLLVM::DataBufferLLVM(
22 std::unique_ptr<llvm::WritableMemoryBuffer> MemBuffer)
23 : Buffer(std::move(MemBuffer)) {
24 assert(Buffer != nullptr &&
25 "Cannot construct a DataBufferLLVM with a null buffer");
28 DataBufferLLVM::~DataBufferLLVM() {}
30 uint8_t *DataBufferLLVM::GetBytes() {
31 return reinterpret_cast<uint8_t *>(Buffer->getBufferStart());
34 const uint8_t *DataBufferLLVM::GetBytes() const {
35 return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
38 lldb::offset_t DataBufferLLVM::GetByteSize() const {
39 return Buffer->getBufferSize();