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 
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");
22 }
23 
25 
27  return reinterpret_cast<uint8_t *>(Buffer->getBufferStart());
28 }
29 
30 const uint8_t *DataBufferLLVM::GetBytes() const {
31  return reinterpret_cast<const uint8_t *>(Buffer->getBufferStart());
32 }
33 
35  return Buffer->getBufferSize();
36 }
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::DataBufferLLVM::Buffer
std::unique_ptr< llvm::WritableMemoryBuffer > Buffer
Definition: DataBufferLLVM.h:42
lldb_private::DataBufferLLVM::~DataBufferLLVM
~DataBufferLLVM() override
lldb_private::DataBufferLLVM::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferLLVM.cpp:34
DataBufferLLVM.h
lldb_private::DataBufferLLVM::GetBytes
uint8_t * GetBytes() override
Definition: DataBufferLLVM.cpp:26
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::DataBufferLLVM::DataBufferLLVM
DataBufferLLVM(std::unique_ptr< llvm::WritableMemoryBuffer > Buffer)
Construct a DataBufferLLVM from Buffer.
Definition: DataBufferLLVM.cpp:17