Skip to content

Commit 97c5e24

Browse files
committed
[Concurrency] Emit @asyncHandler bodies as traps.
@asyncHandler is currently unimplemented in SILGen, and will cause SIL verifier assertions if used. Rather than trigger assertions, emit a trap for the body. Obviously, this is a temporary hack.
1 parent 54144ac commit 97c5e24

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/SILGen/SILGenFunction.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,14 @@ void SILGenFunction::emitFunction(FuncDecl *fd) {
517517
fd->getResultInterfaceType(), fd->hasThrows(), fd->getThrowsLoc());
518518
prepareEpilog(true, fd->hasThrows(), CleanupLocation(fd));
519519

520-
emitStmt(fd->getTypecheckedBody());
520+
if (fd->isAsyncHandler()) {
521+
// Async handlers are need to have their bodies emitted into a
522+
// detached task.
523+
// FIXME: Actually implement these properly.
524+
B.createBuiltinTrap(fd->getTypecheckedBody());
525+
} else {
526+
emitStmt(fd->getTypecheckedBody());
527+
}
521528

522529
emitEpilog(fd);
523530

0 commit comments

Comments
 (0)