LLVM: include/llvm/Support/FileCollector.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_SUPPORT_FILECOLLECTOR_H

10#define LLVM_SUPPORT_FILECOLLECTOR_H

11

16#include

17#include

18

19namespace llvm {

22

24public:

27

30

31protected:

33 if (Path.empty())

34 return false;

35 return Seen.insert(Path).second;

36 }

37

39

43 std::error_code &EC) = 0;

44

45

47

48

50};

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

71public:

72

73

75 public:

80

81

83

84

86

89

90 private:

91

92

93

95

97

99 };

100

101

102

103

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

106

107

108 std::error_code writeMapping(StringRef MappingFile);

109

110

111

112

113

114

115 std::error_code copyFiles(bool StopOnError = true);

116

117

118

121 std::shared_ptr Collector);

122

123private:

125

128 VFSWriter.addDirectoryMapping(VirtualPath, RealPath);

129 else

130 VFSWriter.addFileMapping(VirtualPath, RealPath);

131 }

132

133protected:

134 void addFileImpl(StringRef SrcPath) override;

135

138 IntrusiveRefCntPtrvfs::FileSystem FS,

139 std::error_code &EC) override;

140

141

143

144

146

147

149

150

152};

153

154}

155

156#endif

This file defines the StringMap class.

Register Usage Information Collector

dot regions Print regions of function to dot file(with no function bodies)"

StringSet - A set-like wrapper for the StringMap.

Defines the virtual file system interface vfs::FileSystem.

std::mutex Mutex

Synchronizes access to internal data structures.

Definition FileCollector.h:46

void addDirectory(const Twine &Dir)

virtual ~FileCollectorBase()

void addFile(const Twine &file)

StringSet Seen

Tracks already seen files so they can be skipped.

Definition FileCollector.h:49

virtual llvm::vfs::directory_iterator addDirectoryImpl(const llvm::Twine &Dir, IntrusiveRefCntPtr< vfs::FileSystem > FS, std::error_code &EC)=0

bool markAsSeen(StringRef Path)

Definition FileCollector.h:32

virtual void addFileImpl(StringRef SrcPath)=0

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

Definition FileCollector.h:74

PathCanonicalizer(IntrusiveRefCntPtr< vfs::FileSystem > VFS)

Definition FileCollector.h:87

LLVM_ABI PathStorage canonicalize(StringRef SrcPath)

Canonicalize a pair of virtual and real paths.

vfs::FileSystem & getFileSystem() const

Return the underlying file system.

Definition FileCollector.h:85

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

Definition FileCollector.h:70

FileCollector(std::string Root, std::string OverlayRoot, IntrusiveRefCntPtr< vfs::FileSystem > VFS)

Root is the directory where collected files are will be stored.

const std::string OverlayRoot

The root directory where the VFS overlay lives.

Definition FileCollector.h:145

PathCanonicalizer Canonicalizer

Helper utility for canonicalizing paths.

Definition FileCollector.h:151

const std::string Root

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

Definition FileCollector.h:142

vfs::YAMLVFSWriter VFSWriter

The yaml mapping writer.

Definition FileCollector.h:148

A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

StringRef - Represent a constant reference to a string, i.e.

StringSet - A wrapper for StringMap that provides set-like functionality.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

The virtual file system interface.

An input iterator over the entries in a virtual path, similar to llvm::sys::fs::directory_iterator.

LLVM_ABI bool is_directory(const basic_file_status &status)

Does status represent a directory?

This is an optimization pass for GlobalISel generic memory operations.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.

Definition FileCollector.h:76

SmallString< 256 > VirtualPath

Definition FileCollector.h:78

SmallString< 256 > CopyFrom

Definition FileCollector.h:77