Currently when checking if resilience check can be bypassed within a package,

we only check if the loaded module is built from a package interface. This is
not enough as a binary module could just contain exportable decls if built with
experimental-skip-non-exportable-decls, essentially resulting in content equivalent
to interface content. This might be made a default behavior so this PR requires
a module to opt in to allow non-resilient access by a participating client in the
same package.

Since it affects module format, SWIFTMODULE_VERSION_MINOR is updated.

rdar://123651270
This commit is contained in:
Ellie Shin
2024-02-22 18:10:07 -08:00
parent 70cf5d4783
commit 30669fca65
19 changed files with 158 additions and 15 deletions

View File

@@ -197,6 +197,9 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
case options_block::HAS_CXX_INTEROPERABILITY_ENABLED:
extendedInfo.setHasCxxInteroperability(true);
break;
case options_block::ALLOW_NON_RESILIENT_ACCESS:
extendedInfo.setAllowNonResilientAccess(true);
break;
default:
// Unknown options record, possibly for use by a future version of the
// module format.
@@ -695,6 +698,8 @@ void ModuleFileSharedCore::outputDiagnosticInfo(llvm::raw_ostream &os) const {
<< "', built from "
<< (Bits.IsBuiltFromInterface? "swiftinterface": "source")
<< ", " << (resilient? "resilient": "non-resilient");
if (Bits.AllowNonResilientAccess)
os << ", built with -experimental-allow-non-resilient-access";
if (Bits.IsAllowModuleWithCompilerErrorsEnabled)
os << ", built with -experimental-allow-module-with-compiler-errors";
if (ModuleInputBuffer)
@@ -1457,6 +1462,7 @@ ModuleFileSharedCore::ModuleFileSharedCore(
extInfo.isAllowModuleWithCompilerErrorsEnabled();
Bits.IsConcurrencyChecked = extInfo.isConcurrencyChecked();
Bits.HasCxxInteroperability = extInfo.hasCxxInteroperability();
Bits.AllowNonResilientAccess = extInfo.allowNonResilientAccess();
MiscVersion = info.miscVersion;
ModuleABIName = extInfo.getModuleABIName();
ModulePackageName = extInfo.getModulePackageName();