@@ -2151,19 +2151,27 @@ class TransposeAttr final
21512151// / alternative, optionally providing a name (for cases when the alternative
21522152// / has a different name).
21532153class CompletionHandlerAsyncAttr final : public DeclAttribute {
2154+ private:
2155+ // / DeclName of the async function in the attribute
2156+ const DeclNameRef AsyncFunctionName;
2157+
21542158public:
21552159 // / Source location of the async function name in the attribute
21562160 const SourceLoc AsyncFunctionNameLoc;
21572161
2158- // / DeclName of the async function in the attribute
2159- const DeclNameRef AsyncFunctionName;
2160-
2161- // / Source location of the completion handler index passed to the index
2162- const SourceLoc CompletionHandlerIndexLoc;
2162+ // / Get the name of the async function
2163+ // /
2164+ // / The name will come from the AsyncFunctionDecl if available, otherwise will
2165+ // / fall back on the user-provided name. If that is not defined, this function
2166+ // / will abort.
2167+ DeclNameRef getAsyncFunctionName () const ;
21632168
21642169 // / The index of the completion handler
21652170 const size_t CompletionHandlerIndex;
21662171
2172+ // / Source location of the completion handler index passed to the index
2173+ const SourceLoc CompletionHandlerIndexLoc;
2174+
21672175 // / True when the completion handler was specified explicitly
21682176 const bool ExplicitCompletionHandlerIndex;
21692177
@@ -2177,12 +2185,26 @@ class CompletionHandlerAsyncAttr final : public DeclAttribute {
21772185 SourceLoc atLoc, SourceRange range)
21782186 : DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
21792187 /* implicit*/ false ),
2180- AsyncFunctionNameLoc (asyncFunctionNameLoc),
21812188 AsyncFunctionName (asyncFunctionName),
2182- CompletionHandlerIndexLoc(completionHandlerIndexLoc ),
2189+ AsyncFunctionNameLoc(asyncFunctionNameLoc ),
21832190 CompletionHandlerIndex(completionHandlerIndex),
2191+ CompletionHandlerIndexLoc(completionHandlerIndexLoc),
21842192 ExplicitCompletionHandlerIndex(explicitCompletionHandlerIndex) {}
21852193
2194+ CompletionHandlerAsyncAttr (AbstractFunctionDecl &asyncFunctionDecl,
2195+ bool explicitCompletionHandlerIndex,
2196+ size_t completionHandlerIndex,
2197+ SourceLoc completionHandlerIndexLoc,
2198+ SourceLoc atLoc, SourceRange range)
2199+ : DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2200+ /* implicit*/ false ),
2201+ CompletionHandlerIndex(completionHandlerIndex),
2202+ CompletionHandlerIndexLoc(completionHandlerIndexLoc),
2203+ ExplicitCompletionHandlerIndex(explicitCompletionHandlerIndex),
2204+ AsyncFunctionDecl(&asyncFunctionDecl) {}
2205+
2206+
2207+
21862208 static bool classof (const DeclAttribute *DA) {
21872209 return DA->getKind () == DAK_CompletionHandlerAsync;
21882210 }
0 commit comments