File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -839,16 +839,23 @@ class CompilerInstance : public ModuleLoader {
839839 class ThreadSafeCloneConfig {
840840 IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;
841841 DiagnosticConsumer &DiagConsumer;
842+ std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector;
842843
843844 public:
844- ThreadSafeCloneConfig (IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
845- DiagnosticConsumer &DiagConsumer)
846- : VFS(std::move(VFS)), DiagConsumer(DiagConsumer) {
845+ ThreadSafeCloneConfig (
846+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
847+ DiagnosticConsumer &DiagConsumer,
848+ std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector = nullptr )
849+ : VFS(std::move(VFS)), DiagConsumer(DiagConsumer),
850+ ModuleDepCollector (std::move(ModuleDepCollector)) {
847851 assert (this ->VFS && " Clone config requires non-null VFS" );
848852 }
849853
850854 IntrusiveRefCntPtr<llvm::vfs::FileSystem> getVFS () const { return VFS; }
851855 DiagnosticConsumer &getDiagConsumer () const { return DiagConsumer; }
856+ std::shared_ptr<ModuleDependencyCollector> getModuleDepCollector () const {
857+ return ModuleDepCollector;
858+ }
852859 };
853860
854861private:
Original file line number Diff line number Diff line change @@ -1257,10 +1257,14 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl(
12571257 Instance.GetDependencyDirectives =
12581258 GetDependencyDirectives->cloneFor (Instance.getFileManager ());
12591259
1260- // If we're collecting module dependencies, we need to share a collector
1261- // between all of the module CompilerInstances. Other than that, we don't
1262- // want to produce any dependency output from the module build.
1263- Instance.setModuleDepCollector (getModuleDepCollector ());
1260+ if (ThreadSafeConfig) {
1261+ Instance.setModuleDepCollector (ThreadSafeConfig->getModuleDepCollector ());
1262+ } else {
1263+ // If we're collecting module dependencies, we need to share a collector
1264+ // between all of the module CompilerInstances. Other than that, we don't
1265+ // want to produce any dependency output from the module build.
1266+ Instance.setModuleDepCollector (getModuleDepCollector ());
1267+ }
12641268 Inv.getDependencyOutputOpts () = DependencyOutputOptions ();
12651269
12661270 return InstancePtr;
You can’t perform that action at this time.
0 commit comments