@@ -626,7 +626,7 @@ class AvailableAttr : public DeclAttribute {
626
626
627
627
AvailableAttr (SourceLoc AtLoc, SourceRange Range,
628
628
PlatformKind Platform,
629
- StringRef Message, StringRef Rename,
629
+ StringRef Message, StringRef Rename, ValueDecl *RenameDecl,
630
630
const llvm::VersionTuple &Introduced,
631
631
SourceRange IntroducedRange,
632
632
const llvm::VersionTuple &Deprecated,
@@ -636,7 +636,7 @@ class AvailableAttr : public DeclAttribute {
636
636
PlatformAgnosticAvailabilityKind PlatformAgnostic,
637
637
bool Implicit)
638
638
: DeclAttribute(DAK_Available, AtLoc, Range, Implicit),
639
- Message (Message), Rename(Rename),
639
+ Message (Message), Rename(Rename), RenameDecl(RenameDecl),
640
640
INIT_VER_TUPLE(Introduced), IntroducedRange(IntroducedRange),
641
641
INIT_VER_TUPLE(Deprecated), DeprecatedRange(DeprecatedRange),
642
642
INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange),
@@ -657,6 +657,12 @@ class AvailableAttr : public DeclAttribute {
657
657
// / the `NS_SWIFT_NAME` annotation in Objective-C.
658
658
const StringRef Rename;
659
659
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
+
660
666
// / Indicates when the symbol was introduced.
661
667
const Optional<llvm::VersionTuple> Introduced;
662
668
@@ -743,6 +749,11 @@ class AvailableAttr : public DeclAttribute {
743
749
llvm::VersionTuple Obsoleted
744
750
= llvm::VersionTuple());
745
751
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
+
746
757
AvailableAttr *clone (ASTContext &C, bool implicit) const ;
747
758
748
759
static bool classof (const DeclAttribute *DA) {
@@ -2041,57 +2052,6 @@ class TransposeAttr final
2041
2052
}
2042
2053
};
2043
2054
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
-
2095
2055
// / Attributes that may be applied to declarations.
2096
2056
class DeclAttributes {
2097
2057
// / Linked list of declaration attributes.
0 commit comments