xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/destroy.mm (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -disable-llvm-optzns -o - %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc// rdar://18249673
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc@class MyObject;
5*0a6a1f1dSLionel Sambucstruct base {
6*0a6a1f1dSLionel Sambuc  ~base() = default;
7*0a6a1f1dSLionel Sambuc};
8*0a6a1f1dSLionel Sambucstruct derived : public base {
9*0a6a1f1dSLionel Sambuc  MyObject *myobject;
10*0a6a1f1dSLionel Sambuc};
11*0a6a1f1dSLionel Sambuc
12*0a6a1f1dSLionel Sambucvoid test1() {
13*0a6a1f1dSLionel Sambuc  derived d1;
14*0a6a1f1dSLionel Sambuc}
15*0a6a1f1dSLionel Sambuc// CHECK-LABEL: define void @_Z5test1v()
16*0a6a1f1dSLionel Sambuc// CHECK: call void @_ZN7derivedC1Ev
17*0a6a1f1dSLionel Sambuc// CHECK: call void @_ZN7derivedD1Ev
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel Sambucvoid test2() {
20*0a6a1f1dSLionel Sambuc  derived *d2 = new derived;
21*0a6a1f1dSLionel Sambuc  delete d2;
22*0a6a1f1dSLionel Sambuc}
23*0a6a1f1dSLionel Sambuc// CHECK-LABEL: define void @_Z5test2v()
24*0a6a1f1dSLionel Sambuc// CHECK:   call void @_ZN7derivedC1Ev
25*0a6a1f1dSLionel Sambuc// CHECK:   call void @_ZN7derivedD1Ev
26*0a6a1f1dSLionel Sambuc
27*0a6a1f1dSLionel Sambuctemplate <typename T>
28*0a6a1f1dSLionel Sambucstruct tderived : public base {
29*0a6a1f1dSLionel Sambuc  MyObject *myobject;
30*0a6a1f1dSLionel Sambuc};
31*0a6a1f1dSLionel Sambucvoid test3() {
32*0a6a1f1dSLionel Sambuc  tderived<int> d1;
33*0a6a1f1dSLionel Sambuc}
34*0a6a1f1dSLionel Sambuc// CHECK-LABEL: define void @_Z5test3v()
35*0a6a1f1dSLionel Sambuc// CHECK: call void @_ZN8tderivedIiEC1Ev
36*0a6a1f1dSLionel Sambuc// CHECK: call void @_ZN8tderivedIiED1Ev
37*0a6a1f1dSLionel Sambuc
38*0a6a1f1dSLionel Sambucvoid test4() {
39*0a6a1f1dSLionel Sambuc  tderived<int> *d2 = new tderived<int>;
40*0a6a1f1dSLionel Sambuc  delete d2;
41*0a6a1f1dSLionel Sambuc}
42*0a6a1f1dSLionel Sambuc// CHECK-LABEL: define void @_Z5test4v()
43*0a6a1f1dSLionel Sambuc// CHECK: call void @_ZN8tderivedIiEC1Ev
44*0a6a1f1dSLionel Sambuc// CHECK: call void @_ZN8tderivedIiED1Ev
45*0a6a1f1dSLionel Sambuc
46*0a6a1f1dSLionel Sambuc// CHECK-LABEL: define linkonce_odr void @_ZN8tderivedIiED2Ev
47*0a6a1f1dSLionel Sambuc// CHECK: call void @objc_storeStrong(i8** {{.*}}, i8* null)
48*0a6a1f1dSLionel Sambuc
49*0a6a1f1dSLionel Sambuc// CHECK-LABEL: define linkonce_odr void @_ZN7derivedD2Ev
50*0a6a1f1dSLionel Sambuc// CHECK: call void @objc_storeStrong(i8** {{.*}}, i8* null)
51