diff options
author | Michael Spencer <bigcheesegs@gmail.com> | 2024-01-30 15:39:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-30 15:39:18 -0800 |
commit | 7847e44594aa932c0a5f5d2cd15940d2a815c059 (patch) | |
tree | debc338a0ad7726ec484fab51fcf6504d8f3b357 /clang/lib/Basic/FileManager.cpp | |
parent | 16c15b5f84836d81084e9987701ca011da5a864f (diff) | |
download | llvm-7847e44594aa932c0a5f5d2cd15940d2a815c059.zip llvm-7847e44594aa932c0a5f5d2cd15940d2a815c059.tar.gz llvm-7847e44594aa932c0a5f5d2cd15940d2a815c059.tar.bz2 |
[clang][DependencyScanner] Remove unused -ivfsoverlay files (#73734)
`-ivfsoverlay` files are unused when building most modules. Enable
removing them by,
* adding a way to visit the filesystem tree with extensible RTTI to
access each `RedirectingFileSystem`.
* Adding tracking to `RedirectingFileSystem` to record when it
actually redirects a file access.
* Storing this information in each PCM.
Usage tracking is only enabled when iterating over the source manager
and affecting modulemaps. Here each path is stated to cause an access.
During scanning these stats all hit the cache.
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r-- | clang/lib/Basic/FileManager.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 4e77b17..6097a27 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -363,6 +363,13 @@ llvm::Expected<FileEntryRef> FileManager::getSTDIN() { return *STDIN; } +void FileManager::trackVFSUsage(bool Active) { + FS->visit([Active](llvm::vfs::FileSystem &FileSys) { + if (auto *RFS = dyn_cast<llvm::vfs::RedirectingFileSystem>(&FileSys)) + RFS->setUsageTrackingActive(Active); + }); +} + const FileEntry *FileManager::getVirtualFile(StringRef Filename, off_t Size, time_t ModificationTime) { return &getVirtualFileRef(Filename, Size, ModificationTime).getFileEntry(); |