[clang] [llvm] [ThinLTO] Apply -vfsoverlay to distributed backend inputs (PR #236610)
Anton Yartsev via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 15:12:15 PST 2026
================
@@ -455,6 +455,16 @@ CodeGenAction::loadModule(MemoryBufferRef MBRef) {
Bm->parseModule(*VMContext);
if (!MOrErr)
return DiagErrors(MOrErr.takeError());
+ // The ThinLTO index identifies this module by the path given on the
+ // command line. With a VFS overlay that uses 'use-external-names', the
+ // FileManager renames the main file to its external path (see the FIXME in
+ // FileManager::getFileRefImpl), and BitcodeReader takes the module
+ // identifier from it. As a result, the module does not match its index
+ // entry, and the ThinLTO backend mishandles it.
+ // We restore the requested name so the module matches its index entry.
+ if (OptionalFileEntryRef FE = SM.getFileEntryRefForID(SM.getMainFileID()))
+ if (FE->getName() != FE->getNameAsRequested())
+ (*MOrErr)->setModuleIdentifier(FE->getNameAsRequested());
----------------
ayartsev7 wrote:
Done in 48ee8dc.
https://github.com/llvm/llvm-project/pull/236610
More information about the cfe-commits
mailing list