]> granicus.if.org Git - clang/commitdiff
Block ivar layout must assume that the 'isa'
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 9 Sep 2010 00:21:45 +0000 (00:21 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 9 Sep 2010 00:21:45 +0000 (00:21 +0000)
field of the block descriptor is GC'able (scanned)
as this what the runtime expects (one can send it
messages). Radar 8394947.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113454 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp
test/CodeGenObjC/block-var-layout.m

index 9bd1d661e7d7b4b9eca3cf5e3b512ac7c12ec362..82541356863c6ec60e401bb82036bbb29094227f 100644 (file)
@@ -1675,6 +1675,9 @@ llvm::Constant *CGObjCCommonMac::GCBlockLayout(CodeGen::CodeGenFunction &CGF,
   unsigned WordSizeInBits = CGM.getContext().Target.getPointerWidth(0);
   unsigned ByteSizeInBits = CGM.getContext().Target.getCharWidth();
   
+  // __isa is the first field in block descriptor and must assume by runtime's
+  // convention that it is GC'able.
+  IvarsInfo.push_back(GC_IVAR(0, 1));
   for (size_t i = 0; i < DeclRefs.size(); ++i) {
     const BlockDeclRefExpr *BDRE = DeclRefs[i];
     const ValueDecl *VD = BDRE->getDecl();
index bf9ba8df75e253c900ebc29c4e8d6fea2469bbf9..f57d7d99cd5ff124e9f09333272ac5a4ea309247 100644 (file)
@@ -108,16 +108,16 @@ c();
 }
 
 // CHECK-LP64: L_OBJC_CLASS_NAME_:
-// CHECK-LP64-NEXT: .asciz      "A\024"
+// CHECK-LP64-NEXT: .asciz      "\0011\024"
 
 // CHECK-LP64: L_OBJC_CLASS_NAME_1:
-// CHECK-LP64-NEXT: .asciz   "A\025"
+// CHECK-LP64-NEXT: .asciz   "\0011\025"
 
 // CHECK-LP64: L_OBJC_CLASS_NAME_6:
-// CHECK-LP64-NEXT: .asciz   "A\023!"
+// CHECK-LP64-NEXT: .asciz   "\0011\023!"
 
 // CHECK-LP64: L_OBJC_CLASS_NAME_11:
-// CHECK-LP64-NEXT: .asciz   "Q\021\021"
+// CHECK-LP64-NEXT: .asciz   "\001A\021\021"
 
 // CHECK-LP64: L_OBJC_CLASS_NAME_14:
-// CHECK-LP64-NEXT: .asciz   "Q\021\022p"
+// CHECK-LP64-NEXT: .asciz   "\001A\021\022p"