SmallVector‐backed MemoryBuffer instance.
Synopsis
Declared in <llvm/Support/SmallVectorMemoryBuffer.h>
class SmallVectorMemoryBuffer
: public MemoryBuffer
Description
This class enables efficient construction of MemoryBuffers from SmallVector instances. This is useful for MCJIT and Orc, where object files are streamed into SmallVectors, then inspected using ObjectFile (which takes a MemoryBuffer).
Base Classes
Name |
Description |
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'. |
Enums
Name |
Description |
The kind of memory backing used to support the MemoryBuffer. |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor |
|
Copy assignment operator |
|
For read‐only MemoryBuffer_MMap, mark the buffer as unused in the near future and the kernel can free resources associated with it. Further access is supported but may be expensive. This calls madvise(MADV_DONTNEED) on read‐only file mappings on *NIX systems. This function should not be called on a writable buffer. |
|
|
|
|
Pointer to the start of the buffer. |
|
|
For read‐only MemoryBuffer_MMap, advise the kernel that accesses will be random, disabling readahead. This calls madvise(MADV_RANDOM) on *NIX. This function should not be called on a writable buffer. |
|
Mark the buffer as to‐be‐used in a near future. This shall trigger OS prefetching from the storage device and into memory, if possible. This should be use purely as an read optimization. |
Static Member Functions
Name |
Description |
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. |
|
Read all of the specified file into a MemoryBuffer as a stream (i.e. until EOF reached). This is useful for special files that look like a regular file but have 0 size (e.g. /proc/cpuinfo on Linux). |
|
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. Note that InputData must be null terminated if RequiresNullTerminator is true. |
|
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. InputData does not have to be null terminated. |
|
Given an already‐open file descriptor, read the file and return a MemoryBuffer. |
|
Given an already‐open file descriptor, map some slice of it into a MemoryBuffer. The slice is specified by an |
|
Read all of stdin into a file buffer, and return it. |