[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGenCoroutines / coro-dwarf-O2.cpp
blob53f4a07982e427875f5f98df6c779fa788b9611f
1 // Check that we can still observe the value of the coroutine frame
2 // with optimizations.
3 //
4 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
5 // RUN: -emit-llvm %s -debug-info-kind=limited -dwarf-version=5 \
6 // RUN: -O2 -o - | FileCheck %s
8 #include "Inputs/coroutine.h"
10 template <>
11 struct std::coroutine_traits<void> {
12 struct promise_type {
13 void get_return_object();
14 std::suspend_always initial_suspend();
15 std::suspend_always final_suspend() noexcept;
16 void return_void();
17 void unhandled_exception();
21 struct ScalarAwaiter {
22 template <typename F> void await_suspend(F);
23 bool await_ready();
24 int await_resume();
27 extern "C" void UseScalar(int);
29 extern "C" void f() {
30 UseScalar(co_await ScalarAwaiter{});
32 int Val = co_await ScalarAwaiter{};
34 co_await ScalarAwaiter{};
37 // CHECK: define {{.*}}@f.resume({{.*}} %[[ARG:.*]])
38 // CHECK: #dbg_value(ptr %[[ARG]], ![[CORO_NUM:[0-9]+]], !DIExpression(DW_OP_deref)
39 // CHECK: ![[CORO_NUM]] = !DILocalVariable(name: "__coro_frame"