From: Mike Stump Date: Fri, 13 Feb 2009 17:03:17 +0000 (+0000) Subject: Calculate size correctly. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ba8215d5b14fca14835076f0f40334ecc967121;p=clang Calculate size correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64459 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index f987af70d3..a7f5aacde7 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -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) {