diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-03-28 03:24:54 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-03-28 03:24:54 +0000 |
commit | 09a9b6e33524a9dc1c23f38adb146f61b64b8ff0 (patch) | |
tree | 069a62c650b702b931c4f90885ac173f43974bbd /clang/lib/CodeGen/CGBlocks.cpp | |
parent | 7c7a0e86aed7354c1a59c611c079e8053c7b8d12 (diff) | |
download | bcm5719-llvm-09a9b6e33524a9dc1c23f38adb146f61b64b8ff0.tar.gz bcm5719-llvm-09a9b6e33524a9dc1c23f38adb146f61b64b8ff0.zip |
Move where block-related variables are initialized so that block
types don't get generated when blocks aren't used.
llvm-svn: 67898
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index db1539bd632..16e926ba643 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -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()); |