@@ -626,7 +626,7 @@ class AvailableAttr : public DeclAttribute {
626626
627627 AvailableAttr (SourceLoc AtLoc, SourceRange Range,
628628 PlatformKind Platform,
629- StringRef Message, StringRef Rename,
629+ StringRef Message, StringRef Rename, ValueDecl *RenameDecl,
630630 const llvm::VersionTuple &Introduced,
631631 SourceRange IntroducedRange,
632632 const llvm::VersionTuple &Deprecated,
@@ -636,7 +636,7 @@ class AvailableAttr : public DeclAttribute {
636636 PlatformAgnosticAvailabilityKind PlatformAgnostic,
637637 bool Implicit)
638638 : DeclAttribute(DAK_Available, AtLoc, Range, Implicit),
639- Message (Message), Rename(Rename),
639+ Message (Message), Rename(Rename), RenameDecl(RenameDecl),
640640 INIT_VER_TUPLE(Introduced), IntroducedRange(IntroducedRange),
641641 INIT_VER_TUPLE(Deprecated), DeprecatedRange(DeprecatedRange),
642642 INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange),
@@ -657,6 +657,12 @@ class AvailableAttr : public DeclAttribute {
657657 // / the `NS_SWIFT_NAME` annotation in Objective-C.
658658 const StringRef Rename;
659659
660+ // / The declaration referred to by \c Rename. Note that this is only set for
661+ // / deserialized attributes or inferred attributes from ObjectiveC code.
662+ // / \c ValueDecl::getRenamedDecl should be used to find the declaration
663+ // / corresponding to \c Rename.
664+ ValueDecl *RenameDecl;
665+
660666 // / Indicates when the symbol was introduced.
661667 const Optional<llvm::VersionTuple> Introduced;
662668
@@ -743,6 +749,11 @@ class AvailableAttr : public DeclAttribute {
743749 llvm::VersionTuple Obsoleted
744750 = llvm::VersionTuple());
745751
752+ // / Create an AvailableAttr that indicates the given \p AsyncFunc should be
753+ // / preferentially used in async contexts
754+ static AvailableAttr *createForAlternative (ASTContext &C,
755+ AbstractFunctionDecl *AsyncFunc);
756+
746757 AvailableAttr *clone (ASTContext &C, bool implicit) const ;
747758
748759 static bool classof (const DeclAttribute *DA) {
@@ -2041,57 +2052,6 @@ class TransposeAttr final
20412052 }
20422053};
20432054
2044- // / The `@completionHandlerAsync` attribute marks a function as having an async
2045- // / alternative, optionally providing a name (for cases when the alternative
2046- // / has a different name).
2047- class CompletionHandlerAsyncAttr final : public DeclAttribute {
2048- public:
2049- // / Reference to the async alternative function. Only set for deserialized
2050- // / attributes or inferred attributes from ObjectiveC code.
2051- AbstractFunctionDecl *AsyncFunctionDecl;
2052-
2053- // / DeclName of the async function in the attribute. Only set from actual
2054- // / Swift code, deserialization/ObjectiveC imports will set the decl instead.
2055- const DeclNameRef AsyncFunctionName;
2056-
2057- // / Source location of the async function name in the attribute
2058- const SourceLoc AsyncFunctionNameLoc;
2059-
2060- // / The index of the completion handler
2061- const size_t CompletionHandlerIndex;
2062-
2063- // / Source location of the completion handler index passed to the index
2064- const SourceLoc CompletionHandlerIndexLoc;
2065-
2066- CompletionHandlerAsyncAttr (DeclNameRef asyncFunctionName,
2067- SourceLoc asyncFunctionNameLoc,
2068- size_t completionHandlerIndex,
2069- SourceLoc completionHandlerIndexLoc,
2070- SourceLoc atLoc, SourceRange range)
2071- : DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2072- /* implicit*/ false ),
2073- AsyncFunctionDecl (nullptr ),
2074- AsyncFunctionName(asyncFunctionName),
2075- AsyncFunctionNameLoc(asyncFunctionNameLoc),
2076- CompletionHandlerIndex(completionHandlerIndex),
2077- CompletionHandlerIndexLoc(completionHandlerIndexLoc) {}
2078-
2079- CompletionHandlerAsyncAttr (AbstractFunctionDecl &asyncFunctionDecl,
2080- size_t completionHandlerIndex,
2081- SourceLoc completionHandlerIndexLoc,
2082- SourceLoc atLoc, SourceRange range,
2083- bool implicit)
2084- : DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2085- implicit),
2086- AsyncFunctionDecl(&asyncFunctionDecl) ,
2087- CompletionHandlerIndex(completionHandlerIndex),
2088- CompletionHandlerIndexLoc(completionHandlerIndexLoc) {}
2089-
2090- static bool classof (const DeclAttribute *DA) {
2091- return DA->getKind () == DAK_CompletionHandlerAsync;
2092- }
2093- };
2094-
20952055// / Attributes that may be applied to declarations.
20962056class DeclAttributes {
20972057 // / Linked list of declaration attributes.
0 commit comments