diff options
author | Mike Stump <mrs@apple.com> | 2009-03-05 08:32:30 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-03-05 08:32:30 +0000 |
commit | 00470a1c4c44c5ed26bad9a38b4d3904b02d7a28 (patch) | |
tree | b6a40a078a9a78a6123ae14a9da63e742bae8628 /lib/CodeGen/CGDecl.cpp | |
parent | 7d22bf00dbabca86ba791f56a99e006181fa22dd (diff) |
prep work for copy/destroy helpers for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66159 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index f31a05a9a6..3dfb1821cc 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -338,6 +338,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { int flag = 0; int flags = 0; + // The block literal will need a copy/destroy helper. + BlockHasCopyDispose = true; + if (Ty->isBlockPointerType()) { flag |= BLOCK_FIELD_IS_BLOCK; flags |= BLOCK_HAS_COPY_DISPOSE; @@ -360,11 +363,15 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { V = llvm::ConstantInt::get(llvm::Type::Int32Ty, flags); Builder.CreateStore(V, flags_field); - const llvm::Type *V1 = cast<llvm::PointerType>(DeclPtr->getType())->getElementType(); - V = llvm::ConstantInt::get(llvm::Type::Int32Ty, CGM.getTargetData().getTypeStoreSizeInBits(V1) / 8); + const llvm::Type *V1; + V1 = cast<llvm::PointerType>(DeclPtr->getType())->getElementType(); + V = llvm::ConstantInt::get(llvm::Type::Int32Ty, + (CGM.getTargetData().getTypeStoreSizeInBits(V1) + / 8)); Builder.CreateStore(V, size_field); if (flags & BLOCK_HAS_COPY_DISPOSE) { + BlockHasCopyDispose = true; llvm::Value *copy_helper = Builder.CreateStructGEP(DeclPtr, 4); llvm::Value *destroy_helper = Builder.CreateStructGEP(DeclPtr, 5); |