@@ -577,6 +577,16 @@ std::string LinkEntity::mangleAsString(ASTContext &Ctx) const {
577577 Result.append (" Twc" );
578578 return Result;
579579 }
580+ case Kind::CoroAllocator: {
581+ switch (getCoroAllocatorKind ()) {
582+ case CoroAllocatorKind::Stack:
583+ llvm::report_fatal_error (" attempting to mangle the coro stack allocator" );
584+ case CoroAllocatorKind::Async:
585+ return " _swift_coro_async_allocator" ;
586+ case CoroAllocatorKind::Malloc:
587+ return " _swift_coro_malloc_allocator" ;
588+ }
589+ }
580590 }
581591 llvm_unreachable (" bad entity kind!" );
582592}
@@ -948,6 +958,8 @@ SILLinkage LinkEntity::getLinkage(ForDefinition_t forDefinition) const {
948958 return getUnderlyingEntityForCoroFunctionPointer ().getLinkage (
949959 forDefinition);
950960 return getSILLinkage (getDeclLinkage (getDecl ()), forDefinition);
961+ case Kind::CoroAllocator:
962+ return SILLinkage::Shared;
951963 }
952964 llvm_unreachable (" bad link entity kind" );
953965}
@@ -1051,6 +1063,7 @@ bool LinkEntity::isContextDescriptor() const {
10511063 case Kind::CoroFunctionPointerAST:
10521064 case Kind::DistributedThunkCoroFunctionPointer:
10531065 case Kind::KnownCoroFunctionPointer:
1066+ case Kind::CoroAllocator:
10541067 return false ;
10551068 }
10561069 llvm_unreachable (" invalid descriptor" );
@@ -1188,6 +1201,8 @@ llvm::Type *LinkEntity::getDefaultDeclarationType(IRGenModule &IGM) const {
11881201 case Kind::DistributedThunkCoroFunctionPointer:
11891202 case Kind::KnownCoroFunctionPointer:
11901203 return IGM.CoroFunctionPointerPtrTy ;
1204+ case Kind::CoroAllocator:
1205+ return IGM.CoroAllocatorTy ;
11911206 default :
11921207 llvm_unreachable (" declaration LLVM type not specified" );
11931208 }
@@ -1220,6 +1235,7 @@ Alignment LinkEntity::getAlignment(IRGenModule &IGM) const {
12201235 case Kind::OpaqueTypeDescriptorRecord:
12211236 case Kind::AccessibleFunctionRecord:
12221237 case Kind::ExtendedExistentialTypeShape:
1238+ case Kind::CoroAllocator:
12231239 return Alignment (4 );
12241240 case Kind::AsyncFunctionPointer:
12251241 case Kind::DispatchThunkAsyncFunctionPointer:
@@ -1359,6 +1375,7 @@ bool LinkEntity::isText() const {
13591375 case Kind::DynamicallyReplaceableFunctionVariable:
13601376 case Kind::CanonicalSpecializedGenericTypeMetadataAccessFunction:
13611377 case Kind::ExtendedExistentialTypeShape:
1378+ case Kind::CoroAllocator:
13621379 return true ;
13631380 case Kind::ObjCClass:
13641381 case Kind::ObjCClassRef:
@@ -1520,6 +1537,7 @@ bool LinkEntity::isWeakImported(ModuleDecl *module) const {
15201537 case Kind::DifferentiabilityWitness:
15211538 case Kind::AccessibleFunctionRecord:
15221539 case Kind::ExtendedExistentialTypeShape:
1540+ case Kind::CoroAllocator:
15231541 return false ;
15241542
15251543 case Kind::AsyncFunctionPointer:
@@ -1656,6 +1674,7 @@ DeclContext *LinkEntity::getDeclContextForEmission() const {
16561674 case Kind::TypeMetadataDemanglingCacheVariable:
16571675 case Kind::NoncanonicalSpecializedGenericTypeMetadata:
16581676 case Kind::NoncanonicalSpecializedGenericTypeMetadataCacheVariable:
1677+ case Kind::CoroAllocator:
16591678 assert (isAlwaysSharedLinkage () && " kind should always be shared linkage" );
16601679 return nullptr ;
16611680
@@ -1708,6 +1727,7 @@ bool LinkEntity::isAlwaysSharedLinkage() const {
17081727 case Kind::TypeMetadataDemanglingCacheVariable:
17091728 case Kind::NoncanonicalSpecializedGenericTypeMetadata:
17101729 case Kind::NoncanonicalSpecializedGenericTypeMetadataCacheVariable:
1730+ case Kind::CoroAllocator:
17111731 return true ;
17121732
17131733 default :
0 commit comments