From 2e32ddc7bac1c99b68f537bb7ba30b40a3437a45 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 18 Sep 2009 00:04:00 +0000 Subject: Fixed a bug in generation of the new write-barriers when array syntax is used to derefernce and assign to ivar pointee. llvm-svn: 82183 --- clang/test/CodeGenObjC/objc2-write-barrier-2.m | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'clang/test/CodeGenObjC') diff --git a/clang/test/CodeGenObjC/objc2-write-barrier-2.m b/clang/test/CodeGenObjC/objc2-write-barrier-2.m index 14ffcbe7d70..e62f362f9db 100644 --- a/clang/test/CodeGenObjC/objc2-write-barrier-2.m +++ b/clang/test/CodeGenObjC/objc2-write-barrier-2.m @@ -1,7 +1,7 @@ // RUN: clang-cc -fnext-runtime -fobjc-gc -fobjc-newgc-api -emit-llvm -o %t %s && // RUN: grep -F '@objc_assign_global' %t | count 7 && -// RUN: grep -F '@objc_assign_ivar' %t | count 4 && -// RUN: grep -F '@objc_assign_strongCast' %t | count 4 && +// RUN: grep -F '@objc_assign_ivar' %t | count 5 && +// RUN: grep -F '@objc_assign_strongCast' %t | count 8 && // RUN: true extern id **somefunc(void); @@ -50,3 +50,31 @@ void funct2(AStruct *aptr) { *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 + -- cgit v1.2.3