LLDB  mainline
DataBufferLLVM.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
10 
11 #include "llvm/Support/MemoryBuffer.h"
12 
13 #include <cassert>
14 
15 using namespace lldb_private;
16 
17 DataBufferLLVM::DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> MemBuffer)
18  : Buffer(std::move(MemBuffer)) {
19  assert(Buffer != nullptr &&
20  "Cannot construct a DataBufferLLVM with a null buffer");
21 }
22 
24 
25 const uint8_t *DataBufferLLVM::GetBytesImpl() const {
26  return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
27 }
28 
30  return Buffer->getBufferSize();
31 }
32 
34  std::unique_ptr<llvm::WritableMemoryBuffer> MemBuffer)
35  : Buffer(std::move(MemBuffer)) {
36  assert(Buffer != nullptr &&
37  "Cannot construct a WritableDataBufferLLVM with a null buffer");
38 }
39 
41 
42 const uint8_t *WritableDataBufferLLVM::GetBytesImpl() const {
43  return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
44 }
45 
47  return Buffer->getBufferSize();
48 }
49 
lldb_private::WritableDataBufferLLVM::WritableDataBufferLLVM
WritableDataBufferLLVM(std::unique_ptr< llvm::WritableMemoryBuffer > Buffer)
}
Definition: DataBufferLLVM.cpp:33
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::DataBufferLLVM::~DataBufferLLVM
~DataBufferLLVM() override
lldb_private::WritableDataBufferLLVM::~WritableDataBufferLLVM
~WritableDataBufferLLVM() override
lldb_private::DataBufferLLVM::Buffer
std::unique_ptr< llvm::MemoryBuffer > Buffer
Definition: DataBufferLLVM.h:50
lldb_private::DataBufferLLVM::ID
static char ID
LLVM RTTI support.
Definition: DataBufferLLVM.h:36
lldb_private::WritableDataBufferLLVM::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferLLVM.cpp:46
lldb_private::DataBufferLLVM::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferLLVM.cpp:29
lldb_private::WritableDataBufferLLVM::Buffer
std::unique_ptr< llvm::WritableMemoryBuffer > Buffer
Definition: DataBufferLLVM.h:77
lldb_private::WritableDataBufferLLVM::ID
static char ID
LLVM RTTI support.
Definition: DataBufferLLVM.h:62
DataBufferLLVM.h
lldb_private::WritableDataBufferLLVM::GetBytesImpl
const uint8_t * GetBytesImpl() const override
Definition: DataBufferLLVM.cpp:42
lldb_private::DataBufferLLVM::DataBufferLLVM
DataBufferLLVM(std::unique_ptr< llvm::MemoryBuffer > Buffer)
}
Definition: DataBufferLLVM.cpp:17
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::DataBufferLLVM::GetBytesImpl
const uint8_t * GetBytesImpl() const override
Definition: DataBufferLLVM.cpp:25