llvm::SmallVectorMemoryBuffer

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

NameDescription
MemoryBufferThis 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

NameDescription
BufferKind The kind of memory backing used to support the MemoryBuffer.

Member Functions

NameDescription
SmallVectorMemoryBuffer [constructor]Constructors
~SmallVectorMemoryBuffer [destructor] [virtual]Destroy this SmallVectorMemoryBuffer.
operator= [deleted]Deleted copy assignment.
dontNeedIfMmap [virtual]Advise the kernel that a read-only mmap buffer is unused soon.
getBuffer Buffer contents as a StringRef spanning [start, end).]
getBufferEnd Pointer one past the last byte of the buffer.
getBufferIdentifier [virtual]Return the identifier for this buffer (the name given at construction).
getBufferKind [virtual]Return that this buffer is backed by heap-allocated (malloc) memory.
getBufferSize Number of bytes in the buffer (end minus start).
getBufferStart Pointer to the start of the buffer.
getMemBufferRef Return a lightweight reference to this buffer's data and identifier.
randomAccessIfMmap [virtual]Advise the kernel that accesses to this mmap buffer will be random.
willNeedIfMmap [virtual]Advise the kernel to prefetch this mmap buffer into memory.

Static Member Functions

NameDescription
getFile Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
getFileAsStream Read the specified file into a MemoryBuffer until EOF.
getFileOrSTDIN Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
getFileSlice Map a subrange of the specified file as a MemoryBuffer.
getMemBuffer getMemBuffer overloads
getMemBufferCopy Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
getOpenFile Given an already-open file descriptor, read the file and return a MemoryBuffer.
getOpenFileSlice Map a slice of an already-open file into a MemoryBuffer.
getSTDIN Read all of stdin into a file buffer, and return it.

Protected Member Functions

NameDescription
init Initialize buffer pointers and whether a null terminator is required.

Non-Member Functions

NameDescription
createBasicBlockSectionsProfileReaderWrapperPassCreate a pass that parses a basic block sections profile from Buf.
wrapConvert a MemoryBuffer pointer to an LLVMMemoryBufferRef.