[clang] [Clang] Propagate elide safe context through [[clang::coro_must_await]] (PR #108474)
Adrian Vogelsgesang via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 00:39:59 PDT 2024
================
@@ -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:
----------------
vogelsgesang wrote:
Ah, right. I misread the code.
In general: Is checking if the callee coroutine is annotated actually necessary? To my understanding from the other thread, so far it was necessary because of `await_transform` and `operator co_await`. After we make this checking more fine-granular, are there any other reasons why we would still need to check if the callee coroutine is annotated?
https://github.com/llvm/llvm-project/pull/108474
More information about the cfe-commits
mailing list