Home | History | Annotate | Download | only in Basic

Lines Matching defs:File

1 //===- VirtualFileSystem.cpp - Virtual File System Layer --------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
9 // This file implements the VirtualFileSystem interface.
90 File::~File() {}
139 /// \brief Wrapper around a raw file descriptor.
140 class RealFile : public File {
149 assert(FD >= 0 && "Invalid or inactive file descriptor");
166 assert(FD != -1 && "cannot stat closed file");
183 assert(FD != -1 && "cannot get buffer for closed file");
195 /// \brief The file system according to your operating system.
199 ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) override;
214 ErrorOr<std::unique_ptr<File>>
220 return std::unique_ptr<File>(new RealFile(FD, Name.str(), RealName.str()));
237 // file system abstraction that allows openat() style interactions.
296 // Synchronize added file systems by duplicating the working directory from
302 // FIXME: handle symlinks that cross file systems
311 ErrorOr<std::unique_ptr<File>>
313 // FIXME: handle symlinks that cross file systems
324 // All file systems are synchronized, just take the first working directory.
409 /// The in memory file system is a tree of Nodes. Every node can either be a
410 /// file or a directory.
441 /// Adapt a InMemoryFile for VFS' File interface.
442 class InMemoryFileAdaptor : public File {
532 // End of the path, create a new file.
560 "Must be either file or directory!");
562 // Trying to insert a directory in place of a file.
566 // Return false only if the new file is different from the existing one.
604 // Return the file if it's at the end of the path.
605 if (auto File = dyn_cast<detail::InMemoryFile>(Node)) {
607 return File;
625 llvm::ErrorOr<std::unique_ptr<File>>
631 // When we have a file provide a heap-allocated wrapper for the memory buffer
632 // to match the ownership semantics for File.
634 return std::unique_ptr<File>(new detail::InMemoryFileAdaptor(*F));
709 /// \brief A single file or directory in the VFS.
760 /// \brief whether to use the external path as the name for this file.
784 /// \brief A virtual file system parsed from a YAML file.
787 /// virtual file paths to existing external files, available in \c ExternalFS.
789 /// The basic structure of the parsed file is:
810 /// 'contents': [ <file or directory entries> ]
826 /// 'type': 'file',
829 /// 'external-contents': <path to external file>)
836 /// /path/to/file). However, any directory that contains more than one child
839 /// The root(s) of the virtual file system.
841 /// \brief The file system to use for external references.
861 /// names of files. This global value is overridable on a per-file basis.
865 /// Virtual file paths and external files could be canonicalized without "..",
894 /// returns a virtual file system representing its contents.
901 ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path) override;
1085 // describe a file for a current directory after some of its subdir
1096 assert(FE && "Must be a file");
1109 error(N, "expected mapping node for file or directory entry");
1160 if (Value == "file")
1373 // Now that we sucessefully parsed the YAML file, canonicalize the internal
1535 /// Provide a file wrapper with an overriden status.
1536 class FileWithFixedStatus : public File {
1537 std::unique_ptr<File> InnerFile;
1541 FileWithFixedStatus(std::unique_ptr<File> InnerFile, Status S)
1555 ErrorOr<std::unique_ptr<File>>
1576 return std::unique_ptr<File>(
1667 OS.indent(Indent + 2) << "'type': 'file',\n";