[coroutines] Fix leak in CGCoroutine.cpp

FinalBB need to be emitted even when unused to make sure it is deleted

llvm-svn: 303714
This commit is contained in:
Gor Nishanov 2017-05-24 01:54:37 +00:00
parent 9f4950afd2
commit db615dd677
1 changed files with 4 additions and 0 deletions

View File

@ -430,6 +430,10 @@ void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) {
CurCoro.Data->CurrentAwaitKind = AwaitKind::Final;
EmitStmt(S.getFinalSuspendStmt());
}
else {
// We don't need FinalBB. Emit it to make sure the block is deleted.
EmitBlock(FinalBB, /*IsFinished=*/true);
}
}
EmitBlock(RetBB);