<div dir="ltr">Could you avoid creating the FinalBB unless it's needed rather than creating it and then adding it so it can be removed? (or, if the creation can't be avoided, maybe it's OK to 'delete FinalBB' here, rather than adding it for it to be removed later?)<br><br>(also bracing seems off - could you run your changes through clang-format? I'd expect '} else {' on the same line.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 23, 2017 at 6:54 PM Gor Nishanov via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: gornishanov<br>
Date: Tue May 23 20:54:37 2017<br>
New Revision: 303714<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=303714&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=303714&view=rev</a><br>
Log:<br>
[coroutines] Fix leak in CGCoroutine.cpp<br>
<br>
FinalBB need to be emitted even when unused to make sure it is deleted<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGCoroutine.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGCoroutine.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCoroutine.cpp?rev=303714&r1=303713&r2=303714&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCoroutine.cpp?rev=303714&r1=303713&r2=303714&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGCoroutine.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGCoroutine.cpp Tue May 23 20:54:37 2017<br>
@@ -430,6 +430,10 @@ void CodeGenFunction::EmitCoroutineBody(<br>
       CurCoro.Data->CurrentAwaitKind = AwaitKind::Final;<br>
       EmitStmt(S.getFinalSuspendStmt());<br>
     }<br>
+    else {<br>
+      // We don't need FinalBB. Emit it to make sure the block is deleted.<br>
+      EmitBlock(FinalBB, /*IsFinished=*/true);<br>
+    }<br>
   }<br>
<br>
   EmitBlock(RetBB);<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>