LLVM
8.0.1
|
This class is an extension of MemoryBuffer, which allows copy-on-write access to the underlying contents. More...
#include "llvm/Support/MemoryBuffer.h"
Public Member Functions | |
char * | getBufferStart () |
char * | getBufferEnd () |
MutableArrayRef< char > | getBuffer () |
Public Member Functions inherited from llvm::MemoryBuffer | |
MemoryBuffer (const MemoryBuffer &)=delete | |
MemoryBuffer & | operator= (const MemoryBuffer &)=delete |
virtual | ~MemoryBuffer () |
const char * | getBufferStart () const |
const char * | getBufferEnd () const |
size_t | getBufferSize () const |
StringRef | getBuffer () const |
virtual StringRef | getBufferIdentifier () const |
Return an identifier for this buffer, typically the filename it was read from. More... | |
virtual BufferKind | getBufferKind () const =0 |
Return information on the memory mechanism used to support the MemoryBuffer. More... | |
MemoryBufferRef | getMemBufferRef () const |
Static Public Member Functions | |
static ErrorOr< std::unique_ptr< WritableMemoryBuffer > > | getFile (const Twine &Filename, int64_t FileSize=-1, bool IsVolatile=false) |
static ErrorOr< std::unique_ptr< WritableMemoryBuffer > > | getFileSlice (const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsVolatile=false) |
Map a subrange of the specified file as a WritableMemoryBuffer. More... | |
static std::unique_ptr< WritableMemoryBuffer > | getNewUninitMemBuffer (size_t Size, const Twine &BufferName="") |
Allocate a new MemoryBuffer of the specified size that is not initialized. More... | |
static std::unique_ptr< WritableMemoryBuffer > | getNewMemBuffer (size_t Size, const Twine &BufferName="") |
Allocate a new zero-initialized MemoryBuffer of the specified size. More... | |
Static Public Member Functions inherited from llvm::MemoryBuffer | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getFile (const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false) |
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. More... | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getFileAsStream (const Twine &Filename) |
Read all of the specified file into a MemoryBuffer as a stream (i.e. More... | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getOpenFileSlice (int FD, const Twine &Filename, uint64_t MapSize, int64_t Offset, bool IsVolatile=false) |
Given an already-open file descriptor, map some slice of it into a MemoryBuffer. More... | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getOpenFile (int FD, const Twine &Filename, uint64_t FileSize, bool RequiresNullTerminator=true, bool IsVolatile=false) |
Given an already-open file descriptor, read the file and return a MemoryBuffer. More... | |
static std::unique_ptr< MemoryBuffer > | getMemBuffer (StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true) |
Open the specified memory range as a MemoryBuffer. More... | |
static std::unique_ptr< MemoryBuffer > | getMemBuffer (MemoryBufferRef Ref, bool RequiresNullTerminator=true) |
static std::unique_ptr< MemoryBuffer > | getMemBufferCopy (StringRef InputData, const Twine &BufferName="") |
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. More... | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getSTDIN () |
Read all of stdin into a file buffer, and return it. More... | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getFileOrSTDIN (const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true) |
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-". More... | |
static ErrorOr< std::unique_ptr< MemoryBuffer > > | getFileSlice (const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsVolatile=false) |
Map a subrange of the specified file as a MemoryBuffer. More... | |
Protected Member Functions | |
WritableMemoryBuffer ()=default | |
Protected Member Functions inherited from llvm::MemoryBuffer | |
MemoryBuffer ()=default | |
void | init (const char *BufStart, const char *BufEnd, bool RequiresNullTerminator) |
init - Initialize this MemoryBuffer as a reference to externally allocated memory, memory that we know is already null terminated. More... | |
Static Protected Attributes | |
static constexpr sys::fs::mapped_file_region::mapmode | Mapmode |
Static Protected Attributes inherited from llvm::MemoryBuffer | |
static constexpr sys::fs::mapped_file_region::mapmode | Mapmode |
Additional Inherited Members | |
Public Types inherited from llvm::MemoryBuffer | |
enum | BufferKind { MemoryBuffer_Malloc, MemoryBuffer_MMap } |
The kind of memory backing used to support the MemoryBuffer. More... | |
This class is an extension of MemoryBuffer, which allows copy-on-write access to the underlying contents.
It only supports creation methods that are guaranteed to produce a writable buffer. For example, mapping a file read-only is not supported.
Definition at line 156 of file MemoryBuffer.h.
|
protecteddefault |
|
inline |
Definition at line 176 of file MemoryBuffer.h.
References llvm::MemoryBuffer::getBufferEnd(), llvm::MemoryBuffer::getBufferStart(), llvm::MemoryBuffer::getFile(), llvm::MemoryBuffer::getFileAsStream(), llvm::MemoryBuffer::getFileOrSTDIN(), llvm::MemoryBuffer::getFileSlice(), llvm::MemoryBuffer::getMemBuffer(), llvm::MemoryBuffer::getMemBufferCopy(), llvm::MemoryBuffer::getOpenFile(), llvm::MemoryBuffer::getOpenFileSlice(), llvm::MemoryBuffer::getSTDIN(), llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile, and Size.
|
inline |
Definition at line 173 of file MemoryBuffer.h.
References llvm::MemoryBuffer::getBufferEnd().
|
inline |
Definition at line 170 of file MemoryBuffer.h.
References llvm::MemoryBuffer::getBufferStart().
|
static |
Definition at line 259 of file MemoryBuffer.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile.
|
static |
Map a subrange of the specified file as a WritableMemoryBuffer.
Definition at line 267 of file MemoryBuffer.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::IsVolatile.
|
static |
Allocate a new zero-initialized MemoryBuffer of the specified size.
Note that the caller need not initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.
Definition at line 300 of file MemoryBuffer.cpp.
References getNewUninitMemBuffer(), llvm::Intrinsic::memset, and Size.
Referenced by llvm::object::WindowsResourceCOFFWriter::WindowsResourceCOFFWriter().
|
static |
Allocate a new MemoryBuffer of the specified size that is not initialized.
Note that the caller should initialize the memory allocated by this method. The memory is owned by the MemoryBuffer object.
Definition at line 274 of file MemoryBuffer.cpp.
References llvm::alignTo(), CopyStringRef(), llvm::MipsISD::Ret, Size, llvm::StringRef::size(), and llvm::Twine::toStringRef().
Referenced by getMemBufferCopyImpl(), getNewMemBuffer(), and getOpenFileImpl().
|
staticprotected |
Definition at line 160 of file MemoryBuffer.h.