[clang] Reland "[clang][modules-driver] Add support for C++ named modules and import std" (2nd attempt) (PR #194475)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 10:50:25 PDT 2026
jansvoboda11 wrote:
> > Is there some race-condition going on for the clang/test/Driver/modules-driver-both-modules-types.cpp testcase?
> > I've randomly seen
> > ```
> > clang: ../../clang/lib/DependencyScanning/InProcessModuleCache.cpp:148: virtual std::error_code {anonymous}::InProcessModuleCache::write(llvm::StringRef, llvm::MemoryBufferRef, off_t&, time_t&): Assertion `Entry.Buffer && *Entry.Buffer == Buffer && "Wrote the same PCM with different contents"' failed.
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > in one of our downstream build bots when running that testcase.
>
> Pinging @jansvoboda11 for his expertise on InProcessModuleCache. I would have time to look into this using tsan after work today otherwise.
I added that assertion recently. Essentially it only fires if the scanner wrote two different PCMs to the same path within single scanning service lifetime. This may happen if the FS changes, which we should be mostly protected from by the caching VFS. The other cause could be a collision in the strict context hash, where we're scanning the module with two different compiler invocations but some of the options are not contributing to the context hash even though the may change the PCM contents. My first guess would be we don't do this for reduced BMIs, or something specific to C++ modules, because I haven't seen this on pure ObjC scans before.
https://github.com/llvm/llvm-project/pull/194475
More information about the cfe-commits
mailing list