Move where block-related variables are initialized so that block

types don't get generated when blocks aren't used.

llvm-svn: 67898
This commit is contained in:
Eli Friedman
2009-03-28 03:24:54 +00:00
parent 7c7a0e86ae
commit 09a9b6e335
3 changed files with 12 additions and 12 deletions

View File

@@ -625,6 +625,16 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
LocalDeclMap[VD] = i->second;
}
// FIXME: We need to rearrange the code for copy/dispose so we have this
// sooner, so we can calculate offsets correctly.
if (!BlockHasCopyDispose)
BlockOffset = CGM.getTargetData()
.getTypeStoreSizeInBits(CGM.getGenericBlockLiteralType()) / 8;
else
BlockOffset = CGM.getTargetData()
.getTypeStoreSizeInBits(CGM.getGenericExtendedBlockLiteralType()) / 8;
BlockAlign = getContext().getTypeAlign(getContext().VoidPtrTy) / 8;
const FunctionProtoType *FTy =
cast<FunctionProtoType>(BExpr->getFunctionType());