Skip to content

Commit

Permalink
Use standard way to set up OverlayFS
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
hahnjo authored and jenkins committed Jul 11, 2023
1 parent c2562c7 commit dbb34a4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Interpreter/CIFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<llvm::vfs::OverlayFileSystem&>(CI.getVirtualFileSystem());
OverlayVFS.pushOverlay(FS);
}
}

Expand Down Expand Up @@ -1450,7 +1453,9 @@ namespace {
return CI.release();
}

CI->createFileManager();
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> 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;
Expand Down

0 comments on commit dbb34a4

Please sign in to comment.