[clang] [llvm] [Clang][Coroutines] Introducing the `[[clang::coro_inplace_task]]` attribute (PR #94693)
Yuxuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 15:25:26 PDT 2024
================
@@ -0,0 +1,84 @@
+// This file tests the coro_structured_concurrency attribute semantics.
+// RUN: %clang_cc1 -std=c++20 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
+
+#include "Inputs/coroutine.h"
+#include "Inputs/utility.h"
+
+template <typename T>
+struct [[clang::coro_structured_concurrency]] Task {
----------------
yuxuanchen1997 wrote:
Actually no. It's perfect valid to destroy this task before completion. See this as an example:
```
Task bar();
Task foo() {
co_await bar();
}
```
You can totally call foo and destroy it, as long as `bar` is not running in parallel and you don't try to resume `bar` (through a handle you smuggled with the task, which this type does not allow to do)
https://github.com/llvm/llvm-project/pull/94693
More information about the llvm-commits
mailing list