class FileCollector

Declaration

class FileCollector { /* full declaration omitted */ };

Description

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

Declared at: llvm/include/llvm/Support/FileCollector.h:24

Member Variables

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

Method Overview

  • public FileCollector(std::string Root, std::string OverlayRoot)
  • public void addFile(const llvm::Twine & file)
  • public std::error_code copyFiles(bool StopOnError = true)
  • public static IntrusiveRefCntPtr<vfs::FileSystem> createCollectorVFS(IntrusiveRefCntPtr<vfs::FileSystem> BaseFS, std::shared_ptr<FileCollector> Collector)
  • public std::error_code writeMapping(llvm::StringRef mapping_file)

Methods

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

Declared at: llvm/include/llvm/Support/FileCollector.h:26

Parameters

std::string Root
std::string OverlayRoot

void addFile(const llvm::Twine& file)

Declared at: llvm/include/llvm/Support/FileCollector.h:28

Parameters

const llvm::Twine& file

std::error_code copyFiles(bool StopOnError = true)

Description

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.

Declared at: llvm/include/llvm/Support/FileCollector.h:38

Parameters

bool StopOnError = true

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

Description

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

Declared at: llvm/include/llvm/Support/FileCollector.h:43

Parameters

IntrusiveRefCntPtr<vfs::FileSystem> BaseFS
std::shared_ptr<FileCollector> Collector

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

Description

Write the yaml mapping (for the VFS) to the given file.

Declared at: llvm/include/llvm/Support/FileCollector.h:31

Parameters

llvm::StringRef mapping_file