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:
Arnold Schwaighofer
2020-10-09 07:34:05 -07:00
parent b994bf3191
commit 2a2cf91dcd
25 changed files with 509 additions and 81 deletions

View File

@@ -56,7 +56,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 581; // @_specialize target parameter
const uint16_t SWIFTMODULE_VERSION_MINOR = 582; // sil specialize attribute module parameter
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -1850,8 +1850,9 @@ namespace decls_block {
BCFixed<1>, // specialization kind
GenericSignatureIDField, // specialized signature
DeclIDField, // target function
BCVBR<4>, // # of arguments (+1) or zero if no name
BCArray<IdentifierIDField>
BCVBR<4>, // # of arguments (+1) or 1 if simple decl name, 0 if no target
BCVBR<4>, // # of SPI groups
BCArray<IdentifierIDField> // target function pieces, spi groups
>;
using DifferentiableDeclAttrLayout = BCRecordLayout<