diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-04-29 10:24:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-29 10:24:38 -0700 |
commit | 0f90a7b323bcaa087be31aa135b71694db2d5ff9 (patch) | |
tree | 113c832b4b549d1a0cb7b8ba3451c7353417ab1e /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 82c036e2de4eba0e286a94c9b3240e4b14d8aee4 (diff) | |
download | llvm-0f90a7b323bcaa087be31aa135b71694db2d5ff9.zip llvm-0f90a7b323bcaa087be31aa135b71694db2d5ff9.tar.gz llvm-0f90a7b323bcaa087be31aa135b71694db2d5ff9.tar.bz2 |
[clang] Enable making the `CompilerInstance` module dependency collector thread-safe (#137227)
The same principle as #135473, #135737, #136178, #136601 & #137059.
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 2d6ab87..cbc9c9d 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1257,10 +1257,14 @@ std::unique_ptr<CompilerInstance> CompilerInstance::cloneForModuleCompileImpl( Instance.GetDependencyDirectives = GetDependencyDirectives->cloneFor(Instance.getFileManager()); - // If we're collecting module dependencies, we need to share a collector - // between all of the module CompilerInstances. Other than that, we don't - // want to produce any dependency output from the module build. - Instance.setModuleDepCollector(getModuleDepCollector()); + if (ThreadSafeConfig) { + Instance.setModuleDepCollector(ThreadSafeConfig->getModuleDepCollector()); + } else { + // If we're collecting module dependencies, we need to share a collector + // between all of the module CompilerInstances. Other than that, we don't + // want to produce any dependency output from the module build. + Instance.setModuleDepCollector(getModuleDepCollector()); + } Inv.getDependencyOutputOpts() = DependencyOutputOptions(); return InstancePtr; |