xref: /llvm-project/clang/test/CodeGenObjCXX/inheriting-constructor-cleanup.mm (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -triple x86_64-darwin -std=c++11 -fobjc-arc -emit-llvm -o - %s | FileCheck %s --implicit-check-not "call\ "
2
3struct Strong {
4  __strong id x;
5};
6
7struct Base {
8  // Use variadic args to cause inlining the inherited constructor.
9  Base(Strong s, ...) {}
10};
11
12struct NonTrivialDtor {
13  ~NonTrivialDtor() {}
14};
15struct Inheritor : public NonTrivialDtor, public Base {
16  using Base::Base;
17};
18
19id g(void);
20void f() {
21  Inheritor({g()});
22}
23// CHECK-LABEL: define{{.*}} void @_Z1fv
24// CHECK:       %[[TMP:.*]] = call noundef ptr @_Z1gv()
25// CHECK:       {{.*}} = notail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %[[TMP]])
26// CHECK:       call void (ptr, ptr, ...) @_ZN4BaseC2E6Strongz(ptr {{.*}}, ptr {{.*}})
27// CHECK-NEXT:  call void @_ZN9InheritorD1Ev(ptr {{.*}})
28
29// CHECK-LABEL: define linkonce_odr void @_ZN4BaseC2E6Strongz(ptr {{.*}}, ptr {{.*}}, ...)
30// CHECK:       call void @_ZN6StrongD1Ev(ptr {{.*}})
31
32// CHECK-LABEL: define linkonce_odr void @_ZN9InheritorD1Ev(ptr {{.*}})
33// CHECK:       call void @_ZN9InheritorD2Ev(ptr {{.*}})
34
35// CHECK-LABEL: define linkonce_odr void @_ZN6StrongD1Ev(ptr {{.*}})
36// CHECK:       call void @_ZN6StrongD2Ev(ptr {{.*}})
37
38// CHECK-LABEL: define linkonce_odr void @_ZN6StrongD2Ev(ptr {{.*}})
39// CHECK:       call void @llvm.objc.storeStrong(ptr {{.*}}, ptr null)
40
41// CHECK-LABEL: define linkonce_odr void @_ZN9InheritorD2Ev(ptr {{.*}})
42// CHECK:       call void @_ZN14NonTrivialDtorD2Ev(ptr {{.*}})
43