aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 31a8d75..3e67cf1 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -271,19 +271,12 @@ static void collectIncludePCH(CompilerInstance &CI,
static void collectVFSEntries(CompilerInstance &CI,
std::shared_ptr<ModuleDependencyCollector> MDC) {
- if (CI.getHeaderSearchOpts().VFSOverlayFiles.empty())
- return;
-
// Collect all VFS found.
SmallVector<llvm::vfs::YAMLVFSEntry, 16> VFSEntries;
- for (const std::string &VFSFile : CI.getHeaderSearchOpts().VFSOverlayFiles) {
- llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
- llvm::MemoryBuffer::getFile(VFSFile);
- if (!Buffer)
- return;
- llvm::vfs::collectVFSFromYAML(std::move(Buffer.get()),
- /*DiagHandler*/ nullptr, VFSFile, VFSEntries);
- }
+ CI.getVirtualFileSystem().visit([&](llvm::vfs::FileSystem &VFS) {
+ if (auto *RedirectingVFS = dyn_cast<llvm::vfs::RedirectingFileSystem>(&VFS))
+ llvm::vfs::collectVFSEntries(*RedirectingVFS, VFSEntries);
+ });
for (auto &E : VFSEntries)
MDC->addFile(E.VPath, E.RPath);