1 // Tests that coroutine passes are added to and run by the new pass manager
2 // pipeline, at -O0 and above.
4 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -o /dev/null \
5 // RUN: -fexperimental-new-pass-manager -fdebug-pass-manager -std=c++20 \
6 // RUN: -O0 %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL
7 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -o /dev/null \
8 // RUN: -fexperimental-new-pass-manager -fdebug-pass-manager -std=c++20 \
9 // RUN: -O1 %s 2>&1 | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-OPT
11 // CHECK-ALL: Running pass:{{.*}}CoroEarlyPass
13 // CHECK-ALL: Running pass: CoroSplitPass on (_Z3foov)
14 // CHECK-OPT: Running pass:{{.*}}CoroElidePass{{.*}} on {{.*}}_Z3foov{{.*}}
16 // CHECK-ALL: Running pass:{{.*}}CoroCleanupPass
23 bool await_ready() noexcept
{ return false; }
24 void await_suspend(handle
) noexcept
{}
25 bool await_resume() noexcept
{ return true; }
28 template <typename T
> struct coroutine_handle
{
29 static handle
from_address(void *address
) noexcept
{ return {}; }
32 template <typename T
= void> struct coroutine_traits
{
34 awaitable
initial_suspend() { return {}; }
35 awaitable
final_suspend() noexcept
{ return {}; }
37 T
get_return_object() { return T(); }
38 void unhandled_exception() {}
43 void foo() { co_return
; }