[Coroutines] Use LookupAllocationFunction to find allocation functions for coroutines consistently
Previously we may call Sema::FindAllocationFunctions directly to lookup allocation functions directly instead of using our wrapped lambda LookupAllocationFunction, which is slightly incosnsistent. It will be helpful to refactor this for further changes. Also previously, when we lookup 'operator new(std::size_t, std::nothrow_t)' in case we found `get_return_object_on_allocation_failure` in the promise_type, the compiler will try to look at the allocation function in promise_type. However, this is not wanted actually. According to [dcl.fct.def.coroutine]p10: > if a global allocation function is selected, the > ::operator new(size_t, nothrow_t) form is used. So we should only lookup for `::operator (size_t, nothrow_t)` for the global allocation function. For the allocation function in the promise_type, the requirement is that it shouldn't throw, which has already been checked. Given users generally include headers from standard libs so it will generally include the <new> header, so this change should be a trivial one and shouldn't affect almost any user.
Loading
Please sign in to comment