Serialize library level into .swiftmodule binary format

Add a LIBRARY_LEVEL record to the .swiftmodule options block so the
declared -library-level value survives across compilations. Without
this, imported modules have to always fell back to a path heuristic
that could only distinguish API vs SPI and never returned IPI.

rdar://174255626
This commit is contained in:
Sam Pyankov
2026-04-07 14:57:38 -07:00
parent abdfecea08
commit a09cf04718
16 changed files with 129 additions and 19 deletions
@@ -997,6 +997,7 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
M.setDeferredCodeGen();
if (loadedModuleFile->isAggressiveCMOEnabled())
M.setAggressiveCMOEnabled();
M.setStoredLibraryLevel(loadedModuleFile->getLibraryLevel());
if (loadedModuleFile->hasCxxInteroperability()) {
M.setHasCxxInteroperability();
M.setCXXStdlibKind(loadedModuleFile->getCXXStdlibKind());