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

MemoryBuffer

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

BufferKind

The kind of memory backing used to support the MemoryBuffer.

Member Functions

Name

Description

SmallVectorMemoryBuffer [constructor]

Constructors

~SmallVectorMemoryBuffer [destructor] [virtual]

Destructor

operator= [deleted]

Copy assignment operator

dontNeedIfMmap [virtual]

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.

getBuffer

getBufferEnd

getBufferIdentifier [virtual]

getBufferKind [virtual]

getBufferSize

getBufferStart

Pointer to the start of the buffer.

getMemBufferRef

randomAccessIfMmap [virtual]

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.

willNeedIfMmap [virtual]

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

getFile

Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.

getFileAsStream

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).

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

Open the specified memory range as a MemoryBuffer. Note that InputData must be null terminated if RequiresNullTerminator is true.

getMemBufferCopy

Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it. InputData does not have to be null terminated.

getOpenFile

Given an already‐open file descriptor, read the file and return a MemoryBuffer.

getOpenFileSlice

Given an already‐open file descriptor, map some slice of it into a MemoryBuffer. The slice is specified by an Offset and MapSize. Since this is in the middle of a file, the buffer is not null terminated.

getSTDIN

Read all of stdin into a file buffer, and return it.

Protected Member Functions

Name

init

Created with MrDocs