Centralize computation of the "code generation model" for object code & SIL

For a given function, we might end up emitting it's definition as
object code, serialized SIL, or both. The @export, @inlinable, and
@inline(always) attributes provide control of this behavior at the
declaration level.

Centralize the query function that will look for each of these
attributes and map down to a specific "code generation model", whose 3
options follow the naming from SE-0497: interface, inlinable, and
implementation. Use this one computation to back the queries for
"always emit into client", "never emit into client", and "inlinable"
so we can't get inconsistent results from places that are doing
one-off checks for these attributes.
This commit is contained in:
Doug Gregor
2026-04-06 14:13:31 -07:00
parent 60bde9015e
commit 8713c13bef
17 changed files with 218 additions and 86 deletions
+1 -2
View File
@@ -993,8 +993,7 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
M.setIsConcurrencyChecked();
if (loadedModuleFile->strictMemorySafety())
M.setStrictMemorySafety();
if (loadedModuleFile->deferredCodeGen())
M.setDeferredCodeGen();
M.setCodeGenerationModel(loadedModuleFile->codeGenerationModel());
if (loadedModuleFile->isAggressiveCMOEnabled())
M.setAggressiveCMOEnabled();
M.setStoredLibraryLevel(loadedModuleFile->getLibraryLevel());