@@ -130,8 +130,8 @@ class LinkEntity {
130
130
// / is a ConstructorDecl* inside a class.
131
131
DispatchThunkInitializer,
132
132
133
- // / A method dispatch thunk for an allocating constructor. The pointer is a
134
- // / ConstructorDecl* inside a protocol or a class.
133
+ // / A method dispatch thunk for an allocating constructor. The pointer is
134
+ // / a ConstructorDecl* inside a protocol or a class.
135
135
DispatchThunkAllocator,
136
136
137
137
// / A method descriptor. The pointer is a FuncDecl* inside a protocol
@@ -295,7 +295,7 @@ class LinkEntity {
295
295
296
296
// / The same as AsyncFunctionPointer but with a different stored value, for
297
297
// / use by TBDGen.
298
- // / The pointer is a AbstractStorageDecl *.
298
+ // / The pointer is an AbstractFunctionDecl *.
299
299
AsyncFunctionPointerAST,
300
300
301
301
// / The pointer is a SILFunction*.
@@ -861,7 +861,8 @@ class LinkEntity {
861
861
}
862
862
863
863
static LinkEntity
864
- forSILFunction (SILFunction *F, bool IsDynamicallyReplaceableImplementation) {
864
+ forSILFunction (SILFunction *F,
865
+ bool IsDynamicallyReplaceableImplementation=false ) {
865
866
LinkEntity entity;
866
867
entity.Pointer = F;
867
868
entity.SecondaryPointer = nullptr ;
@@ -1100,12 +1101,21 @@ class LinkEntity {
1100
1101
return entity;
1101
1102
}
1102
1103
1103
- static LinkEntity forAsyncFunctionPointer (SILFunction *silFunction ) {
1104
+ static LinkEntity forAsyncFunctionPointer (LinkEntity other ) {
1104
1105
LinkEntity entity;
1105
- entity.Pointer = silFunction;
1106
- entity.SecondaryPointer = nullptr ;
1107
- entity.Data = LINKENTITY_SET_FIELD (
1108
- Kind, unsigned (LinkEntity::Kind::AsyncFunctionPointer));
1106
+
1107
+ switch (other.getKind ()) {
1108
+ case LinkEntity::Kind::SILFunction:
1109
+ entity.Pointer = other.getSILFunction ();
1110
+ entity.SecondaryPointer = nullptr ;
1111
+ entity.Data = LINKENTITY_SET_FIELD (
1112
+ Kind, unsigned (LinkEntity::Kind::AsyncFunctionPointer));
1113
+ break ;
1114
+
1115
+ default :
1116
+ llvm_unreachable (" Link entity kind cannot have an async function pointer" );
1117
+ }
1118
+
1109
1119
return entity;
1110
1120
}
1111
1121
0 commit comments