@@ -2364,6 +2364,52 @@ static ValueDecl *getEmplace(ASTContext &ctx, Identifier id) {
23642364 return builder.build (id);
23652365}
23662366
2367+ static ValueDecl *getTaskAddCancellationHandler (ASTContext &ctx,
2368+ Identifier id) {
2369+ auto extInfo = ASTExtInfoBuilder ().withNoEscape ().build ();
2370+ auto fnType = FunctionType::get ({}, ctx.TheEmptyTupleType , extInfo);
2371+ return getBuiltinFunction (ctx, id, _thin,
2372+ _parameters (_label (" handler" , fnType)),
2373+ _unsafeRawPointer);
2374+ }
2375+
2376+ static ValueDecl *getTaskRemoveCancellationHandler (ASTContext &ctx,
2377+ Identifier id) {
2378+ return getBuiltinFunction (
2379+ ctx, id, _thin, _parameters (_label (" record" , _unsafeRawPointer)), _void);
2380+ }
2381+
2382+ static ValueDecl *getTaskAddPriorityEscalationHandler (ASTContext &ctx,
2383+ Identifier id) {
2384+ std::array<AnyFunctionType::Param, 2 > params = {
2385+ AnyFunctionType::Param (ctx.getUInt8Type ()),
2386+ AnyFunctionType::Param (ctx.getUInt8Type ()),
2387+ };
2388+ // (UInt8, UInt8) -> ()
2389+ auto extInfo = ASTExtInfoBuilder ().withNoEscape ().build ();
2390+ auto *functionType =
2391+ FunctionType::get (params, ctx.TheEmptyTupleType , extInfo);
2392+ return getBuiltinFunction (ctx, id, _thin,
2393+ _parameters (_label (" handler" , functionType)),
2394+ _unsafeRawPointer);
2395+ }
2396+
2397+ static ValueDecl *getTaskRemovePriorityEscalationHandler (ASTContext &ctx,
2398+ Identifier id) {
2399+ return getBuiltinFunction (
2400+ ctx, id, _thin, _parameters (_label (" record" , _unsafeRawPointer)), _void);
2401+ }
2402+
2403+ static ValueDecl *getTaskLocalValuePush (ASTContext &ctx, Identifier id) {
2404+ return getBuiltinFunction (ctx, id, _thin, _generics (_unrestricted),
2405+ _parameters (_rawPointer, _consuming (_typeparam (0 ))),
2406+ _void);
2407+ }
2408+
2409+ static ValueDecl *getTaskLocalValuePop (ASTContext &ctx, Identifier id) {
2410+ return getBuiltinFunction (ctx, id, _thin, _parameters (), _void);
2411+ }
2412+
23672413// / An array of the overloaded builtin kinds.
23682414static const OverloadedBuiltinKind OverloadedBuiltinKinds[] = {
23692415 OverloadedBuiltinKind::None,
@@ -3452,6 +3498,24 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
34523498
34533499 case BuiltinValueKind::Emplace:
34543500 return getEmplace (Context, Id);
3501+
3502+ case BuiltinValueKind::TaskAddCancellationHandler:
3503+ return getTaskAddCancellationHandler (Context, Id);
3504+
3505+ case BuiltinValueKind::TaskRemoveCancellationHandler:
3506+ return getTaskRemoveCancellationHandler (Context, Id);
3507+
3508+ case BuiltinValueKind::TaskAddPriorityEscalationHandler:
3509+ return getTaskAddPriorityEscalationHandler (Context, Id);
3510+
3511+ case BuiltinValueKind::TaskRemovePriorityEscalationHandler:
3512+ return getTaskRemovePriorityEscalationHandler (Context, Id);
3513+
3514+ case BuiltinValueKind::TaskLocalValuePush:
3515+ return getTaskLocalValuePush (Context, Id);
3516+
3517+ case BuiltinValueKind::TaskLocalValuePop:
3518+ return getTaskLocalValuePop (Context, Id);
34553519 }
34563520
34573521 llvm_unreachable (" bad builtin value!" );
@@ -3815,3 +3879,7 @@ BuiltinFixedArrayType::isFixedNegativeSize() const {
38153879 }
38163880 return false ;
38173881}
3882+
3883+ ValueDecl *swift::getBuiltinValueDecl (ASTContext &Context, StringRef Name) {
3884+ return getBuiltinValueDecl (Context, Context.getIdentifier (Name));
3885+ }
0 commit comments