From dbb34a44508ecce044324e22b7ba8b354eaaba3e Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Mon, 10 Jul 2023 08:30:17 +0200 Subject: [PATCH] Use standard way to set up OverlayFS This makes it possible to drop our custom CompilerInvocation::addOverlay functionality (but the rest of the patch that introduced it is still needed with LLVM 13, so it cannot be reverted for now). --- lib/Interpreter/CIFactory.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Interpreter/CIFactory.cpp b/lib/Interpreter/CIFactory.cpp index 8e1b769c..aec15324 100644 --- a/lib/Interpreter/CIFactory.cpp +++ b/lib/Interpreter/CIFactory.cpp @@ -742,8 +742,11 @@ namespace { if (!FS.get()) llvm::errs() << "Error in modulemap.overlay!\n"; - // Load virtual modulemap overlay file - CI.getInvocation().addOverlay(FS); + // Load virtual modulemap overlay file - we set up an OverlayFileSystem + // when calling createFileManager. + auto& OverlayVFS = + static_cast(CI.getVirtualFileSystem()); + OverlayVFS.pushOverlay(FS); } } @@ -1450,7 +1453,9 @@ namespace { return CI.release(); } - CI->createFileManager(); + IntrusiveRefCntPtr Overlay = + new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()); + CI->createFileManager(Overlay); clang::CompilerInvocation& Invocation = CI->getInvocation(); std::string& PCHFile = Invocation.getPreprocessorOpts().ImplicitPCHInclude; bool InitLang = true, InitTarget = true;