xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/encode-test-6.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t %s
2f4a2713aSLionel Sambuc// RUN: FileCheck < %t %s
3f4a2713aSLionel Sambuc// rdar://11777609
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuctypedef struct {} Z;
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambuc@interface A
8f4a2713aSLionel Sambuc-(void)bar:(Z)a;
9f4a2713aSLionel Sambuc-(void)foo:(Z)a : (char*)b : (Z)c : (double) d;
10f4a2713aSLionel Sambuc@end
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc@implementation A
13f4a2713aSLionel Sambuc-(void)bar:(Z)a {}
14f4a2713aSLionel Sambuc-(void)foo:(Z)a: (char*)b : (Z)c : (double) d {}
15f4a2713aSLionel Sambuc@end
16f4a2713aSLionel Sambuc
17*0a6a1f1dSLionel Sambuc// CHECK: private global [14 x i8] c"v16@0:8{?=}16
18*0a6a1f1dSLionel Sambuc// CHECK: private global [26 x i8] c"v32@0:8{?=}16*16{?=}24d24
19f4a2713aSLionel Sambuc
20f4a2713aSLionel Sambuc
21f4a2713aSLionel Sambuc// rdar://13190095
22f4a2713aSLionel Sambuc@interface NSObject @end
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc@class BABugExample;
25f4a2713aSLionel Sambuctypedef BABugExample BABugExampleRedefinition;
26f4a2713aSLionel Sambuc
27f4a2713aSLionel Sambuc@interface BABugExample : NSObject {
28f4a2713aSLionel Sambuc    BABugExampleRedefinition *_property; // .asciz   "^{BABugExample=^{BABugExample}}"
29f4a2713aSLionel Sambuc}
30f4a2713aSLionel Sambuc@property (copy) BABugExampleRedefinition *property;
31f4a2713aSLionel Sambuc@end
32f4a2713aSLionel Sambuc
33f4a2713aSLionel Sambuc@implementation BABugExample
34f4a2713aSLionel Sambuc@synthesize property = _property;
35f4a2713aSLionel Sambuc@end
36f4a2713aSLionel Sambuc
37*0a6a1f1dSLionel Sambuc// CHECK: private global [24 x i8] c"^{BABugExample=@}16
38f4a2713aSLionel Sambuc
39f4a2713aSLionel Sambuc// rdar://14408244
40f4a2713aSLionel Sambuc@class SCNCamera;
41f4a2713aSLionel Sambuctypedef SCNCamera C3DCamera;
42f4a2713aSLionel Sambuctypedef struct
43f4a2713aSLionel Sambuc{
44f4a2713aSLionel Sambuc    C3DCamera *presentationInstance;
45f4a2713aSLionel Sambuc}  C3DCameraStorage;
46f4a2713aSLionel Sambuc
47f4a2713aSLionel Sambuc@interface SCNCamera
48f4a2713aSLionel Sambuc@end
49f4a2713aSLionel Sambuc
50f4a2713aSLionel Sambuc@implementation SCNCamera
51f4a2713aSLionel Sambuc{
52f4a2713aSLionel Sambuc    C3DCameraStorage _storage;
53f4a2713aSLionel Sambuc}
54f4a2713aSLionel Sambuc@end
55*0a6a1f1dSLionel Sambuc// CHECK: private global [39 x i8] c"{?=\22presentationInstance\22^{SCNCamera}}\00"
56*0a6a1f1dSLionel Sambuc
57*0a6a1f1dSLionel Sambuc// rdar://16655340
58*0a6a1f1dSLionel Sambucint i;
59*0a6a1f1dSLionel Sambuctypeof(@encode(typeof(i))) e = @encode(typeof(i));
60*0a6a1f1dSLionel Sambucconst char * Test()
61*0a6a1f1dSLionel Sambuc{
62*0a6a1f1dSLionel Sambuc    return e;
63*0a6a1f1dSLionel Sambuc}
64*0a6a1f1dSLionel Sambuc// CHECK: @e = global [2 x i8] c"i\00", align 1
65*0a6a1f1dSLionel Sambuc// CHECK: define i8* @Test()
66*0a6a1f1dSLionel Sambuc// CHECK: ret i8* getelementptr inbounds ([2 x i8]* @e, i32 0, i32 0)
67