[clang] [CIR] Add coroutine cleanup handling and update co_return semantics (PR #189281)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 22 12:46:57 PDT 2026
================
@@ -609,3 +701,85 @@ folly::coro::Task<int> go4() {
// OGCG: call void @_ZNSt14suspend_always13await_suspendESt16coroutine_handleIvE(ptr noundef nonnull align 1 dereferenceable(1) %[[AwaiterReload]])
// OGCG: ret void
// OGCG: }
+
----------------
andykaylor wrote:
It would be nice to have a test case that did something like this to confirm that local objects are properly destructed on the normal cleanup path:
```
folly::coro::Task<int> co_return_with_dtor() {
HasDtor local;
if (flag)
co_return 1; // local dtor must run here
co_return 2;
}
```
https://github.com/llvm/llvm-project/pull/189281
More information about the cfe-commits
mailing list