Opens the file with the given name in a read‐only mode, returning its open file descriptor.

Synopsis

Declared in <llvm/Support/FileSystem.h>

Expected<file_t>
openNativeFileForRead(
    Twine const& Name,
    OpenFlags Flags = OF_None,
    SmallVectorImpl<char>* RealPath = nullptr);

Description

The caller is responsible for closing the freeing the file once they are finished with it.

Return Value

a platform‐specific file descriptor if Name has been opened, otherwise an error object.

Parameters

Name

Description

Name

The path of the file to open, relative or absolute.

Flags

Additional open flags.

RealPath

If nonnull, extra work is done to determine the real path of the opened file, and that path is stored in this location.

Created with MrDocs