LLDB  mainline
DataBufferLLVM.h
Go to the documentation of this file.
1 //===--- DataBufferLLVM.h ---------------------------------------*- C++ -*-===//
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 
9 #ifndef LLDB_UTILITY_DATABUFFERLLVM_H
10 #define LLDB_UTILITY_DATABUFFERLLVM_H
11 
13 #include "lldb/lldb-types.h"
14 
15 #include <cstdint>
16 #include <memory>
17 
18 namespace llvm {
19 class WritableMemoryBuffer;
20 class Twine;
21 }
22 
23 namespace lldb_private {
24 
25 class FileSystem;
26 class DataBufferLLVM : public DataBuffer {
27 public:
28  ~DataBufferLLVM() override;
29 
30  uint8_t *GetBytes() override;
31  const uint8_t *GetBytes() const override;
32  lldb::offset_t GetByteSize() const override;
33 
34  char *GetChars() { return reinterpret_cast<char *>(GetBytes()); }
35 
36 private:
37  friend FileSystem;
38  /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid
39  /// pointer.
40  explicit DataBufferLLVM(std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
41 
42  std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
43 };
44 }
45 
46 #endif
llvm
Definition: Debugger.h:49
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::FileSystem
friend FileSystem
Definition: DataBufferLLVM.h:37
DataBuffer
lldb_private::DataBufferLLVM::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferLLVM.cpp:34
lldb_private::DataBufferLLVM::GetChars
char * GetChars()
Definition: DataBufferLLVM.h:34
lldb-types.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
lldb_private::DataBufferLLVM
Definition: DataBufferLLVM.h:26
DataBuffer.h