class InMemoryFileSystem
Declaration
class InMemoryFileSystem : public FileSystem { /* full declaration omitted */ };
Description
An in-memory file system.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:415
Inherits from: FileSystem
Method Overview
- public InMemoryFileSystem(bool UseNormalizedPaths = true)
- public bool addFile(const llvm::Twine & Path, time_t ModificationTime, std::unique_ptr<llvm::MemoryBuffer> Buffer, Optional<uint32_t> User = None, Optional<uint32_t> Group = None, Optional<llvm::sys::fs::file_type> Type = None, Optional<llvm::sys::fs::perms> Perms = None)
- public bool addFileNoOwn(const llvm::Twine & Path, time_t ModificationTime, llvm::MemoryBuffer * Buffer, Optional<uint32_t> User = None, Optional<uint32_t> Group = None, Optional<llvm::sys::fs::file_type> Type = None, Optional<llvm::sys::fs::perms> Perms = None)
- public bool addHardLink(const llvm::Twine & From, const llvm::Twine & To)
- public llvm::vfs::directory_iterator dir_begin(const llvm::Twine & Dir, std::error_code & EC)
- public llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const
- public std::error_code getRealPath(const llvm::Twine & Path, SmallVectorImpl<char> & Output) const
- public std::error_code isLocal(const llvm::Twine & Path, bool & Result)
- public llvm::ErrorOr<std::unique_ptr<File>> openFileForRead(const llvm::Twine & Path)
- public std::error_code setCurrentWorkingDirectory(const llvm::Twine & Path)
- public llvm::ErrorOr<Status> status(const llvm::Twine & Path)
- public std::string toString() const
- public bool useNormalizedPaths() const
- public ~InMemoryFileSystem()
Inherited from FileSystem:
- public dir_begin
- public exists
- public getBufferForFile
- public getCurrentWorkingDirectory
- public getRealPath
- public isLocal
- public makeAbsolute
- public openFileForRead
- public setCurrentWorkingDirectory
- public status
Methods
¶InMemoryFileSystem(bool UseNormalizedPaths = true)
InMemoryFileSystem(bool UseNormalizedPaths = true)
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:430
Parameters
- bool UseNormalizedPaths = true
¶bool addFile(
const llvm::Twine& Path,
time_t ModificationTime,
std::unique_ptr<llvm::MemoryBuffer> Buffer,
Optional<uint32_t> User = None,
Optional<uint32_t> Group = None,
Optional<llvm::sys::fs::file_type> Type =
None,
Optional<llvm::sys::fs::perms> Perms = None)
bool addFile(
const llvm::Twine& Path,
time_t ModificationTime,
std::unique_ptr<llvm::MemoryBuffer> Buffer,
Optional<uint32_t> User = None,
Optional<uint32_t> Group = None,
Optional<llvm::sys::fs::file_type> Type =
None,
Optional<llvm::sys::fs::perms> Perms = None)
Description
Add a file containing a buffer or a directory to the VFS with a path. The VFS owns the buffer. If present, User, Group, Type and Perms apply to the newly-created file or directory.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:439
Parameters
- const llvm::Twine& Path
- time_t ModificationTime
- std::unique_ptr<llvm::MemoryBuffer> Buffer
- Optional<uint32_t> User = None
- Optional<uint32_t> Group = None
- Optional<llvm::sys::fs::file_type> Type = None
- Optional<llvm::sys::fs::perms> Perms = None
Returns
true if the file or directory was successfully added, false if the file or directory already exists in the file system with different contents.
¶bool addFileNoOwn(
const llvm::Twine& Path,
time_t ModificationTime,
llvm::MemoryBuffer* Buffer,
Optional<uint32_t> User = None,
Optional<uint32_t> Group = None,
Optional<llvm::sys::fs::file_type> Type =
None,
Optional<llvm::sys::fs::perms> Perms = None)
bool addFileNoOwn(
const llvm::Twine& Path,
time_t ModificationTime,
llvm::MemoryBuffer* Buffer,
Optional<uint32_t> User = None,
Optional<uint32_t> Group = None,
Optional<llvm::sys::fs::file_type> Type =
None,
Optional<llvm::sys::fs::perms> Perms = None)
Description
Add a buffer to the VFS with a path. The VFS does not own the buffer. If present, User, Group, Type and Perms apply to the newly-created file or directory.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:465
Parameters
- const llvm::Twine& Path
- time_t ModificationTime
- llvm::MemoryBuffer* Buffer
- Optional<uint32_t> User = None
- Optional<uint32_t> Group = None
- Optional<llvm::sys::fs::file_type> Type = None
- Optional<llvm::sys::fs::perms> Perms = None
Returns
true if the file or directory was successfully added, false if the file or directory already exists in the file system with different contents.
¶bool addHardLink(const llvm::Twine& From,
const llvm::Twine& To)
bool addHardLink(const llvm::Twine& From,
const llvm::Twine& To)
Description
Add a hard link to a file. Here hard links are not intended to be fully equivalent to the classical filesystem. Both the hard link and the file share the same buffer and status (and thus have the same UniqueID). Because of this there is no way to distinguish between the link and the file after the link has been added. The To path must be an existing file or a hardlink. The From file must not have been added before. The To Path must not be a directory. The From Node is added as a hard link which points to the resolved file of To Node.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:457
Parameters
- const llvm::Twine& From
- const llvm::Twine& To
Returns
true if the above condition is satisfied and hardlink was successfully created, false otherwise.
¶llvm::vfs::directory_iterator dir_begin(
const llvm::Twine& Dir,
std::error_code& EC)
llvm::vfs::directory_iterator dir_begin(
const llvm::Twine& Dir,
std::error_code& EC)
Description
Get a directory_iterator for \p Dir.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:479
Parameters
- const llvm::Twine& Dir
- std::error_code& EC
¶llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const
llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const
Description
Get the working directory of this file system.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:481
¶std::error_code getRealPath(
const llvm::Twine& Path,
SmallVectorImpl<char>& Output) const
std::error_code getRealPath(
const llvm::Twine& Path,
SmallVectorImpl<char>& Output) const
Description
Canonicalizes \p Path by combining with the current working directory and normalizing the path (e.g. remove dots). If the current working directory is not set, this returns errc::operation_not_permitted. This doesn't resolve symlinks as they are not supported in in-memory file system.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:490
Parameters
- const llvm::Twine& Path
- SmallVectorImpl<char>& Output
¶std::error_code isLocal(const llvm::Twine& Path,
bool& Result)
std::error_code isLocal(const llvm::Twine& Path,
bool& Result)
Description
Is the file mounted on a local filesystem?
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:492
Parameters
- const llvm::Twine& Path
- bool& Result
¶llvm::ErrorOr<std::unique_ptr<File>>
openFileForRead(const llvm::Twine& Path)
llvm::ErrorOr<std::unique_ptr<File>>
openFileForRead(const llvm::Twine& Path)
Description
Get a \p File object for the file at \p Path, if one exists.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:478
Parameters
- const llvm::Twine& Path
¶std::error_code setCurrentWorkingDirectory(
const llvm::Twine& Path)
std::error_code setCurrentWorkingDirectory(
const llvm::Twine& Path)
Description
Set the working directory. This will affect all following operations on this file system and may propagate down for nested file systems.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:493
Parameters
- const llvm::Twine& Path
¶llvm::ErrorOr<Status> status(
const llvm::Twine& Path)
llvm::ErrorOr<Status> status(
const llvm::Twine& Path)
Description
Get the status of the entry at \p Path, if one exists.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:476
Parameters
- const llvm::Twine& Path
¶std::string toString() const
std::string toString() const
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:471
¶bool useNormalizedPaths() const
bool useNormalizedPaths() const
Description
Return true if this file system normalizes . and .. in paths.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:474
¶~InMemoryFileSystem()
~InMemoryFileSystem()
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:431