brintos

brintos / llvm-project-archived public Read only

0
0
Text · 964 B · 460f862 Raw
33 lines · cpp
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 %s3// RUN: %clang_cc1 %s -std=c++26 -triple x86_64 -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s4 5#include "Inputs/coroutine.h"6 7namespace std {8typedef decltype(sizeof(int)) size_t;9}10 11struct Allocator {};12 13struct 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 24void *operator new(std::size_t, void *);25 26resumable 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]])33