[cfe-commits] r81479 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/objc2-strong-cast-4.m

Fariborz Jahanian fjahanian at apple.com
Thu Sep 10 16:38:45 PDT 2009


Author: fjahanian
Date: Thu Sep 10 18:38:45 2009
New Revision: 81479

URL: http://llvm.org/viewvc/llvm-project?rev=81479&view=rev
Log:
Fix a regression where write-barrier was not being generated 
for block pointer.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=81479&r1=81478&r2=81479&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Sep 10 18:38:45 2009
@@ -3391,7 +3391,7 @@
     // (or pointers to them) be treated as though they were declared
     // as __strong.
     if (GCAttrs == QualType::GCNone) {
-      if (Ty->isObjCObjectPointerType())
+      if (Ty->isObjCObjectPointerType() || Ty->isBlockPointerType())
         GCAttrs = QualType::Strong;
       else if (Ty->isPointerType())
         return getObjCGCAttrKind(Ty->getAs<PointerType>()->getPointeeType());

Modified: cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m?rev=81479&r1=81478&r2=81479&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m (original)
+++ cfe/trunk/test/CodeGenObjC/objc2-strong-cast-4.m Thu Sep 10 18:38:45 2009
@@ -1,5 +1,5 @@
 // RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
-// RUN: grep objc_assign_strongCast %t | count 7 &&
+// RUN: grep objc_assign_strongCast %t | count 8 &&
 // RUN: true
 
 struct Slice {
@@ -14,6 +14,14 @@
 }
 @end
 
+typedef void (^observer_block_t)(id object);
+ at interface Observer  {
+ at public
+    observer_block_t block;
+}
+ at end
+
+
 void foo (int i) {
     // storing into an array of strong pointer types.
     void *__strong* items;
@@ -32,4 +40,7 @@
     islice->IvarItem = 0;
     // Storing into an ivar of an array of strong pointer types.
     islice->IvarItem[i] = (void*)0;
+
+    Observer *observer;
+    observer->block = 0;
 }





More information about the cfe-commits mailing list