]> granicus.if.org Git - clang/commit
[coroutines] Implement correct GRO lifetime
authorGor Nishanov <GorNishanov@gmail.com>
Wed, 24 May 2017 02:38:26 +0000 (02:38 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Wed, 24 May 2017 02:38:26 +0000 (02:38 +0000)
commiteb4bbc485efa53f413a482ea7240c4b9918713c3
tree6942e7ee0b33bec937ce15eca77238f603aaa1bb
parent7bd1253c5a47c7344c6f8349f9d19b634e6091b4
[coroutines] Implement correct GRO lifetime

Summary:
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.

Duplicate of: https://reviews.llvm.org/D31670 (which arc patch refuses to apply for some reason)

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

Differential Revision: https://reviews.llvm.org/D33477

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303716 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGCoroutine.cpp
test/CodeGenCoroutines/coro-gro.cpp [new file with mode: 0644]