This interface provides simple read‐only access to a block of memory, and provides simple methods for reading files and standard input into a memory buffer. In addition to basic access to the characters in the file, this interface guarantees you can read one character past the end of the file, and that this character will read as '0'.
Synopsis
Declared in <llvm/Support/MemoryBuffer.h>
class MemoryBuffer;
Description
The '0' guarantee is needed to support an optimization ‐‐ it's intended to be more efficient for clients which are reading all the data to stop reading when they encounter a '0' than to continually check the file position to see if it has reached the end of the file.
Enums
Name |
Description |
The kind of memory backing used to support the MemoryBuffer. |
Member Functions
Name |
Description |
|
Deleted copy constructor. |
|
Virtual destructor for polymorphic MemoryBuffer subclasses. |
|
Deleted copy assignment. |
|
Advise the kernel that a read‐only mmap buffer is unused soon. |
Buffer contents as a StringRef spanning [start, end).] |
|
Pointer one past the last byte of the buffer. |
|
|
Return an identifier for this buffer, typically the filename it was read from. |
|
Return information on the memory mechanism used to support the MemoryBuffer. |
Number of bytes in the buffer (end minus start). |
|
Pointer to the start of the buffer. |
|
Return a lightweight reference to this buffer's data and identifier. |
|
|
Advise the kernel that accesses to this mmap buffer will be random. |
|
Advise the kernel to prefetch this mmap buffer into memory. |
Static Member Functions
Name |
Description |
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. |
|
Read the specified file into a MemoryBuffer until EOF. |
|
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "‐". |
|
Map a subrange of the specified file as a MemoryBuffer. |
|
|
|
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. |
|
Given an already‐open file descriptor, read the file and return a MemoryBuffer. |
|
Map a slice of an already‐open file into a MemoryBuffer. |
|
Read all of stdin into a file buffer, and return it. |
Protected Member Functions
Name |
Description |
|
Default‐construct an uninitialized memory buffer. |
Initialize buffer pointers and whether a null terminator is required. |
Non-Member Functions
Name |
Description |
Create a pass that parses a basic block sections profile from |
|
Convert an LLVMMemoryBufferRef to a MemoryBuffer pointer. |
|
Convert a MemoryBuffer pointer to an LLVMMemoryBufferRef. |
Derived Classes
Name |
Description |
SmallVector‐backed MemoryBuffer instance. |
|
MemoryBuffer with copy‐on‐write access to a writable backing store. |
|
MemoryBuffer that maps a file writable and can commit changes back. |
Created with MrDocs