File tree 2 files changed +18
-7
lines changed
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 {
839
839
class ThreadSafeCloneConfig {
840
840
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;
841
841
DiagnosticConsumer &DiagConsumer;
842
+ std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector;
842
843
843
844
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)) {
847
851
assert (this ->VFS && " Clone config requires non-null VFS" );
848
852
}
849
853
850
854
IntrusiveRefCntPtr<llvm::vfs::FileSystem> getVFS () const { return VFS; }
851
855
DiagnosticConsumer &getDiagConsumer () const { return DiagConsumer; }
856
+ std::shared_ptr<ModuleDependencyCollector> getModuleDepCollector () const {
857
+ return ModuleDepCollector;
858
+ }
852
859
};
853
860
854
861
private:
Original file line number Diff line number Diff line change @@ -1257,10 +1257,14 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl(
1257
1257
Instance.GetDependencyDirectives =
1258
1258
GetDependencyDirectives->cloneFor (Instance.getFileManager ());
1259
1259
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
+ }
1264
1268
Inv.getDependencyOutputOpts () = DependencyOutputOptions ();
1265
1269
1266
1270
return InstancePtr;
You can’t perform that action at this time.
0 commit comments