================
@@ -0,0 +1,91 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir
-Wno-coroutine-missing-unhandled-exception -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm
-disable-llvm-passes -Wno-coroutine-missing-unhandled-exception %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+#include "Inputs/coroutine.h"
+
+struct B {
+ int x;
+ int y;
+ bool await_ready() { return true; }
+ B await_resume() { return {}; }
+ template <typename F> void await_suspend(F) {}
+};
+
+struct coro_t {
+ struct promise_type {
+ coro_t get_return_object() { return {}; }
+ std::suspend_never initial_suspend() { return {}; }
+ std::suspend_never final_suspend() noexcept { return {}; }
+ void return_void() {}
+ static void unhandled_exception() {}
+ B yield_value(int) { return {}; }
+ };
+};
+
+// CIR-LABEL: cir.func coroutine {{.*}} @_Z22aggregate_coawait_exprv
+// OGCG-LABEL: define dso_local void @_Z22aggregate_coawait_exprv
+coro_t aggregate_coawait_expr() {
+ // CIR: %[[VAL:.*]] = cir.alloca "val" align(4) init : !cir.ptr<!rec_B>
+ // CIR: cir.await(user, ready : {
+ // CIR: }, suspend : {
+ // CIR: }, resume : {
+ // CIR: cir.call @_ZN1B12await_resumeEv(%{{.*}})
+ // CIR: cir.store align(4) %{{.*}}, %[[VAL]] : !rec_B, !cir.ptr<!rec_B>
+ // CIR: cir.yield
+ // CIR: },)
+ // OGCG: %[[VAL:.*]] = alloca %struct.B, align 4
----------------
Andres-Salamanca wrote:
Could you add a new line between the CIR and OGCG checks to keep them
consistent with the other tests?
https://github.com/llvm/llvm-project/pull/225412
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits