[libcxx-commits] [clang] [libcxx] Elide suspension points via [[clang::coro_await_suspend_destroy]] (PR #152623)
Chuanqi Xu via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 18 23:50:33 PDT 2025
================
@@ -9363,6 +9363,119 @@ Example:
}];
}
+def CoroAwaitSuspendDestroyDoc : Documentation {
+ let Category = DocCatFunction;
+ let Content = [{
+
+The ``[[clang::coro_await_suspend_destroy]]`` attribute applies to an
+``await_suspend(std::coroutine_handle<Promise>)`` member function of a
+coroutine awaiter. When applied, suspensions into the awaiter use an optimized
+call path that bypasses standard suspend intrinsics, and immediately destroys
+the suspending coro.
+
+Each annotated ``await_suspend`` member must contain a compatibility stub:
+
+.. code-block:: c++
+
+ [[clang::coro_await_suspend_destroy]]
+ void await_suspend(std::coroutine_handle<Promise> handle) {
+ await_suspend_destroy(handle.promise());
+ handle.destroy();
+ }
----------------
ChuanqiXu9 wrote:
What does it mean? Does it say the function must be implemented as is? If yes, I feel bad for that. I prefer the previous design.
https://github.com/llvm/llvm-project/pull/152623
More information about the libcxx-commits
mailing list