]> granicus.if.org Git - clang/commit
[Coroutines] Use allocator overload when available
authorBrian Gesiak <modocache@gmail.com>
Thu, 15 Feb 2018 20:37:22 +0000 (20:37 +0000)
committerBrian Gesiak <modocache@gmail.com>
Thu, 15 Feb 2018 20:37:22 +0000 (20:37 +0000)
commita8522988bf0ac5116fa37ce3330c31452bcaccca
treeb66c91120722089040dc98cb2ada77767a780849
parentedbfdfb07e2eca1f696b000621e961306b85aade
[Coroutines] Use allocator overload when available

Summary:
Depends on https://reviews.llvm.org/D42605.

An implementation of the behavior described in `[dcl.fct.def.coroutine]/7`:
when a promise type overloads `operator new` using a "placement new"
that takes the same argument types as the coroutine function, that
overload is used when allocating the coroutine frame.

Simply passing references to the coroutine function parameters directly
to `operator new` results in invariant violations in LLVM's coroutine
splitting pass, so this implementation modifies Clang codegen to
produce allocator-specific alloc/store/loads for each parameter being
forwarded to the allocator.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: lewissbaker, EricWF, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325291 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaCoroutine.cpp
test/CodeGenCoroutines/coro-alloc.cpp
test/CodeGenCoroutines/coro-gro-nrvo.cpp
test/CodeGenCoroutines/coro-params.cpp
test/SemaCXX/coroutines.cpp