| 1 |
// Tests that we wouldn't generate an allocation call in global scope with (std::size_t, p0, ..., pn) |
| 2 |
// RUN: %clang_cc1 %s -std=c++20 -triple x86_64 -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s |
| 3 |
// RUN: %clang_cc1 %s -std=c++26 -triple x86_64 -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s |
| 4 |
|
| 5 |
#include "Inputs/coroutine.h" |
| 6 |
|
| 7 |
namespace std { |
| 8 |
typedef decltype(sizeof(int)) size_t; |
| 9 |
} |
| 10 |
|
| 11 |
struct Allocator {}; |
| 12 |
|
| 13 |
struct resumable { |
| 14 |
struct promise_type { |
| 15 |
|
| 16 |
resumable get_return_object() { return {}; } |
| 17 |
auto initial_suspend() { return std::suspend_always(); } |
| 18 |
auto final_suspend() noexcept { return std::suspend_always(); } |
| 19 |
void unhandled_exception() {} |
| 20 |
void return_void(){}; |
| 21 |
}; |
| 22 |
}; |
| 23 |
|
| 24 |
void *operator new(std::size_t, void *); |
| 25 |
|
| 26 |
resumable f1(void *) { |
| 27 |
co_return; |
| 28 |
} |
| 29 |
|
| 30 |
// CHECK: coro.alloc: |
| 31 |
// CHECK-NEXT: [[SIZE:%.+]] = call [[BITWIDTH:.+]] @llvm.coro.size.[[BITWIDTH]]() |
| 32 |
// CHECK-NEXT: call {{.*}} ptr @_Znwm([[BITWIDTH]] noundef [[SIZE]]) |