================
@@ -8015,6 +8015,26 @@ but do not pass them to the underlying coroutine or pass 
them by value.
 }];
 }
 
+def CoroStructuredConcurrencyDoc : Documentation {
+  let Category = DocCatDecl;
+  let Content = [{
+The ``[[clang::coro_structured_concurrency]]`` 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 following conditions 
are all met:
+- callee coroutine function returns a type that is annotated with
+  ``[[clang::coro_structured_concurrency]]``.
+- The callee coroutine function is inlined.
+- In caller coroutine, the return value of the callee is a prvalue or an 
xvalue, and
+- The temporary expression containing the callee coroutine object is 
immediately co_awaited.
+
+The behavior is undefined if any of the following condition was met:
+- the caller coroutine is destroyed earlier than the callee coroutine.
----------------
efriedma-quic wrote:

To make sure we're clear about exactly which case we're talking about, can you 
write an example that triggers undefined behavior?

I'm not sure I see the connection between writing a task type and ensuring 
coroutines are destroyed in the right order... are you saying that a 
well-behaved Task will ensure destruction always happens in the right order, 
regardless of how it's used?

I'd still like an answer to my question about sanitizers.

https://github.com/llvm/llvm-project/pull/94693
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to