1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
2 // RUN: -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
4 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
5 // RUN: -O3 -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-O
7 #include "Inputs/coroutine.h"
12 struct A_promise_type
{
13 A
get_return_object();
14 suspend_always
initial_suspend();
15 suspend_always
final_suspend() noexcept
;
16 void return_value(int);
17 void unhandled_exception();
19 std::coroutine_handle
<> handle
;
26 void await_suspend(F
);
28 Awaitable
something();
35 struct [[clang::coro_only_destroy_when_complete
]] A
{
36 using promise_type
= A_promise_type
;
38 A(std::coroutine_handle
<>);
41 std::coroutine_handle
<promise_type
> handle
;
53 // CHECK: define{{.*}}@_Z3foov({{.*}}) #[[ATTR_NUM:[0-9]+]]
54 // CHECK: attributes #[[ATTR_NUM]] = {{.*}}coro_only_destroy_when_complete
56 // CHECK-O: define{{.*}}@_Z3foov.destroy