@@ -1153,8 +1153,7 @@ static Language getLanguageFromOptions(const LangOptions &LangOpts) {
11531153std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl (
11541154 SourceLocation ImportLoc, StringRef ModuleName, FrontendInputFile Input,
11551155 StringRef OriginalModuleMapFile, StringRef ModuleFileName,
1156- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
1157- DiagnosticConsumer *DiagConsumer) {
1156+ std::optional<ThreadSafeCloneConfig> ThreadSafeConfig) {
11581157 // Construct a compiler invocation for creating this module.
11591158 auto Invocation = std::make_shared<CompilerInvocation>(getInvocation ());
11601159
@@ -1214,16 +1213,17 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl(
12141213 auto &Inv = *Invocation;
12151214 Instance.setInvocation (std::move (Invocation));
12161215
1217- if (VFS ) {
1218- Instance.createFileManager (std::move (VFS ));
1216+ if (ThreadSafeConfig ) {
1217+ Instance.createFileManager (ThreadSafeConfig-> getVFS ( ));
12191218 } else if (FrontendOpts.ModulesShareFileManager ) {
12201219 Instance.setFileManager (&getFileManager ());
12211220 } else {
12221221 Instance.createFileManager (&getVirtualFileSystem ());
12231222 }
12241223
1225- if (DiagConsumer) {
1226- Instance.createDiagnostics (Instance.getVirtualFileSystem (), DiagConsumer,
1224+ if (ThreadSafeConfig) {
1225+ Instance.createDiagnostics (Instance.getVirtualFileSystem (),
1226+ &ThreadSafeConfig->getDiagConsumer (),
12271227 /* ShouldOwnClient=*/ false );
12281228 } else {
12291229 Instance.createDiagnostics (
@@ -1328,8 +1328,7 @@ static OptionalFileEntryRef getPublicModuleMap(FileEntryRef File,
13281328
13291329std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompile (
13301330 SourceLocation ImportLoc, Module *Module, StringRef ModuleFileName,
1331- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
1332- DiagnosticConsumer *DiagConsumer) {
1331+ std::optional<ThreadSafeCloneConfig> ThreadSafeConfig) {
13331332 StringRef ModuleName = Module->getTopLevelModuleName ();
13341333
13351334 InputKind IK (getLanguageFromOptions (getLangOpts ()), InputKind::ModuleMap);
@@ -1375,7 +1374,7 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompile(
13751374 ImportLoc, ModuleName,
13761375 FrontendInputFile (ModuleMapFilePath, IK, IsSystem),
13771376 ModMap.getModuleMapFileForUniquing (Module)->getName (), ModuleFileName,
1378- std::move (VFS), DiagConsumer );
1377+ std::move (ThreadSafeConfig) );
13791378 }
13801379
13811380 // FIXME: We only need to fake up an input file here as a way of
@@ -1393,7 +1392,7 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompile(
13931392 ImportLoc, ModuleName,
13941393 FrontendInputFile (FakeModuleMapFile, IK, +Module->IsSystem ),
13951394 ModMap.getModuleMapFileForUniquing (Module)->getName (), ModuleFileName,
1396- std::move (VFS), DiagConsumer );
1395+ std::move (ThreadSafeConfig) );
13971396
13981397 std::unique_ptr<llvm::MemoryBuffer> ModuleMapBuffer =
13991398 llvm::MemoryBuffer::getMemBufferCopy (InferredModuleMapContent);
0 commit comments