aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-03-06 04:53:30 +0000
committerMike Stump <mrs@apple.com>2009-03-06 04:53:30 +0000
commit1851b68aaa6717783609f366f5d87bbd0030f189 (patch)
tree47dc00890afffd0e39bc2c148b66aee9a11c6dfe /lib/CodeGen/CGDecl.cpp
parentb627c8d683c4d3facd774c432b1fdc2d35819369 (diff)
Finish off __Block_byref_id_object_dispose codegen for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index e783c6018f..cf9b741168 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -345,8 +345,8 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
flag |= BLOCK_FIELD_IS_BLOCK;
flags |= BLOCK_HAS_COPY_DISPOSE;
} else if (BlockRequiresCopying(Ty)) {
- flags |= BLOCK_HAS_COPY_DISPOSE;
flag |= BLOCK_FIELD_IS_OBJECT;
+ flags |= BLOCK_HAS_COPY_DISPOSE;
}
// FIXME: Need to set BLOCK_FIELD_IS_WEAK as appropriate.
@@ -373,11 +373,11 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
if (flags & BLOCK_HAS_COPY_DISPOSE) {
BlockHasCopyDispose = true;
llvm::Value *copy_helper = Builder.CreateStructGEP(DeclPtr, 4);
- llvm::Value *destroy_helper = Builder.CreateStructGEP(DeclPtr, 5);
-
Builder.CreateStore(BuildbyrefCopyHelper(flag), copy_helper);
- Builder.CreateStore(BuildbyrefDestroyHelper(flag), destroy_helper);
+ llvm::Value *destroy_helper = Builder.CreateStructGEP(DeclPtr, 5);
+ Builder.CreateStore(BuildbyrefDestroyHelper(DeclPtr->getType(), flag),
+ destroy_helper);
}
needsDispose = true;
}
@@ -400,7 +400,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
if (needsDispose && CGM.getLangOptions().getGCMode() != LangOptions::GCOnly) {
CleanupScope scope(*this);
- BuildBlockRelease(DeclPtr);
+ llvm::Value *V = Builder.CreateStructGEP(DeclPtr, 1, "forwarding");
+ V = Builder.CreateLoad(V, false);
+ BuildBlockRelease(V);
}
}