Re: r303714 - [coroutines] Fix leak in CGCoroutine.cpp

2017-05-29 Thread David Blaikie via cfe-commits
Fair enough. I don't have all the context there either. Perhaps Richard Smith could sanity check what the right memory management scheme is here. On Mon, May 29, 2017 at 3:54 PM Gor Nishanov wrote: > My clang-foo is not strong enough :) . > > I wanted to make sure that: "CurCoro.Data->FinalJD =

Re: r303714 - [coroutines] Fix leak in CGCoroutine.cpp

2017-05-29 Thread Gor Nishanov via cfe-commits
My clang-foo is not strong enough :) . I wanted to make sure that: "CurCoro.Data->FinalJD = getJumpDestInCurrentScope(FinalBB);" is in the correct scope where I want it. As opposed to creating it in whatever scope co_return statement is encountered. But that could be simply my misundersanding of t

Re: r303714 - [coroutines] Fix leak in CGCoroutine.cpp

2017-05-29 Thread David Blaikie via cfe-commits
On Mon, May 29, 2017 at 2:12 PM Gor Nishanov wrote: > It is not known in advance whether the final block is needed or not. It > will become known once the user-authored body of the coroutine is emitted. > I cannot defer creation of it up until that point, since final bb acts as a > jump target fo

Re: r303714 - [coroutines] Fix leak in CGCoroutine.cpp

2017-05-29 Thread Gor Nishanov via cfe-commits
It is not known in advance whether the final block is needed or not. It will become known once the user-authored body of the coroutine is emitted. I cannot defer creation of it up until that point, since final bb acts as a jump target for co_returns which could be in the user authored body and I ne

Re: r303714 - [coroutines] Fix leak in CGCoroutine.cpp

2017-05-29 Thread David Blaikie via cfe-commits
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?) (also bracing seems off - could you run your ch