40 lines · cpp
1// Check that we can still observe the value of the coroutine frame2// 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 %s7 8#include "Inputs/coroutine.h"9 10template <>11struct 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();18 };19};20 21struct ScalarAwaiter {22 template <typename F> void await_suspend(F);23 bool await_ready();24 int await_resume();25};26 27extern "C" void UseScalar(int);28 29extern "C" void f() {30 UseScalar(co_await ScalarAwaiter{});31 32 int Val = co_await ScalarAwaiter{};33 34 co_await ScalarAwaiter{};35}36 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"40