class File
Declaration
class File { /* full declaration omitted */ };
Description
Represents an open file.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:114
Method Overview
- public virtual std::error_code close()
- public virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBuffer(const llvm::Twine & Name, int64_t FileSize = -1, bool RequiresNullTerminator = true, bool IsVolatile = false)
- public virtual llvm::ErrorOr<std::string> getName()
- public static ErrorOr<std::unique_ptr<File>> getWithPath(ErrorOr<std::unique_ptr<File>> Result, const llvm::Twine & P)
- protected virtual void setPath(const llvm::Twine & Path)
- public virtual llvm::ErrorOr<Status> status()
- public virtual ~File()
Methods
¶virtual std::error_code close()
virtual std::error_code close()
Description
Closes the file.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:138
¶virtual llvm::ErrorOr<
std::unique_ptr<llvm::MemoryBuffer>>
getBuffer(const llvm::Twine& Name,
int64_t FileSize = -1,
bool RequiresNullTerminator = true,
bool IsVolatile = false)
virtual llvm::ErrorOr<
std::unique_ptr<llvm::MemoryBuffer>>
getBuffer(const llvm::Twine& Name,
int64_t FileSize = -1,
bool RequiresNullTerminator = true,
bool IsVolatile = false)
Description
Get the contents of the file as a \p MemoryBuffer.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:134
Parameters
- const llvm::Twine& Name
- int64_t FileSize = -1
- bool RequiresNullTerminator = true
- bool IsVolatile = false
¶virtual llvm::ErrorOr<std::string> getName()
virtual llvm::ErrorOr<std::string> getName()
Description
Get the name of the file
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:125
¶static ErrorOr<std::unique_ptr<File>> getWithPath(
ErrorOr<std::unique_ptr<File>> Result,
const llvm::Twine& P)
static ErrorOr<std::unique_ptr<File>> getWithPath(
ErrorOr<std::unique_ptr<File>> Result,
const llvm::Twine& P)
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:142
Parameters
- ErrorOr<std::unique_ptr<File>> Result
- const llvm::Twine& P
¶virtual void setPath(const llvm::Twine& Path)
virtual void setPath(const llvm::Twine& Path)
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:146
Parameters
- const llvm::Twine& Path
¶virtual llvm::ErrorOr<Status> status()
virtual llvm::ErrorOr<Status> status()
Description
Get the status of the file.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:122
¶virtual ~File()
virtual ~File()
Description
Destroy the file after closing it (if open). Sub-classes should generally call close() inside their destructors. We cannot do that from the base class, since close is virtual.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:119