[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-always-inline-exp-namespace.cpp
blobe3705cc0d08785fa4e542706255193e792f3b631
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
6 namespace std {
7 namespace experimental {
9 struct handle {};
11 struct awaitable {
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; }
18 template <typename T>
19 struct coroutine_handle {
20 static handle from_address(void *address) noexcept { return {}; }
23 template <typename T = void>
24 struct coroutine_traits {
25 struct promise_type {
26 awaitable initial_suspend() { return {}; }
27 awaitable final_suspend() noexcept { return {}; }
28 void return_void() {}
29 T get_return_object() { return T(); }
30 void unhandled_exception() {}
33 } // namespace experimental
34 } // namespace std
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; }