brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 57eba8c Raw
57 lines · cpp
1// RUN: %clang_cc1 %s -triple arm64-apple-macosx     -fsized-deallocation    -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck %s2// RUN: %clang_cc1 %s -triple arm64-apple-macosx  -fno-sized-deallocation    -faligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck %s3// RUN: %clang_cc1 %s -triple arm64-apple-macosx  -fno-sized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck %s4// RUN: %clang_cc1 %s -triple arm64-apple-macosx     -fsized-deallocation -fno-aligned-allocation -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -o - | FileCheck %s5// RUN: %clang_cc1 %s -triple arm64-apple-macosx -faligned-allocation                             -emit-llvm -fcxx-exceptions -fexceptions -std=c++26 -fexperimental-new-constant-interpreter -o - | FileCheck %s6 7using size_t = __SIZE_TYPE__;8 9namespace std {10  template <class T> struct type_identity {11    typedef T type;12  };13  enum class align_val_t : size_t {};14}15 16 17template <typename T> void *operator new(std::type_identity<T>, size_t, std::align_val_t);18template <typename T> void operator delete(std::type_identity<T>, void *, size_t, std::align_val_t);19struct S {20  int i = 0;21  constexpr S() __attribute__((noinline)) {}22};23 24 constexpr int doSomething() {25  S* s = new S;26  int result = s->i;27  delete s;28  return result;29}30 31static constexpr int force_doSomething = doSomething();32template <int N> struct Tag {};33 34void test1(Tag<force_doSomething>){35// CHECK-LABEL: define void @_Z5test13TagILi0EE36}37 38void test2(Tag<doSomething() + 1>){39// CHECK-LABEL: define void @_Z5test23TagILi1EE40}41 42int main() {43  // CHECK-LABEL: define noundef i32 @main()44  return doSomething();45  // CHECK: call{{.*}}i32 @_Z11doSomethingv()46}47 48// CHECK-LABEL: define linkonce_odr noundef i32 @_Z11doSomethingv()49// CHECK: [[ALLOC:%.*]] = call noundef ptr @_ZnwI1SEPvSt13type_identityIT_Em50// CHECK: invoke noundef ptr @_ZN1SC1Ev(ptr{{.*}} [[ALLOC]])51// CHECK-NEXT: to label %[[CONT:.*]] unwind label %[[LPAD:[a-z0-9]+]]52// CHECK: [[CONT]]:53// CHECK: call void @_ZdlI1SEvSt13type_identityIT_EPv54// CHECK: ret55// CHECK: [[LPAD]]:56// call void @_ZdlI1SEvSt13type_identityIT_EPvmSt11align_val_t({{.*}} [[ALLOC]])57