1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -fcoroutines-ts \
2 // RUN: -O0 %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -fcoroutines-ts \
4 // RUN: -fno-inline -O0 %s -o - | FileCheck %s
7 namespace experimental
{
12 bool await_ready() noexcept
{ return true; }
13 // CHECK-NOT: await_suspend
14 inline void __attribute__((__always_inline__
)) await_suspend(handle
) noexcept
{}
15 bool await_resume() noexcept
{ return true; }
19 struct coroutine_handle
{
20 static handle
from_address(void *address
) noexcept
{ return {}; }
23 template <typename T
= void>
24 struct coroutine_traits
{
26 awaitable
initial_suspend() { return {}; }
27 awaitable
final_suspend() noexcept
{ return {}; }
29 T
get_return_object() { return T(); }
30 void unhandled_exception() {}
33 } // namespace experimental
36 // CHECK-LABEL: @_Z3foov
37 // CHECK-LABEL: entry:
38 // CHECK: [[CAST0:%[0-9]+]] = bitcast %"struct.std::experimental::awaitable"* %ref.tmp{{.*}} to i8*
39 // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[CAST0]])
40 // CHECK: [[CAST1:%[0-9]+]] = bitcast %"struct.std::experimental::awaitable"* %ref.tmp{{.*}} to i8*
41 // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[CAST1]])
43 // CHECK: [[CAST2:%[0-9]+]] = bitcast %"struct.std::experimental::awaitable"* %ref.tmp{{.*}} to i8*
44 // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 1, i8* [[CAST2]])
45 // CHECK: [[CAST3:%[0-9]+]] = bitcast %"struct.std::experimental::awaitable"* %ref.tmp{{.*}} to i8*
46 // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[CAST3]])
47 void foo() { co_return
; }