ΒΆExpected<llvm::sys::fs::file_t>
openNativeFileForRead(
    const llvm::Twine& Name,
    llvm::sys::fs::OpenFlags Flags = OF_None,
    SmallVectorImpl<char>* RealPath = nullptr)

Description

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

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

Declared at: llvm/include/llvm/Support/FileSystem.h:1164

Parameters

const llvm::Twine& Name
The path of the file to open, relative or absolute.
llvm::sys::fs::OpenFlags Flags = OF_None
SmallVectorImpl<char>* RealPath = nullptr
If nonnull, extra work is done to determine the real path of the opened file, and that path is stored in this location.

Returns

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