Replace @completionHandlerAsync with @available(*, renamed:)

Instead of a new attribute `@completionHandlerAsync`, allow the use of
the existing `renamed` parameter of `@available` to specify the
asynchronous alternative of a synchronous function.

No errors will be output from invalid names as `@completionHandlerAsync`
had, but if a function is correctly matched then it will be used to
output warnings when using the synchronous function in an asynchronous
context (as before).

Resolves rdar://80612731
This commit is contained in:
Ben Barham
2021-07-14 15:45:02 +10:00
parent ebd820c5ee
commit e7e9b57051
31 changed files with 649 additions and 816 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 = 619; // builtin protocol conformances
const uint16_t SWIFTMODULE_VERSION_MINOR = 620; // use @available(renamed:) for async alternative warning
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -1881,10 +1881,11 @@ namespace decls_block {
BC_AVAIL_TUPLE, // Introduced
BC_AVAIL_TUPLE, // Deprecated
BC_AVAIL_TUPLE, // Obsoleted
BCVBR<5>, // platform
BCVBR<5>, // number of bytes in message string
BCVBR<5>, // number of bytes in rename string
BCBlob // platform, followed by message
BCVBR<5>, // platform
DeclIDField, // rename declaration (if any)
BCVBR<5>, // number of bytes in message string
BCVBR<5>, // number of bytes in rename string
BCBlob // message, followed by rename
>;
using OriginallyDefinedInDeclAttrLayout = BCRecordLayout<
@@ -1942,13 +1943,6 @@ namespace decls_block {
BCArray<BCFixed<1>> // Transposed parameter indices' bitvector.
>;
using CompletionHandlerAsyncDeclAttrLayout = BCRecordLayout<
CompletionHandlerAsync_DECL_ATTR,
BCFixed<1>, // Implicit flag.
BCVBR<5>, // Completion handler index
DeclIDField // Mapped async function decl
>;
#define SIMPLE_DECL_ATTR(X, CLASS, ...) \
using CLASS##DeclAttrLayout = BCRecordLayout< \
CLASS##_DECL_ATTR, \