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
This does not implement TS specified behavior for non static member functions:
[dcl.fct.def.coroutine]/7 states that an argument list is build up as follows:
Where p1 ... pn are defined earlier in
[dcl.fct.def.coroutine]/3 as:
Essentially for non-static member functions, we need to insert implicit object parameter.
Note that lookupPromiseType in SemaCoroutine.cpp when building specialization of std::experimental::coroutine_traits<...> includes implicit object parameter: