]> granicus.if.org Git - clang/commitdiff
[coroutines] Fix leak in CGCoroutine.cpp
authorGor Nishanov <GorNishanov@gmail.com>
Wed, 24 May 2017 01:54:37 +0000 (01:54 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Wed, 24 May 2017 01:54:37 +0000 (01:54 +0000)
FinalBB need to be emitted even when unused to make sure it is deleted

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303714 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCoroutine.cpp

index b16ab72b42af5930b93c38f38ac48eb545123a88..1316c76daf9c5a63faa08c44354ecd5f3280d84e 100644 (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);