[clang] [Clang] Propagate elide safe context through [[clang::coro_must_await]] (PR #108474)

Adrian Vogelsgesang via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 14 05:00:29 PDT 2024


================
@@ -8281,8 +8288,62 @@ Example:
     co_await t;
   }
 
-The behavior is undefined if the caller coroutine is destroyed earlier than the
-callee coroutine.
+Such elision replaces the heap allocated activation frame of the callee coroutine
+with a local variable within the enclosing braces in the caller's stack frame.
+The local variable, like other variables in coroutines, may be collected into the
+coroutine frame, which may be allocated on the heap. The behavior is undefined
+if the caller coroutine is destroyed earlier than the callee coroutine.
+
+}];
+}
+
+def CoroMustAwaitDoc : Documentation {
+  let Category = DocCatDecl;
+  let Content = [{
+
+The ``[[clang::coro_must_await]]`` is a function parameter attribute. It works
+in conjunction with ``[[clang::coro_await_elidable]]`` to propagate a safe elide
+context to a parameter or parameter pack if the function is called under a safe
+elide context.
+
+This is sometimes necessary on utility functions whose role is to compose or
+modify the behavior of a callee coroutine.
----------------
vogelsgesang wrote:

```suggestion
This is sometimes necessary on utility functions used to compose or
modify the behavior of a callee coroutine.
```

https://github.com/llvm/llvm-project/pull/108474


More information about the cfe-commits mailing list