1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
2 // RUN: grep -F '@objc_assign_global' %t | count 26
5 typedef const struct __CFDictionary * CFDictionaryRef;
9 __strong CFDictionaryRef cfElement;
10 __strong CFDictionaryRef cfElementArray[10];
14 // assignments to these should generate objc_assign_global
24 extern id FileExternID;
25 static id FileStaticID;
28 NSObject *GlobalObject;
29 NSObject *GlobalObjectArray[20];
30 __strong CFDictionaryRef Gdict;
31 __strong CFDictionaryRef Gdictarray[10];
32 struct_with_ids_t GlobalStruct;
33 struct_with_ids_t GlobalStructArray[10];
35 #define ASSIGNTEST(expr, global) expr = rhs
39 static id staticGlobalId;
40 static id staticGlobalArray[20];
41 static NSObject *staticGlobalObject;
42 static NSObject *staticGlobalObjectArray[20];
43 static __strong CFDictionaryRef staticGdict;
44 static __strong CFDictionaryRef staticGdictarray[10];
45 static struct_with_ids_t staticGlobalStruct;
46 static struct_with_ids_t staticGlobalStructArray[10];
50 ASSIGNTEST(GlobalId, GlobalAssigns); // objc_assign_global
51 ASSIGNTEST(GlobalArray[0], GlobalAssigns); // objc_assign_global
52 ASSIGNTEST(GlobalObject, GlobalAssigns); // objc_assign_global
53 ASSIGNTEST(GlobalObjectArray[0], GlobalAssigns); // objc_assign_global
54 ASSIGNTEST(Gdict, GlobalAssigns); // objc_assign_global
55 ASSIGNTEST(Gdictarray[1], GlobalAssigns); // objc_assign_global
57 ASSIGNTEST(GlobalStruct.element, GlobalAssigns); // objc_assign_global
58 ASSIGNTEST(GlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global
59 ASSIGNTEST(GlobalStruct.cfElement, GlobalAssigns); // objc_assign_global
60 ASSIGNTEST(GlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global
62 ASSIGNTEST(staticGlobalId, GlobalAssigns); // objc_assign_global
63 ASSIGNTEST(staticGlobalArray[0], GlobalAssigns); // objc_assign_global
64 ASSIGNTEST(staticGlobalObject, GlobalAssigns); // objc_assign_global
65 ASSIGNTEST(staticGlobalObjectArray[0], GlobalAssigns); // objc_assign_global
66 ASSIGNTEST(staticGdict, GlobalAssigns); // objc_assign_global
67 ASSIGNTEST(staticGdictarray[1], GlobalAssigns); // objc_assign_global
69 ASSIGNTEST(staticGlobalStruct.element, GlobalAssigns); // objc_assign_global
70 ASSIGNTEST(staticGlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global
71 ASSIGNTEST(staticGlobalStruct.cfElement, GlobalAssigns); // objc_assign_global
72 ASSIGNTEST(staticGlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global