mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add support for marking a _specialize attribute as SPI
```
@_specialize(exported: true, spi: SPIGroupName, where T == Int)
public func myFunc() { }
```
The specialized entry point is only visible for modules that import
using `_spi(SPIGroupName) import ModuleDefiningMyFunc `.
rdar://64993425
This commit is contained in:
@@ -33,20 +33,22 @@ using namespace Lowering;
|
||||
|
||||
SILSpecializeAttr::SILSpecializeAttr(bool exported, SpecializationKind kind,
|
||||
GenericSignature specializedSig,
|
||||
SILFunction *target)
|
||||
SILFunction *target, Identifier spiGroup,
|
||||
const ModuleDecl *spiModule)
|
||||
: kind(kind), exported(exported), specializedSignature(specializedSig),
|
||||
targetFunction(target) {
|
||||
if (targetFunction)
|
||||
targetFunction->incrementRefCount();
|
||||
}
|
||||
spiGroup(spiGroup), spiModule(spiModule), targetFunction(target) {
|
||||
if (targetFunction)
|
||||
targetFunction->incrementRefCount();
|
||||
}
|
||||
|
||||
SILSpecializeAttr *SILSpecializeAttr::create(SILModule &M,
|
||||
GenericSignature specializedSig,
|
||||
bool exported,
|
||||
SpecializationKind kind,
|
||||
SILFunction *target) {
|
||||
SILSpecializeAttr *
|
||||
SILSpecializeAttr::create(SILModule &M, GenericSignature specializedSig,
|
||||
bool exported, SpecializationKind kind,
|
||||
SILFunction *target, Identifier spiGroup,
|
||||
const ModuleDecl *spiModule) {
|
||||
void *buf = M.allocate(sizeof(SILSpecializeAttr), alignof(SILSpecializeAttr));
|
||||
return ::new (buf) SILSpecializeAttr(exported, kind, specializedSig, target);
|
||||
return ::new (buf) SILSpecializeAttr(exported, kind, specializedSig, target,
|
||||
spiGroup, spiModule);
|
||||
}
|
||||
|
||||
void SILFunction::addSpecializeAttr(SILSpecializeAttr *Attr) {
|
||||
|
||||
Reference in New Issue
Block a user