1 //===--- DataBufferLLVM.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_CORE_DATABUFFERLLVM_H
11 #define LLDB_CORE_DATABUFFERLLVM_H
13 #include "lldb/Utility/DataBuffer.h"
14 #include "lldb/lldb-types.h" // for offset_t
17 #include <stdint.h> // for uint8_t, uint64_t
20 class WritableMemoryBuffer;
24 namespace lldb_private {
26 class DataBufferLLVM : public DataBuffer {
30 static std::shared_ptr<DataBufferLLVM>
31 CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset);
33 static std::shared_ptr<DataBufferLLVM>
34 CreateFromPath(const llvm::Twine &Path);
36 uint8_t *GetBytes() override;
37 const uint8_t *GetBytes() const override;
38 lldb::offset_t GetByteSize() const override;
40 char *GetChars() { return reinterpret_cast<char *>(GetBytes()); }
43 /// \brief Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a
45 explicit DataBufferLLVM(std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
47 std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;