xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/references.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambucstruct A { ~A(); };
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@interface B {
6*f4a2713aSLionel Sambuc  A a;
7*f4a2713aSLionel Sambuc}
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc- (const A&)getA;
10*f4a2713aSLionel Sambuc@end
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc@implementation B
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc- (const A&)getA {
15*f4a2713aSLionel Sambuc  return a;
16*f4a2713aSLionel Sambuc}
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@end
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc// CHECK-LABEL: define void @_Z1fP1B
21*f4a2713aSLionel Sambuc// CHECK: objc_msgSend to
22*f4a2713aSLionel Sambuc// CHECK-NOT: call void @_ZN1AD1Ev
23*f4a2713aSLionel Sambuc// CHECK: ret void
24*f4a2713aSLionel Sambucvoid f(B* b) {
25*f4a2713aSLionel Sambuc  (void)[b getA];
26*f4a2713aSLionel Sambuc}
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc// PR7741
29*f4a2713aSLionel Sambuc@protocol P1 @end
30*f4a2713aSLionel Sambuc@protocol P2 @end
31*f4a2713aSLionel Sambuc@protocol P3 @end
32*f4a2713aSLionel Sambuc@interface foo<P1> {} @end
33*f4a2713aSLionel Sambuc@interface bar : foo <P1, P2, P3> {} @end
34*f4a2713aSLionel Sambuctypedef bar baz;
35*f4a2713aSLionel Sambucvoid f5(foo&);
36*f4a2713aSLionel Sambucvoid f5b(foo<P1>&);
37*f4a2713aSLionel Sambucvoid f5c(foo<P2>&);
38*f4a2713aSLionel Sambucvoid f5d(foo<P3>&);
39*f4a2713aSLionel Sambucvoid f6(baz* x) {
40*f4a2713aSLionel Sambuc  f5(*x);
41*f4a2713aSLionel Sambuc  f5b(*x);
42*f4a2713aSLionel Sambuc  f5c(*x);
43*f4a2713aSLionel Sambuc  f5d(*x);
44*f4a2713aSLionel Sambuc  (void)((foo&)*x);
45*f4a2713aSLionel Sambuc}
46