summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index dc4dd89371a..dfe3d85ba73 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -211,30 +211,13 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
return true;
}
- if (!CI.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
- IntrusiveRefCntPtr<vfs::OverlayFileSystem>
- Overlay(new vfs::OverlayFileSystem(vfs::getRealFileSystem()));
- // earlier vfs files are on the bottom
- const std::vector<std::string> &Files =
- CI.getHeaderSearchOpts().VFSOverlayFiles;
- for (std::vector<std::string>::const_iterator I = Files.begin(),
- E = Files.end();
- I != E; ++I) {
- std::unique_ptr<llvm::MemoryBuffer> Buffer;
- if (llvm::errc::success != llvm::MemoryBuffer::getFile(*I, Buffer)) {
- CI.getDiagnostics().Report(diag::err_missing_vfs_overlay_file) << *I;
- goto failure;
- }
-
- IntrusiveRefCntPtr<vfs::FileSystem> FS =
- vfs::getVFSFromYAML(Buffer.release(), /*DiagHandler*/ 0);
- if (!FS.getPtr()) {
- CI.getDiagnostics().Report(diag::err_invalid_vfs_overlay) << *I;
- goto failure;
- }
- Overlay->pushOverlay(FS);
- }
- CI.setVirtualFileSystem(Overlay);
+ if (!CI.hasVirtualFileSystem()) {
+ if (IntrusiveRefCntPtr<vfs::FileSystem> VFS =
+ createVFSFromCompilerInvocation(CI.getInvocation(),
+ CI.getDiagnostics()))
+ CI.setVirtualFileSystem(VFS);
+ else
+ goto failure;
}
// Set up the file and source managers, if needed.
OpenPOWER on IntegriCloud