summaryrefslogtreecommitdiffstats
path: root/clang/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
commitfbe25dd1e4815eda2430a424181630620ce5085d (patch)
tree3375ece83b82840399809f5996c5ab3fc1192cdc /clang/lib/CodeGen/CGDecl.cpp
parentd4a96730c1986b96f246fbc8df7adb5bcdbc4e4d (diff)
downloadbcm5719-llvm-fbe25dd1e4815eda2430a424181630620ce5085d.tar.gz
bcm5719-llvm-fbe25dd1e4815eda2430a424181630620ce5085d.zip
Finish off __Block_byref_id_object_dispose codegen for block literals.
llvm-svn: 66247
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index e783c6018f8..cf9b7411681 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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);
}
}
OpenPOWER on IntegriCloud