@@ -2151,19 +2151,27 @@ class TransposeAttr final
2151
2151
// / alternative, optionally providing a name (for cases when the alternative
2152
2152
// / has a different name).
2153
2153
class CompletionHandlerAsyncAttr final : public DeclAttribute {
2154
+ private:
2155
+ // / DeclName of the async function in the attribute
2156
+ const DeclNameRef AsyncFunctionName;
2157
+
2154
2158
public:
2155
2159
// / Source location of the async function name in the attribute
2156
2160
const SourceLoc AsyncFunctionNameLoc;
2157
2161
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 ;
2163
2168
2164
2169
// / The index of the completion handler
2165
2170
const size_t CompletionHandlerIndex;
2166
2171
2172
+ // / Source location of the completion handler index passed to the index
2173
+ const SourceLoc CompletionHandlerIndexLoc;
2174
+
2167
2175
// / True when the completion handler was specified explicitly
2168
2176
const bool ExplicitCompletionHandlerIndex;
2169
2177
@@ -2177,12 +2185,26 @@ class CompletionHandlerAsyncAttr final : public DeclAttribute {
2177
2185
SourceLoc atLoc, SourceRange range)
2178
2186
: DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2179
2187
/* implicit*/ false ),
2180
- AsyncFunctionNameLoc (asyncFunctionNameLoc),
2181
2188
AsyncFunctionName (asyncFunctionName),
2182
- CompletionHandlerIndexLoc(completionHandlerIndexLoc ),
2189
+ AsyncFunctionNameLoc(asyncFunctionNameLoc ),
2183
2190
CompletionHandlerIndex(completionHandlerIndex),
2191
+ CompletionHandlerIndexLoc(completionHandlerIndexLoc),
2184
2192
ExplicitCompletionHandlerIndex(explicitCompletionHandlerIndex) {}
2185
2193
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
+
2186
2208
static bool classof (const DeclAttribute *DA) {
2187
2209
return DA->getKind () == DAK_CompletionHandlerAsync;
2188
2210
}
0 commit comments