[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-newpm-pipeline-exp-namespace.cpp
blob8dcf59cb6f911b126e650f611d89b0d2c3fcc86d
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: -fdebug-pass-manager -fcoroutines-ts \
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: -fdebug-pass-manager -fcoroutines-ts \
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
18 namespace std {
19 namespace experimental {
21 struct handle {};
23 struct awaitable {
24 bool await_ready() noexcept { return false; }
25 void await_suspend(handle) noexcept {}
26 bool await_resume() noexcept { return true; }
29 template <typename T> struct coroutine_handle {
30 static handle from_address(void *address) noexcept { return {}; }
33 template <typename T = void> struct coroutine_traits {
34 struct promise_type {
35 awaitable initial_suspend() { return {}; }
36 awaitable final_suspend() noexcept { return {}; }
37 void return_void() {}
38 T get_return_object() { return T(); }
39 void unhandled_exception() {}
42 } // namespace experimental
43 } // namespace std
45 void foo() { co_return; }