Support Package CMO

* Add a new flag -experimental-package-cmo that requires -experimental-allow-non-resilient-access.
* Support serializing package decls for CMO in package if enabled.
* Only applies to default mode CMO.
* Unlike the existing CMO, package CMO can be built with -enable-library-evolution as package
modules are required to be built together in the same project.
* Create hasPublicOrPackageVisibility to opt in for package decls; needed for CMO, SILVerifier,
and other call sites that verify or determine codegen.

Resolves rdar://121976014
This commit is contained in:
Ellie Shin
2024-03-06 20:46:22 -08:00
parent 8df1abe111
commit a3250e426d
14 changed files with 325 additions and 21 deletions

View File

@@ -898,8 +898,8 @@ bool SILFunction::hasValidLinkageForFragileRef() const {
isAvailableExternally())
return false;
// Otherwise, only public functions can be referenced.
return hasPublicVisibility(getLinkage());
// Otherwise, only public or package functions can be referenced.
return hasPublicOrPackageVisibility(getLinkage(), getModule().getOptions().EnableSerializePackage);
}
bool