[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-lambda-exp-namespace.cpp
blob2c9c446be0806168cad3952b67f95c5f69c0378c
1 // Verify that we synthesized the coroutine for a lambda inside of a function template.
2 // RUN: %clang_cc1 -std=c++1z -fcoroutines-ts -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s -fexceptions -fcxx-exceptions -disable-llvm-passes | FileCheck %s
4 namespace std::experimental {
5 template <typename R, typename... T> struct coroutine_traits {
6 using promise_type = typename R::promise_type;
7 };
9 template <class Promise = void> struct coroutine_handle;
10 template <> struct coroutine_handle<void> {
11 static coroutine_handle from_address(void *) noexcept;
12 coroutine_handle() = default;
13 template <class PromiseType>
14 coroutine_handle(coroutine_handle<PromiseType>) noexcept;
16 template <class Promise> struct coroutine_handle : coroutine_handle<void> {
17 coroutine_handle() = default;
18 static coroutine_handle from_address(void *) noexcept;
20 } // namespace std::experimental
22 struct suspend_always {
23 bool await_ready() noexcept;
24 void await_suspend(std::experimental::coroutine_handle<>) noexcept;
25 void await_resume() noexcept;
28 struct Task {
29 struct promise_type {
30 Task get_return_object();
31 void return_void() {}
32 suspend_always initial_suspend() noexcept;
33 suspend_always final_suspend() noexcept;
34 void unhandled_exception() noexcept;
38 template <typename _AwrT> auto SyncAwait(_AwrT &&A) {
39 if (!A.await_ready()) {
40 auto AwaitAsync = [&]() -> Task {
41 try {
42 (void)(co_await A);
43 } catch (...) {
46 Task t = AwaitAsync();
48 return A.await_resume();
51 void f() {
52 suspend_always test;
53 SyncAwait(test);
56 // Verify that we synthesized the coroutine for a lambda inside SyncAwait
57 // CHECK-LABEL: define linkonce_odr void @_ZZ9SyncAwaitIR14suspend_alwaysEDaOT_ENKUlvE_clEv(
58 // CHECK: alloca %"struct.Task::promise_type"
59 // CHECK: call token @llvm.coro.id(
60 // CHECK: call i8 @llvm.coro.suspend(
61 // CHECK: call i1 @llvm.coro.end(