Skip to content

Commit 2443063

Browse files
committed
SILVerifier: allow that a shared_external function references a shared function.
A serialized specialized function can reference another specialized function. In case the other specialization is already generated by the optimizer before the de-serialization point, we can end up that a shared_external function references a shared function. This is okay.
1 parent 2baed0e commit 2443063

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)