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_CORE_DATABUFFERLLVM_H 10#define LLDB_CORE_DATABUFFERLLVM_H 11 12#include "lldb/Utility/DataBuffer.h" 13#include "lldb/lldb-types.h" 14 15#include <memory> 16#include <stdint.h> 17 18namespace llvm { 19class WritableMemoryBuffer; 20class Twine; 21} 22 23namespace lldb_private { 24 25class FileSystem; 26class DataBufferLLVM : public DataBuffer { 27public: 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 36private: 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 47