diff options
author | John McCall <rjmccall@apple.com> | 2011-02-16 00:49:34 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-16 00:49:34 +0000 |
commit | bf9a86b50f04943b629650438508b0df1c5109dc (patch) | |
tree | f968745288a54cc733eee77143d7395dbb996333 /clang/lib/CodeGen/CGBlocks.cpp | |
parent | 1a36219c865c40cff3f5cd354e9403fbaae8b24d (diff) | |
download | bcm5719-llvm-bf9a86b50f04943b629650438508b0df1c5109dc.tar.gz bcm5719-llvm-bf9a86b50f04943b629650438508b0df1c5109dc.zip |
Don't call objc_read_weak as part of emitting a block literal.
Nobody ever gave me a clear reason for why we were doing this, and
now it's apparently causing serious problems, so if *not* having this
causes problems, we get to solve them the right way this time.
llvm-svn: 125627
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index fb90e025eb7..a35648d23d5 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -27,8 +27,7 @@ using namespace CodeGen; CGBlockInfo::CGBlockInfo(const BlockExpr *blockExpr, const char *N) : Name(N), CXXThisIndex(0), CanBeGlobal(false), NeedsCopyDispose(false), - HasCXXObject(false), HasWeakBlockVariable(false), - StructureType(0), Block(blockExpr) { + HasCXXObject(false), StructureType(0), Block(blockExpr) { // Skip asm prefix, if any. if (Name && Name[0] == '\01') @@ -355,10 +354,6 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // We have to copy/dispose of the __block reference. info.NeedsCopyDispose = true; - // Also note that it's weak for GC purposes. - if (variable->getType().isObjCGCWeak()) - info.HasWeakBlockVariable = true; - // Just use void* instead of a pointer to the byref type. QualType byRefPtrTy = C.VoidPtrTy; @@ -650,22 +645,6 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const BlockExpr *blockExpr) { Builder.CreateBitCast(blockAddr, ConvertType(blockInfo.getBlockExpr()->getType())); - // We must call objc_read_weak on the block literal itself if it closes - // on any __weak __block variables. For some reason. - if (blockInfo.HasWeakBlockVariable) { - const llvm::Type *OrigTy = result->getType(); - - // Must cast argument to id* - const llvm::Type *ObjectPtrTy = - ConvertType(CGM.getContext().getObjCIdType()); - const llvm::Type *PtrObjectPtrTy = - llvm::PointerType::getUnqual(ObjectPtrTy); - result = Builder.CreateBitCast(result, PtrObjectPtrTy); - result = CGM.getObjCRuntime().EmitObjCWeakRead(*this, result); - - // Cast back to the original type. - result = Builder.CreateBitCast(result, OrigTy); - } return result; } |