diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGenObjC/objc2-write-barrier-2.m | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGenObjC/objc2-write-barrier-2.m')
-rw-r--r-- | clang/test/CodeGenObjC/objc2-write-barrier-2.m | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/objc2-write-barrier-2.m b/clang/test/CodeGenObjC/objc2-write-barrier-2.m new file mode 100644 index 0000000..eae2551 --- /dev/null +++ b/clang/test/CodeGenObjC/objc2-write-barrier-2.m @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: grep -F '@objc_assign_global' %t | count 7 +// RUN: grep -F '@objc_assign_ivar' %t | count 5 +// RUN: grep -F '@objc_assign_strongCast' %t | count 8 +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -fobjc-gc -emit-llvm -o %t %s +// RUN: grep -F '@objc_assign_global' %t | count 7 +// RUN: grep -F '@objc_assign_ivar' %t | count 5 +// RUN: grep -F '@objc_assign_strongCast' %t | count 8 + +extern id **somefunc(void); +extern id *somefunc2(void); + + +// Globals + +id W, *X, **Y; + +void func(id a, id *b, id **c) { + static id w, *x, **y; + W = a; + w = a; + X = b; + x = b; + Y = c; + y = c; +} + +// Instances + +@interface something { + id w, *x, **y; +} +@end + +@implementation something +- (void)amethod { + id badIdea = *somefunc2(); + w = badIdea; + x = &badIdea; + y = &x; +} +@end + +typedef struct { + int junk; + id alfred; +} AStruct; + +void funct2(AStruct *aptr) { + id **ppptr = somefunc(); + aptr->alfred = 0; + **ppptr = aptr->alfred; + *ppptr = somefunc2(); +} + +typedef const struct __CFString * CFStringRef; +@interface DSATextSearch { +__strong CFStringRef *_documentNames; + struct { + id *innerNames; + struct { + id *nestedDeeperNames; + struct I { + id *is1; + id is2[5]; + } arrI [3]; + } inner_most; + } inner; + +} +- filter; +@end +@implementation DSATextSearch +- filter { + int filteredPos = 0; + _documentNames[filteredPos] = 0; // storing into an element of array ivar. objc_assign_strongCast is needed. + inner.innerNames[filteredPos] = 0; + inner.inner_most.nestedDeeperNames[filteredPos] = 0; + inner.inner_most.arrI[3].is1[5] = 0; + inner.inner_most.arrI[3].is2[5] = 0; +} +@end + |