1 //===--- DataBufferLLVM.h ---------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_CORE_DATABUFFERLLVM_H
11 #define LLDB_CORE_DATABUFFERLLVM_H
12 
13 #include "lldb/Utility/DataBuffer.h"
14 #include "lldb/lldb-types.h"
15 
16 #include <memory>
17 #include <stdint.h>
18 
19 namespace llvm {
20 class WritableMemoryBuffer;
21 class Twine;
22 }
23 
24 namespace lldb_private {
25 
26 class FileSystem;
27 class DataBufferLLVM : public DataBuffer {
28 public:
29   ~DataBufferLLVM();
30 
31   uint8_t *GetBytes() override;
32   const uint8_t *GetBytes() const override;
33   lldb::offset_t GetByteSize() const override;
34 
GetChars()35   char *GetChars() { return reinterpret_cast<char *>(GetBytes()); }
36 
37 private:
38   friend FileSystem;
39   /// Construct a DataBufferLLVM from \p Buffer.  \p Buffer must be a valid
40   /// pointer.
41   explicit DataBufferLLVM(std::unique_ptr<llvm::WritableMemoryBuffer> Buffer);
42 
43   std::unique_ptr<llvm::WritableMemoryBuffer> Buffer;
44 };
45 }
46 
47 #endif
48