brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 9e3911f Raw
91 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR3// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -emit-llvm %s -o %t-cir.ll4// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM5// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -emit-llvm %s -o %t.ll6// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG7 8class A {9public:10  A(): x(0) {}11  A(A &a) : x(a.x) {}12  int x;13  void Foo() {}14};15 16void test1() {17  ({18    A a;19    a;20  }).Foo();21}22 23// CIR: cir.func dso_local @_Z5test1v()24// CIR:   cir.scope {25// CIR:     %[[REF_TMP0:.+]] = cir.alloca !rec_A, !cir.ptr<!rec_A>, ["ref.tmp0"]26// CIR:     %[[TMP:.+]]      = cir.alloca !rec_A, !cir.ptr<!rec_A>, ["tmp"]27// CIR:     cir.scope {28// CIR:       %[[A:.+]] = cir.alloca !rec_A, !cir.ptr<!rec_A>, ["a", init]29// CIR:       cir.call @_ZN1AC2Ev(%[[A]]) : (!cir.ptr<!rec_A>) -> ()30// CIR:       cir.call @_ZN1AC2ERS_(%[[REF_TMP0]], %[[A]]) : (!cir.ptr<!rec_A>, !cir.ptr<!rec_A>) -> ()31// CIR:     }32// CIR:     cir.call @_ZN1A3FooEv(%[[REF_TMP0]]) : (!cir.ptr<!rec_A>) -> ()33// CIR:   }34// CIR:   cir.return35 36// LLVM: define dso_local void @_Z5test1v()37// LLVM:   %[[VAR1:.+]] = alloca %class.A, i64 138// LLVM:   %[[VAR2:.+]] = alloca %class.A, i64 139// LLVM:   %[[VAR3:.+]] = alloca %class.A, i64 140// LLVM:   br label %[[LBL4:.+]]41// LLVM: [[LBL4]]:42// LLVM:     br label %[[LBL5:.+]]43// LLVM: [[LBL5]]:44// LLVM:     call void @_ZN1AC2Ev(ptr %[[VAR3]])45// LLVM:     call void @_ZN1AC2ERS_(ptr %[[VAR1]], ptr %[[VAR3]])46// LLVM:     br label %[[LBL6:.+]]47// LLVM: [[LBL6]]:48// LLVM:     call void @_ZN1A3FooEv(ptr %[[VAR1]])49// LLVM:     br label %[[LBL7:.+]]50// LLVM: [[LBL7]]:51// LLVM:     ret void52 53// OGCG: define dso_local void @_Z5test1v()54// OGCG: entry:55// OGCG:   %[[REF_TMP:.+]] = alloca %class.A56// OGCG:   %[[A:.+]]       = alloca %class.A57// OGCG:   call void @_ZN1AC2Ev(ptr {{.*}} %[[A]])58// OGCG:   call void @_ZN1AC2ERS_(ptr {{.*}} %[[REF_TMP]], ptr {{.*}} %[[A]])59// OGCG:   call void @_ZN1A3FooEv(ptr {{.*}} %[[REF_TMP]])60// OGCG:   ret void61 62struct with_dtor {63  ~with_dtor();64};65 66void cleanup() {67  ({ with_dtor wd; });68}69 70// CIR: cir.func dso_local @_Z7cleanupv()71// CIR:   cir.scope {72// CIR:     %[[WD:.+]] = cir.alloca !rec_with_dtor, !cir.ptr<!rec_with_dtor>, ["wd"]73// CIR:     cir.call @_ZN9with_dtorD1Ev(%[[WD]]) nothrow : (!cir.ptr<!rec_with_dtor>) -> ()74// CIR:   }75// CIR:   cir.return76 77// LLVM: define dso_local void @_Z7cleanupv()78// LLVM:   %[[WD:.+]] = alloca %struct.with_dtor, i64 179// LLVM:   br label %[[LBL2:.+]]80// LLVM: [[LBL2]]:81// LLVM:     call void @_ZN9with_dtorD1Ev(ptr %[[WD]])82// LLVM:     br label %[[LBL3:.+]]83// LLVM: [[LBL3]]:84// LLVM:     ret void85 86// OGCG: define dso_local void @_Z7cleanupv()87// OGCG: entry:88// OGCG:   %[[WD:.+]] = alloca %struct.with_dtor89// OGCG:   call void @_ZN9with_dtorD1Ev(ptr {{.*}} %[[WD]])90// OGCG:   ret void91