LLVM  10.0.0svn
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
llvm::FileCollector Class Reference

Collects files into a directory and generates a mapping that can be used by the VFS. More...

#include "llvm/Support/FileCollector.h"

Collaboration diagram for llvm::FileCollector:
Collaboration graph
[legend]

Public Member Functions

 FileCollector (std::string Root, std::string OverlayRoot)
 
void addFile (const Twine &file)
 
std::error_code writeMapping (StringRef mapping_file)
 Write the yaml mapping (for the VFS) to the given file. More...
 
std::error_code copyFiles (bool StopOnError=true)
 Copy the files into the root directory. More...
 

Static Public Member Functions

static IntrusiveRefCntPtr< vfs::FileSystemcreateCollectorVFS (IntrusiveRefCntPtr< vfs::FileSystem > BaseFS, std::shared_ptr< FileCollector > Collector)
 Create a VFS that collects all the paths that might be looked at by the file system accesses. More...
 

Protected Attributes

std::mutex Mutex
 Synchronizes adding files. More...
 
std::string Root
 The root directory where files are copied. More...
 
std::string OverlayRoot
 The root directory where the VFS overlay lives. More...
 
StringSet Seen
 Tracks already seen files so they can be skipped. More...
 
vfs::YAMLVFSWriter VFSWriter
 The yaml mapping writer. More...
 
StringMap< std::string > SymlinkMap
 Caches RealPath calls when resolving symlinks. More...
 

Detailed Description

Collects files into a directory and generates a mapping that can be used by the VFS.

Definition at line 24 of file FileCollector.h.

Constructor & Destructor Documentation

◆ FileCollector()

FileCollector::FileCollector ( std::string  Root,
std::string  OverlayRoot 
)

Member Function Documentation

◆ addFile()

void FileCollector::addFile ( const Twine file)

◆ copyFiles()

std::error_code FileCollector::copyFiles ( bool  StopOnError = true)

Copy the files into the root directory.

When StopOnError is true (the default) we abort as soon as one file cannot be copied. This is relatively common, for example when a file was removed after it was added to the mapping.

Definition at line 125 of file FileCollector.cpp.

References llvm::sys::fs::copy_file(), copyAccessAndModificationTime(), llvm::sys::fs::create_directories(), llvm::sys::fs::directory_file, entry, llvm::vfs::YAMLVFSWriter::getMappings(), llvm::sys::fs::getPermissions(), llvm::sys::path::parent_path(), llvm::sys::fs::setPermissions(), llvm::sys::fs::status(), llvm::sys::fs::basic_file_status::type(), and VFSWriter.

◆ createCollectorVFS()

IntrusiveRefCntPtr< vfs::FileSystem > FileCollector::createCollectorVFS ( IntrusiveRefCntPtr< vfs::FileSystem BaseFS,
std::shared_ptr< FileCollector Collector 
)
static

Create a VFS that collects all the paths that might be looked at by the file system accesses.

Definition at line 265 of file FileCollector.cpp.

◆ writeMapping()

std::error_code FileCollector::writeMapping ( StringRef  mapping_file)

Member Data Documentation

◆ Mutex

std::mutex llvm::FileCollector::Mutex
protected

Synchronizes adding files.

Definition at line 59 of file FileCollector.h.

◆ OverlayRoot

std::string llvm::FileCollector::OverlayRoot
protected

The root directory where the VFS overlay lives.

Definition at line 65 of file FileCollector.h.

Referenced by writeMapping().

◆ Root

std::string llvm::FileCollector::Root
protected

The root directory where files are copied.

Definition at line 62 of file FileCollector.h.

Referenced by addFile().

◆ Seen

StringSet llvm::FileCollector::Seen
protected

Tracks already seen files so they can be skipped.

Definition at line 68 of file FileCollector.h.

◆ SymlinkMap

StringMap<std::string> llvm::FileCollector::SymlinkMap
protected

Caches RealPath calls when resolving symlinks.

Definition at line 74 of file FileCollector.h.

Referenced by FileCollector().

◆ VFSWriter

vfs::YAMLVFSWriter llvm::FileCollector::VFSWriter
protected

The yaml mapping writer.

Definition at line 71 of file FileCollector.h.

Referenced by copyFiles(), and writeMapping().


The documentation for this class was generated from the following files: