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 -F '@objc_assign_global' %t | count 7 3*f4a2713aSLionel Sambuc// RUN: grep -F '@objc_assign_ivar' %t | count 5 4*f4a2713aSLionel Sambuc// RUN: grep -F '@objc_assign_strongCast' %t | count 8 5*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 6*f4a2713aSLionel Sambuc// RUN: grep -F '@objc_assign_global' %t | count 7 7*f4a2713aSLionel Sambuc// RUN: grep -F '@objc_assign_ivar' %t | count 5 8*f4a2713aSLionel Sambuc// RUN: grep -F '@objc_assign_strongCast' %t | count 8 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambucextern id **somefunc(void); 11*f4a2713aSLionel Sambucextern id *somefunc2(void); 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc// Globals 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambucid W, *X, **Y; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambucvoid func(id a, id *b, id **c) { 19*f4a2713aSLionel Sambuc static id w, *x, **y; 20*f4a2713aSLionel Sambuc W = a; 21*f4a2713aSLionel Sambuc w = a; 22*f4a2713aSLionel Sambuc X = b; 23*f4a2713aSLionel Sambuc x = b; 24*f4a2713aSLionel Sambuc Y = c; 25*f4a2713aSLionel Sambuc y = c; 26*f4a2713aSLionel Sambuc} 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc// Instances 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc@interface something { 31*f4a2713aSLionel Sambuc id w, *x, **y; 32*f4a2713aSLionel Sambuc} 33*f4a2713aSLionel Sambuc@end 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc@implementation something 36*f4a2713aSLionel Sambuc- (void)amethod { 37*f4a2713aSLionel Sambuc id badIdea = *somefunc2(); 38*f4a2713aSLionel Sambuc w = badIdea; 39*f4a2713aSLionel Sambuc x = &badIdea; 40*f4a2713aSLionel Sambuc y = &x; 41*f4a2713aSLionel Sambuc} 42*f4a2713aSLionel Sambuc@end 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuctypedef struct { 45*f4a2713aSLionel Sambuc int junk; 46*f4a2713aSLionel Sambuc id alfred; 47*f4a2713aSLionel Sambuc} AStruct; 48*f4a2713aSLionel Sambuc 49*f4a2713aSLionel Sambucvoid funct2(AStruct *aptr) { 50*f4a2713aSLionel Sambuc id **ppptr = somefunc(); 51*f4a2713aSLionel Sambuc aptr->alfred = 0; 52*f4a2713aSLionel Sambuc **ppptr = aptr->alfred; 53*f4a2713aSLionel Sambuc *ppptr = somefunc2(); 54*f4a2713aSLionel Sambuc} 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuctypedef const struct __CFString * CFStringRef; 57*f4a2713aSLionel Sambuc@interface DSATextSearch { 58*f4a2713aSLionel Sambuc__strong CFStringRef *_documentNames; 59*f4a2713aSLionel Sambuc struct { 60*f4a2713aSLionel Sambuc id *innerNames; 61*f4a2713aSLionel Sambuc struct { 62*f4a2713aSLionel Sambuc id *nestedDeeperNames; 63*f4a2713aSLionel Sambuc struct I { 64*f4a2713aSLionel Sambuc id *is1; 65*f4a2713aSLionel Sambuc id is2[5]; 66*f4a2713aSLionel Sambuc } arrI [3]; 67*f4a2713aSLionel Sambuc } inner_most; 68*f4a2713aSLionel Sambuc } inner; 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc} 71*f4a2713aSLionel Sambuc- filter; 72*f4a2713aSLionel Sambuc@end 73*f4a2713aSLionel Sambuc@implementation DSATextSearch 74*f4a2713aSLionel Sambuc- filter { 75*f4a2713aSLionel Sambuc int filteredPos = 0; 76*f4a2713aSLionel Sambuc _documentNames[filteredPos] = 0; // storing into an element of array ivar. objc_assign_strongCast is needed. 77*f4a2713aSLionel Sambuc inner.innerNames[filteredPos] = 0; 78*f4a2713aSLionel Sambuc inner.inner_most.nestedDeeperNames[filteredPos] = 0; 79*f4a2713aSLionel Sambuc inner.inner_most.arrI[3].is1[5] = 0; 80*f4a2713aSLionel Sambuc inner.inner_most.arrI[3].is2[5] = 0; 81*f4a2713aSLionel Sambuc} 82*f4a2713aSLionel Sambuc@end 83*f4a2713aSLionel Sambuc 84