brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 68a9e77 Raw
85 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s2// RUN: grep -F '@objc_assign_global' %t  | count 73// RUN: grep -F '@objc_assign_ivar' %t  | count 54// RUN: grep -F '@objc_assign_strongCast' %t  | count 85// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s6// RUN: grep -F '@objc_assign_global' %t  | count 77// RUN: grep -F '@objc_assign_ivar' %t  | count 58// RUN: grep -F '@objc_assign_strongCast' %t  | count 89 10extern id **somefunc(void);11extern id *somefunc2(void);12 13 14// Globals15 16id W, *X, **Y;17 18void func(id a, id *b, id **c) {19   static id w, *x, **y;20   W = a;  21   w = a;22   X = b;23   x = b; 24   Y = c;25   y = c; 26}27 28// Instances29 30@interface something {31    id w, *x, **y;32}33@end34 35@implementation something36- (void)amethod {37    id badIdea = *somefunc2();38    w = badIdea;39    x = &badIdea;40    y = &x;41}42@end43 44typedef struct {45    int junk;46    id  alfred;47} AStruct;48 49void funct2(AStruct *aptr) {50    id **ppptr = somefunc();51    aptr->alfred = 0;52    **ppptr = aptr->alfred;53    *ppptr = somefunc2(); 54}55 56typedef const struct __CFString * CFStringRef;57@interface DSATextSearch {58__strong CFStringRef *_documentNames;59  struct {60    id *innerNames;61    struct {62      id *nestedDeeperNames; 63      struct I {64         id *is1;65         id is2[5];66      } arrI [3];67    } inner_most;68  } inner;69 70}71- filter;72@end73@implementation DSATextSearch74- filter {75  int filteredPos = 0;76  _documentNames[filteredPos] = 0; // storing into an element of array ivar. objc_assign_strongCast is needed.77  inner.innerNames[filteredPos] = 0;78  inner.inner_most.nestedDeeperNames[filteredPos] = 0;79  inner.inner_most.arrI[3].is1[5] = 0;80  inner.inner_most.arrI[3].is2[5] = 0;81  return 0;82}83@end84 85