[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-dwarf-exp-namespace.cpp
blob2849f8d80f795265040d2d307282e7e5bcd1e48b
1 // RUN: %clang_cc1 -disable-llvm-optzns -std=c++2a -fcoroutines-ts \
2 // RUN: -triple=x86_64 -dwarf-version=4 -debug-info-kind=limited \
3 // RUN: -emit-llvm -o - %s | \
4 // RUN: FileCheck %s --implicit-check-not=DILocalVariable
6 namespace std::experimental {
7 template <typename... T> struct coroutine_traits;
9 template <class Promise = void> struct coroutine_handle {
10 coroutine_handle() = default;
11 static coroutine_handle from_address(void *) noexcept;
13 template <> struct coroutine_handle<void> {
14 static coroutine_handle from_address(void *) noexcept;
15 coroutine_handle() = default;
16 template <class PromiseType>
17 coroutine_handle(coroutine_handle<PromiseType>) noexcept;
19 } // namespace std::experimental
21 struct suspend_always {
22 bool await_ready() noexcept;
23 void await_suspend(std::experimental::coroutine_handle<>) noexcept;
24 void await_resume() noexcept;
27 template <typename... Args> struct std::experimental::coroutine_traits<void, Args...> {
28 struct promise_type {
29 void get_return_object() noexcept;
30 suspend_always initial_suspend() noexcept;
31 suspend_always final_suspend() noexcept;
32 void return_void() noexcept;
33 promise_type();
34 ~promise_type() noexcept;
35 void unhandled_exception() noexcept;
39 // TODO: Not supported yet
40 struct CopyOnly {
41 int val;
42 CopyOnly(const CopyOnly &) noexcept;
43 CopyOnly(CopyOnly &&) = delete;
44 ~CopyOnly();
47 struct MoveOnly {
48 int val;
49 MoveOnly(const MoveOnly &) = delete;
50 MoveOnly(MoveOnly &&) noexcept;
51 ~MoveOnly();
54 struct MoveAndCopy {
55 int val;
56 MoveAndCopy(const MoveAndCopy &) noexcept;
57 MoveAndCopy(MoveAndCopy &&) noexcept;
58 ~MoveAndCopy();
61 void consume(int, int, int) noexcept;
63 void f_coro(int val, MoveOnly moParam, MoveAndCopy mcParam) {
64 consume(val, moParam.val, mcParam.val);
65 co_return;
68 // CHECK: ![[SP:[0-9]+]] = distinct !DISubprogram(name: "f_coro", linkageName: "_Z6f_coroi8MoveOnly11MoveAndCopy"
69 // CHECK: !{{[0-9]+}} = !DILocalVariable(name: "val", arg: 1, scope: ![[SP]], file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
70 // CHECK: !{{[0-9]+}} = !DILocalVariable(name: "moParam", arg: 2, scope: ![[SP]], file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
71 // CHECK: !{{[0-9]+}} = !DILocalVariable(name: "mcParam", arg: 3, scope: ![[SP]], file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
72 // CHECK: !{{[0-9]+}} = !DILocalVariable(name: "__promise",