Skip to content

Commit e066588

Browse files
committed
[IRGen] Temporarily treat @async @convention(c) as not async.
1 parent 128c7bc commit e066588

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,11 @@ std::unique_ptr<COrObjCEntryPointArgumentEmission>
13311331
getCOrObjCEntryPointArgumentEmission(IRGenSILFunction &IGF,
13321332
SILBasicBlock &entry,
13331333
Explosion &allParamValues) {
1334-
if (IGF.CurSILFn->isAsync()) {
1334+
if (IGF.CurSILFn->isAsync() &&
1335+
!(/*FIXME: Remove this condition once Task.runDetached is
1336+
available. rdar://problem/70597390*/
1337+
IGF.CurSILFn->getLoweredFunctionType()->getRepresentation() ==
1338+
SILFunctionTypeRepresentation::CFunctionPointer)) {
13351339
llvm_unreachable("unsupported");
13361340
} else {
13371341
return std::make_unique<SyncCOrObjCEntryPointArgumentEmission>(
@@ -3141,7 +3145,12 @@ static void emitReturnInst(IRGenSILFunction &IGF,
31413145
auto &retTI = cast<LoadableTypeInfo>(IGF.getTypeInfo(resultTy));
31423146
retTI.initialize(IGF, result, IGF.IndirectReturn, false);
31433147
IGF.Builder.CreateRetVoid();
3144-
} else if (IGF.isAsync()) {
3148+
} else if (IGF.isAsync() &&
3149+
!(/*FIXME: Remove this condition once Task.runDetached is
3150+
available. rdar://problem/70597390*/
3151+
IGF.CurSILFn->getLoweredFunctionType()
3152+
->getRepresentation() ==
3153+
SILFunctionTypeRepresentation::CFunctionPointer)) {
31453154
// If we're generating an async function, store the result into the buffer.
31463155
assert(!IGF.IndirectReturn.isValid() &&
31473156
"Formally direct results should stay direct results for async "

0 commit comments

Comments
 (0)