1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++20 \ 2 // RUN: -O0 %s -o - | FileCheck %s 3 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++20 \ 4 // RUN: -fno-inline -O0 %s -o - | FileCheck %s 5 6 namespace std { 7 8 struct handle {}; 9 10 struct awaitable { await_readystd::awaitable11 bool await_ready() noexcept { return true; } 12 // CHECK-NOT: await_suspend await_suspendstd::awaitable13 inline void __attribute__((__always_inline__)) await_suspend(handle) noexcept {} await_resumestd::awaitable14 bool await_resume() noexcept { return true; } 15 }; 16 17 template <typename T> 18 struct coroutine_handle { from_addressstd::coroutine_handle19 static handle from_address(void *address) noexcept { return {}; } 20 }; 21 22 template <typename T = void> 23 struct coroutine_traits { 24 struct promise_type { initial_suspendstd::coroutine_traits::promise_type25 awaitable initial_suspend() { return {}; } final_suspendstd::coroutine_traits::promise_type26 awaitable final_suspend() noexcept { return {}; } return_voidstd::coroutine_traits::promise_type27 void return_void() {} get_return_objectstd::coroutine_traits::promise_type28 T get_return_object() { return T(); } unhandled_exceptionstd::coroutine_traits::promise_type29 void unhandled_exception() {} 30 }; 31 }; 32 } // namespace std 33 34 // CHECK-LABEL: @_Z3foov 35 // CHECK-LABEL: entry: 36 // CHECK: %ref.tmp.reload.addr = getelementptr 37 // CHECK: %ref.tmp3.reload.addr = getelementptr foo()38void foo() { co_return; } 39 40 // Check that bar is not inlined even it's marked as always_inline. 41 42 // CHECK-LABEL: define {{.*}} void @_Z3bazv() 43 // CHECK: call void @_Z3barv( bar()44__attribute__((__always_inline__)) void bar() { 45 co_return; 46 } baz()47void baz() { 48 bar(); 49 co_return; 50 } 51