mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add @_neverEmitIntoClient to prohibit SIL serialization for a function
Part of the Embedded Swift linkage model, this attribute ensures that the function it applies to has a strong definition in its owning module, and that its SIL is never serialized. That way, other modules will not have access to its definition. Implements rdar://158364184.
This commit is contained in:
@@ -3575,6 +3575,12 @@ bool SILSerializer::shouldEmitFunctionBody(const SILFunction *F,
|
||||
if (F->isAvailableExternally())
|
||||
return false;
|
||||
|
||||
if (F->getDeclRef().hasDecl()) {
|
||||
if (auto decl = F->getDeclRef().getDecl())
|
||||
if (decl->isNeverEmittedIntoClient())
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we are asked to serialize everything, go ahead and do it.
|
||||
if (ShouldSerializeAll)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user