================
@@ -8261,12 +8261,19 @@ def CoroAwaitElidableDoc : Documentation {
The ``[[clang::coro_await_elidable]]`` is a class attribute which can be
applied
to a coroutine return type.
-When a coroutine function that returns such a type calls another coroutine
function,
-the compiler performs heap allocation elision when the call to the coroutine
function
-is immediately co_awaited as a prvalue. In this case, the coroutine frame for
the
-callee will be a local variable within the enclosing braces in the caller's
stack
-frame. And the local variable, like other variables in coroutines, may be
collected
-into the coroutine frame, which may be allocated on the heap.
+When a coroutine function returns such a type, a direct call expression therein
+that returns a prvalue of a type attributed ``[[clang::coro_await_elidable]]``
+is said to be under a safe elide context if one of the following is true:
----------------
yuxuanchen1997 wrote:
> Is checking if the callee coroutine is annotated actually necessary?
Depends on the new spec which I haven't thought about yet but most likely I'll
say it's still necessary for simplicity. We can make `await_transform` and
`operator co_await` propagate the safe elide context. Just having the awaiter
type attributed, and asserting that a prvalue of the awaiter returned from
operator co_await must satisfy the requirements *may* do the work. I haven't
thought it through.
https://github.com/llvm/llvm-project/pull/108474
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits