1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
2 // RUN: -S -emit-llvm %s -o - -disable-llvm-passes \
3 // RUN: -fsized-deallocation \
6 #include "Inputs/coroutine.h"
9 typedef __SIZE_TYPE__
size_t;
10 enum class align_val_t
: size_t {};
15 auto initial_suspend() { return std::suspend_always
{}; }
16 auto final_suspend() noexcept
{ return std::suspend_always
{}; }
17 auto get_return_object() { return task
{}; }
18 void unhandled_exception() {}
19 void return_value(int) {}
23 // Test the compiler will chose sized deallocation correctly.
24 // This is only enabled with `-fsized-deallocation` which is off by default.
25 void operator delete(void *ptr
, std::size_t size
) noexcept
;
27 // CHECK: define{{.*}}@_Z1fv
28 // CHECK: %[[coro_free:.+]] = call{{.*}}@llvm.coro.free
30 // CHECK: %[[coro_size:.+]] = call{{.*}}@llvm.coro.size
31 // CHECK: call{{.*}}void @_ZdlPvm(ptr{{.*}}%[[coro_free]], i64{{.*}}%[[coro_size]])