xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/objc2-write-barrier-4.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
2*f4a2713aSLionel Sambuc// RUN: grep objc_assign_global %t | count 3
3*f4a2713aSLionel Sambuc// RUN: grep objc_assign_strongCast %t | count 2
4*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s
5*f4a2713aSLionel Sambuc// RUN: grep objc_assign_global %t | count 3
6*f4a2713aSLionel Sambuc// RUN: grep objc_assign_strongCast %t | count 2
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc@interface A
9*f4a2713aSLionel Sambuc@end
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuctypedef struct s0 {
12*f4a2713aSLionel Sambuc  A *a[4];
13*f4a2713aSLionel Sambuc} T;
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel SambucT g0;
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambucvoid f0(id x) {
18*f4a2713aSLionel Sambuc  g0.a[0] = x;
19*f4a2713aSLionel Sambuc}
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambucvoid f1(id x) {
22*f4a2713aSLionel Sambuc  ((T*) &g0)->a[0] = x;
23*f4a2713aSLionel Sambuc}
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambucvoid f2(unsigned idx)
26*f4a2713aSLionel Sambuc{
27*f4a2713aSLionel Sambuc   id *keys;
28*f4a2713aSLionel Sambuc   keys[idx] = 0;
29*f4a2713aSLionel Sambuc}
30*f4a2713aSLionel Sambuc
31