@@ -629,7 +629,7 @@ class AvailableAttr : public DeclAttribute {
629
629
630
630
AvailableAttr (SourceLoc AtLoc, SourceRange Range,
631
631
PlatformKind Platform,
632
- StringRef Message, StringRef Rename,
632
+ StringRef Message, StringRef Rename, ValueDecl *RenameDecl,
633
633
const llvm::VersionTuple &Introduced,
634
634
SourceRange IntroducedRange,
635
635
const llvm::VersionTuple &Deprecated,
@@ -639,7 +639,7 @@ class AvailableAttr : public DeclAttribute {
639
639
PlatformAgnosticAvailabilityKind PlatformAgnostic,
640
640
bool Implicit)
641
641
: DeclAttribute(DAK_Available, AtLoc, Range, Implicit),
642
- Message (Message), Rename(Rename),
642
+ Message (Message), Rename(Rename), RenameDecl(RenameDecl),
643
643
INIT_VER_TUPLE(Introduced), IntroducedRange(IntroducedRange),
644
644
INIT_VER_TUPLE(Deprecated), DeprecatedRange(DeprecatedRange),
645
645
INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange),
@@ -660,6 +660,12 @@ class AvailableAttr : public DeclAttribute {
660
660
// / the `NS_SWIFT_NAME` annotation in Objective-C.
661
661
const StringRef Rename;
662
662
663
+ // / The declaration referred to by \c Rename. Note that this is only set for
664
+ // / deserialized attributes or inferred attributes from ObjectiveC code.
665
+ // / \c ValueDecl::getRenamedDecl should be used to find the declaration
666
+ // / corresponding to \c Rename.
667
+ ValueDecl *RenameDecl;
668
+
663
669
// / Indicates when the symbol was introduced.
664
670
const Optional<llvm::VersionTuple> Introduced;
665
671
@@ -746,6 +752,11 @@ class AvailableAttr : public DeclAttribute {
746
752
llvm::VersionTuple Obsoleted
747
753
= llvm::VersionTuple());
748
754
755
+ // / Create an AvailableAttr that indicates the given \p AsyncFunc should be
756
+ // / preferentially used in async contexts
757
+ static AvailableAttr *createForAlternative (ASTContext &C,
758
+ AbstractFunctionDecl *AsyncFunc);
759
+
749
760
AvailableAttr *clone (ASTContext &C, bool implicit) const ;
750
761
751
762
static bool classof (const DeclAttribute *DA) {
@@ -2021,57 +2032,6 @@ class TransposeAttr final
2021
2032
}
2022
2033
};
2023
2034
2024
- // / The `@completionHandlerAsync` attribute marks a function as having an async
2025
- // / alternative, optionally providing a name (for cases when the alternative
2026
- // / has a different name).
2027
- class CompletionHandlerAsyncAttr final : public DeclAttribute {
2028
- public:
2029
- // / Reference to the async alternative function. Only set for deserialized
2030
- // / attributes or inferred attributes from ObjectiveC code.
2031
- AbstractFunctionDecl *AsyncFunctionDecl;
2032
-
2033
- // / DeclName of the async function in the attribute. Only set from actual
2034
- // / Swift code, deserialization/ObjectiveC imports will set the decl instead.
2035
- const DeclNameRef AsyncFunctionName;
2036
-
2037
- // / Source location of the async function name in the attribute
2038
- const SourceLoc AsyncFunctionNameLoc;
2039
-
2040
- // / The index of the completion handler
2041
- const size_t CompletionHandlerIndex;
2042
-
2043
- // / Source location of the completion handler index passed to the index
2044
- const SourceLoc CompletionHandlerIndexLoc;
2045
-
2046
- CompletionHandlerAsyncAttr (DeclNameRef asyncFunctionName,
2047
- SourceLoc asyncFunctionNameLoc,
2048
- size_t completionHandlerIndex,
2049
- SourceLoc completionHandlerIndexLoc,
2050
- SourceLoc atLoc, SourceRange range)
2051
- : DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2052
- /* implicit*/ false ),
2053
- AsyncFunctionDecl (nullptr ),
2054
- AsyncFunctionName(asyncFunctionName),
2055
- AsyncFunctionNameLoc(asyncFunctionNameLoc),
2056
- CompletionHandlerIndex(completionHandlerIndex),
2057
- CompletionHandlerIndexLoc(completionHandlerIndexLoc) {}
2058
-
2059
- CompletionHandlerAsyncAttr (AbstractFunctionDecl &asyncFunctionDecl,
2060
- size_t completionHandlerIndex,
2061
- SourceLoc completionHandlerIndexLoc,
2062
- SourceLoc atLoc, SourceRange range,
2063
- bool implicit)
2064
- : DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2065
- implicit),
2066
- AsyncFunctionDecl(&asyncFunctionDecl) ,
2067
- CompletionHandlerIndex(completionHandlerIndex),
2068
- CompletionHandlerIndexLoc(completionHandlerIndexLoc) {}
2069
-
2070
- static bool classof (const DeclAttribute *DA) {
2071
- return DA->getKind () == DAK_CompletionHandlerAsync;
2072
- }
2073
- };
2074
-
2075
2035
// / Attributes that may be applied to declarations.
2076
2036
class DeclAttributes {
2077
2037
// / Linked list of declaration attributes.
0 commit comments