Support package SIL linkage.

Decls with a package access level are currently set to public SIL
linkages. This limits the ability to have more fine-grained control
and optimize around resilience and serialization.
This PR introduces a separate SIL linkage and FormalLinkage for
package decls, pipes them down to IRGen, and updates linkage checks
at call sites to include package linkage.

Resolves rdar://121409846
This commit is contained in:
Ellie Shin
2024-01-22 19:53:12 -08:00
parent 1707e76ba8
commit 72a7760027
42 changed files with 1135 additions and 648 deletions

View File

@@ -309,8 +309,9 @@ SILFunction *SILFunctionBuilder::getOrCreateFunction(
assert(mod.getStage() == SILStage::Raw || fn->getLinkage() == linkage ||
(forDefinition == ForDefinition_t::NotForDefinition &&
(fnLinkage == linkageForDef ||
(linkageForDef == SILLinkage::PublicNonABI &&
fnLinkage == SILLinkage::Shared))));
(linkageForDef == SILLinkage::PublicNonABI ||
linkageForDef == SILLinkage::PackageNonABI) &&
fnLinkage == SILLinkage::Shared)));
if (forDefinition) {
// In all the cases where getConstantLinkage returns something
// different for ForDefinition, it returns an available-externally