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 MemoryBuffer;
21 class Twine;
22 } // namespace llvm
23 
24 namespace lldb_private {
25 class FileSystem;
26 
27 class DataBufferLLVM : public DataBuffer {
28 public:
29  ~DataBufferLLVM() override;
30 
31  const uint8_t *GetBytesImpl() const override;
32  lldb::offset_t GetByteSize() const override;
33 
34  /// LLVM RTTI support.
35  /// {
36  static char ID;
37  bool isA(const void *ClassID) const override {
38  return ClassID == &ID || DataBuffer::isA(ClassID);
39  }
40  static bool classof(const DataBuffer *data_buffer) {
41  return data_buffer->isA(&ID);
42  }
43  /// }
44 
45  /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid
46  /// pointer.
47  explicit DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> Buffer);
48 
49 protected:
50  std::unique_ptr<llvm::MemoryBuffer> Buffer;
51 };
52 
54 public:
55  ~WritableDataBufferLLVM() override;
56 
57  const uint8_t *GetBytesImpl() const override;
58  lldb::offset_t GetByteSize() const override;
59 
60  /// LLVM RTTI support.
61  /// {
62  static char ID;
63  bool isA(const void *ClassID) const override {
64  return ClassID == &ID || WritableDataBuffer::isA(ClassID);
65  }
66  static bool classof(const DataBuffer *data_buffer) {
67  return data_buffer->isA(&ID);
68  }
69  /// }
70 
71  /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid
72  /// pointer.
73  explicit WritableDataBufferLLVM(
74  std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
75 
76 protected:
77  std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
78 };
79 } // namespace lldb_private
80 
81 #endif
llvm
Definition: Debugger.h:50
lldb_private::WritableDataBufferLLVM::isA
bool isA(const void *ClassID) const override
Definition: DataBufferLLVM.h:63
lldb_private::DataBufferLLVM::isA
bool isA(const void *ClassID) const override
Definition: DataBufferLLVM.h:37
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::DataBufferLLVM::classof
static bool classof(const DataBuffer *data_buffer)
Definition: DataBufferLLVM.h:40
lldb_private::WritableDataBufferLLVM
Definition: DataBufferLLVM.h:53
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
DataBuffer
lldb_private::DataBufferLLVM::GetByteSize
lldb::offset_t GetByteSize() const override
Definition: DataBufferLLVM.cpp:29
lldb_private::WritableDataBufferLLVM::classof
static bool classof(const DataBuffer *data_buffer)
Definition: DataBufferLLVM.h:66
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
lldb-types.h
WritableDataBuffer
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
Definition: DataBufferLLVM.h:27
lldb_private::DataBufferLLVM::GetBytesImpl
const uint8_t * GetBytesImpl() const override
Definition: DataBufferLLVM.cpp:25
DataBuffer.h