[clang] [clang] Enable making `CompilerInstance` diagnostics thread-safe (PR #136601)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 21 14:22:48 PDT 2025
================
@@ -861,9 +864,13 @@ class CompilerInstance : public ModuleLoader {
///
/// Explicitly-specified \c VFS takes precedence over the VFS of this instance
/// when creating the clone and also prevents \c FileManager sharing.
- std::unique_ptr<CompilerInstance> cloneForModuleCompile(
- SourceLocation ImportLoc, Module *Module, StringRef ModuleFileName,
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
+ /// Explicitly-specified \c DiagConsumer takes precedence over forwarding to
+ /// this instance.
+ std::unique_ptr<CompilerInstance>
+ cloneForModuleCompile(SourceLocation ImportLoc, Module *Module,
+ StringRef ModuleFileName,
+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr,
+ DiagnosticConsumer *DiagConsumer = nullptr);
----------------
jansvoboda11 wrote:
I think it makes sense, since they are fairly orthogonal. On the other hand, I don't have an actual use for that. Maybe I can package both of these into a simple struct (`ThreadSafetyConfig`?) and pass that in `std::optional`. That'd make things much more explicit than just asserts. WDYT?
https://github.com/llvm/llvm-project/pull/136601
More information about the cfe-commits
mailing list