]> granicus.if.org Git - clang/commitdiff
Calculate size correctly.
authorMike Stump <mrs@apple.com>
Fri, 13 Feb 2009 17:03:17 +0000 (17:03 +0000)
committerMike Stump <mrs@apple.com>
Fri, 13 Feb 2009 17:03:17 +0000 (17:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64459 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp

index f987af70d327df6ee041d3b0a11c2cce1ff483e1..a7f5aacde7273c2f8278d248e2803350cff2e3e8 100644 (file)
@@ -46,8 +46,9 @@ llvm::Constant *CodeGenFunction::BuildDescriptorBlockDecl() {
   Elts.push_back(C);
 
   // Size
-  // FIXME: This should be the size of BlockStructType
-  C = llvm::ConstantInt::get(UnsignedLongTy, 20);
+  int sz = CGM.getTargetData()
+    .getTypeStoreSizeInBits(CGM.getGenericBlockLiteralType()) / 8;
+  C = llvm::ConstantInt::get(UnsignedLongTy, sz);
   Elts.push_back(C);
 
   if (BlockHasCopyDispose) {