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
18namespace llvm {
19class WritableMemoryBuffer;
20class MemoryBuffer;
21class Twine;
22} // namespace llvm
23
24namespace lldb_private {
25class FileSystem;
26
27class DataBufferLLVM : public DataBuffer {
28public:
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
49protected:
50 std::unique_ptr<llvm::MemoryBuffer> Buffer;
51};
52
54public:
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.
74 std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
75
76protected:
77 std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
78};
79} // namespace lldb_private
80
81#endif
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
std::unique_ptr< llvm::MemoryBuffer > Buffer
static char ID
LLVM RTTI support.
bool isA(const void *ClassID) const override
static bool classof(const DataBuffer *data_buffer)
const uint8_t * GetBytesImpl() const override
}
A pure virtual protocol class for abstracted read only data buffers.
Definition: DataBuffer.h:42
virtual bool isA(const void *ClassID) const
Definition: DataBuffer.h:66
const uint8_t * GetBytesImpl() const override
}
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
static char ID
LLVM RTTI support.
std::unique_ptr< llvm::WritableMemoryBuffer > Buffer
static bool classof(const DataBuffer *data_buffer)
bool isA(const void *ClassID) const override
bool isA(const void *ClassID) const override
Definition: DataBuffer.h:117
A class that represents a running process on the host machine.
uint64_t offset_t
Definition: lldb-types.h:85
Definition: Debugger.h:54