Given an already-open file descriptor, read the file and return a MemoryBuffer.
Declared in <llvm/Support/MemoryBuffer.h>
static
ErrorOr<std::unique_ptr<MemoryBuffer>>
getOpenFile(
sys::fs::file_t FD,
Twine const& Filename,
uint64_t FileSize,
bool RequiresNullTerminator = true,
bool IsVolatile = false,
std::optional<Align> Alignment = std::nullopt);
The file contents on success, or an error on failure.
| Name | Description |
|---|---|
| FD | Already-open file descriptor to read from. |
| Filename | Identifier for the buffer (typically the path). |
| FileSize | Size of the file in bytes. |
| RequiresNullTerminator | Whether the buffer must be null-terminated. |
| 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. |