[PATCH] D31670: [coroutines] Implement correct GRO lifetime

Gor Nishanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 09:18:39 PDT 2017


GorNishanov created this revision.
Herald added a subscriber: EricWF.

Sema creates a declaration for gro variable as:

  auto $gro = $promise.get_return_object();

However, gro variable has to outlive coroutine frame and coroutine promise, but,
it can only be initialized after the coroutine promise was created, thus, we
split its emission in two parts: EmitGroAlloca emits an alloca and sets up
the cleanups. Later when the coroutine promise is available we initialize
the gro and set the flag that the cleanup is now active.


https://reviews.llvm.org/D31670

Files:
  lib/CodeGen/CGCoroutine.cpp
  test/CodeGenCoroutines/coro-gro.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31670.94082.patch
Type: text/x-patch
Size: 6426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170404/8e56ec35/attachment.bin>


More information about the cfe-commits mailing list