brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 722166f Raw
52 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s2// RUN: %clang_cc1 -triple x86_64-darwin -std=c++11 -fcxx-exceptions -fexceptions -emit-llvm -o - %s | FileCheck %s --check-prefix=EXCEPTIONS3 4// PR367485 6// Classes to verify order of destroying function parameters.7struct S1 {8  ~S1();9};10struct S2 {11  ~S2();12};13 14struct Base {15  // Use variadic args to cause inlining the inherited constructor.16  Base(const S1&, const S2&, const char *fmt, ...) {}17};18 19struct NonTrivialDtor {20  ~NonTrivialDtor() {}21};22struct Inheritor : public NonTrivialDtor, public Base {23  using Base::Base;24};25 26void f() {27  Inheritor(S1(), S2(), "foo");28  // CHECK-LABEL: define{{.*}} void @_Z1fv29  // CHECK: %[[TMP1:.*]] = alloca %struct.S130  // CHECK: %[[TMP2:.*]] = alloca %struct.S231  // CHECK: call void (ptr, ptr, ptr, ptr, ...) @_ZN4BaseC2ERK2S1RK2S2PKcz(ptr {{.*}}, ptr noundef nonnull align 1 dereferenceable(1) %[[TMP1]], ptr noundef nonnull align 1 dereferenceable(1) %[[TMP2]], ptr {{.*}})32  // CHECK-NEXT: call void @_ZN9InheritorD1Ev(ptr {{.*}})33  // CHECK-NEXT: call void @_ZN2S2D1Ev(ptr {{[^,]*}} %[[TMP2]])34  // CHECK-NEXT: call void @_ZN2S1D1Ev(ptr {{[^,]*}} %[[TMP1]])35 36  // EXCEPTIONS-LABEL: define{{.*}} void @_Z1fv37  // EXCEPTIONS: %[[TMP1:.*]] = alloca %struct.S138  // EXCEPTIONS: %[[TMP2:.*]] = alloca %struct.S239  // EXCEPTIONS: invoke void (ptr, ptr, ptr, ptr, ...) @_ZN4BaseC2ERK2S1RK2S2PKcz(ptr {{.*}}, ptr noundef nonnull align 1 dereferenceable(1) %[[TMP1]], ptr noundef nonnull align 1 dereferenceable(1) %[[TMP2]], ptr {{.*}})40  // EXCEPTIONS-NEXT: to label %[[CONT:.*]] unwind label %[[LPAD:.*]]41 42  // EXCEPTIONS: [[CONT]]:43  // EXCEPTIONS-NEXT: call void @_ZN9InheritorD1Ev(ptr {{.*}})44  // EXCEPTIONS-NEXT: call void @_ZN2S2D1Ev(ptr {{[^,]*}} %[[TMP2]])45  // EXCEPTIONS-NEXT: call void @_ZN2S1D1Ev(ptr {{[^,]*}} %[[TMP1]])46 47  // EXCEPTIONS: [[LPAD]]:48  // EXCEPTIONS: call void @_ZN14NonTrivialDtorD2Ev(ptr {{.*}})49  // EXCEPTIONS-NEXT: call void @_ZN2S2D1Ev(ptr {{[^,]*}} %[[TMP2]])50  // EXCEPTIONS-NEXT: call void @_ZN2S1D1Ev(ptr {{[^,]*}} %[[TMP1]])51}52