Captures file system interaction and generates data to be later replayed with the RedirectingFileSystem.

Synopsis

Declared in <llvm/Support/FileCollector.h>

class FileCollector
    : public FileCollectorBase

Description

For any file that gets accessed we eventually create:

  • a copy of the file inside Root

  • a record in RedirectingFileSystem mapping that maps: current real path ‐> path to the copy in Root

That intent is that later when the mapping is used by RedirectingFileSystem it simulates the state of FS that we collected.

We generate file copies and mapping lazily ‐ see writeMapping and copyFiles. We don't try to capture the state of the file at the exact time when it's accessed. Files might get changed, deleted ... we record only the "final" state.

In order to preserve the relative topology of files we use their real paths as relative paths inside of the Root.

Base Classes

Name

Description

FileCollectorBase

Types

Name

Description

PathCanonicalizer

Helper utility that encapsulates the logic for canonicalizing a virtual path and a path to copy from.

Member Functions

Name

Description

FileCollector [constructor]

Root is the directory where collected files are will be stored. OverlayRoot is VFS mapping root. Root directory gets created in copyFiles unless it already exists.

addDirectory

addFile

copyFiles

Copy the files into the root directory.

writeMapping

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

Static Member Functions

Name

Description

createCollectorVFS

Create a VFS that uses Collector to collect files accessed via BaseFS.

Protected Member Functions

Name

addDirectoryImpl [virtual]

addFileImpl [virtual]

markAsSeen

Protected Data Members

Name

Description

Canonicalizer

Helper utility for canonicalizing paths.

Mutex

Synchronizes access to internal data structures.

OverlayRoot

The root directory where the VFS overlay lives.

Root

The directory where collected files are copied to in copyFiles().

Seen

Tracks already seen files so they can be skipped.

VFSWriter

The yaml mapping writer.

Friends

Name

Description

llvm::FileCollectorFileSystem

Created with MrDocs