File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2074,7 +2074,16 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
20742074 // from a fragile function is an error.
20752075 if (F.isSerialized ()) {
20762076 require ((SingleFunction && RefF->isExternalDeclaration ()) ||
2077- RefF->hasValidLinkageForFragileRef (),
2077+ RefF->hasValidLinkageForFragileRef () ||
2078+
2079+ // A serialized specialized function can reference another
2080+ // specialized function. In case the other specialization is already
2081+ // generated by the optimizer before the de-serialization point,
2082+ // we can end up that a shared_external function references a
2083+ // shared function. This is okay.
2084+ (F.getLinkage () == SILLinkage::SharedExternal &&
2085+ RefF->getLinkage () == SILLinkage::Shared),
2086+
20782087 " function_ref inside fragile function cannot "
20792088 " reference a private or hidden symbol" );
20802089 }
Original file line number Diff line number Diff line change @@ -511,6 +511,10 @@ void CrossModuleOptimization::makeDeclUsableFromInline(ValueDecl *decl) {
511511 if (decl->getEffectiveAccess () >= AccessLevel::Public)
512512 return ;
513513
514+ // We must not modify decls which are defined in other modules.
515+ if (M.getSwiftModule () != decl->getDeclContext ()->getParentModule ())
516+ return ;
517+
514518 if (decl->getFormalAccess () < AccessLevel::Public &&
515519 !decl->isUsableFromInline ()) {
516520 // Mark the nominal type as "usableFromInline".
You can’t perform that action at this time.
0 commit comments