================
@@ -293,6 +474,47 @@ folly::coro::Task<int> byRef(const std::string& s) {
// CIR: }, destroy : {
// CIR: }, exit : {
+// The body has no user await; co_return branches straight to final suspend.
+
+// CIR-FLAT-LABEL: cir.func flattened_coroutine {{.*}} @_Z5byRefRKSt6string
+// CIR-FLAT: %[[PROMISE:.*]] = cir.alloca "__promise"
+// CIR-FLAT: cir.call @_ZNSt14suspend_always12await_resumeEv
+// CIR-FLAT: %[[SIZE:.*]] = cir.try_call @_ZNKSt6string4sizeEv({{.*}})
^{{.*}}, ^[[UNWIND:bb[0-9]+]]
----------------
bcardosolopes wrote:
Use `CleanupKind::Normal`. Besides the `try_call`s, `All` also routes an
escaping exception into `destroy`, and #230574 (@mmha) makes `destroy` destroy
the promise and the parameter copies unconditionally, documenting that an
exception must not reach it. An exception thrown before the promise is
constructed would then destroy a promise that never existed. The exceptional
exit is the `unwind` region both PRs leave as a TODO (`coroUnwindRegion` in
#230574), so put the marker here too and make the kind `Normal` until that
exists. That also gets you plain calls without `-fexceptions`, like classic.
https://github.com/llvm/llvm-project/pull/203802
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits