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

Synopsis

Declared in <llvm/Support/MemoryBuffer.h>

static
ErrorOr<std::unique_ptr<MemoryBuffer>>
getFile(
    Twine const& Filename,
    bool IsText = false,
    bool RequiresNullTerminator = true,
    bool IsVolatile = false,
    std::optional<Align> Alignment = std::nullopt);

Return Value

Represents either an error or a value T.

Parameters

Name

Description

IsText

Set to true to indicate that the file should be read in text mode.

IsVolatile

Set to true to indicate that the contents of the file can change outside the user's control, e.g. when libclang tries to parse while the user is editing/updating the file or if the file is on an NFS.

Alignment

Set to indicate that the buffer should be aligned to at least the specified alignment.

Filename

Twine ‐ A lightweight data structure for efficiently representing the concatenation of temporary values as strings.

Created with MrDocs