brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 08743bd Raw
39 lines · cpp
1// RUN: %clang_cc1 %s -triple arm64-apple-macosx -emit-llvm -fcxx-exceptions -fexceptions -std=c++23 -o - | FileCheck  %s2 3class TestClass {4  public:5   TestClass();6   int field = 0;7   friend class Foo;8   static void * operator new(unsigned long size);9  private:10   static void operator delete(void *p);11 };12 13class Foo {14public:15  int test_method();16};17 18int Foo::test_method() {19  TestClass *obj = new TestClass() ;20  return obj->field;21}22 23// CHECK-LABEL: define noundef i32 @_ZN3Foo11test_methodEv24// CHECK: [[THIS_ADDR:%.*]] = alloca ptr, align 825// CHECK: [[OBJ:%.*]] = alloca ptr, align 826// CHECK: store ptr %this, ptr [[THIS_ADDR]], align 827// CHECK: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 828// CHECK: [[ALLOCATION:%.*]] = call noundef ptr @_ZN9TestClassnwEm(i64 noundef 4)29// CHECK: [[INITIALIZEDOBJ:%.*]] = invoke noundef ptr @_ZN9TestClassC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ALLOCATION]])30// CHECK-NEXT:  to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]31// CHECK: [[INVOKE_CONT]]:32// CHECK: store ptr [[ALLOCATION]], ptr [[OBJ]], align 833// CHECK: [[OBJPTR:%.*]] = load ptr, ptr [[OBJ]], align 834// CHECK: [[FIELDPTR:%.*]] = getelementptr inbounds nuw %class.TestClass, ptr [[OBJPTR]], i32 0, i32 035// CHECK: [[FIELD:%.*]] = load i32, ptr [[FIELDPTR]], align 436// CHECK: ret i32 [[FIELD]]37// CHECK: [[LPAD]]:38// CHECK: call void @_ZN9TestClassdlEPv(ptr noundef [[ALLOCATION]]) #339