[cfe-commits] r96501 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp test/CodeGenObjC/blocks-5.m
Fariborz Jahanian
fjahanian at apple.com
Wed Feb 17 11:54:08 PST 2010
Author: fjahanian
Date: Wed Feb 17 13:54:08 2010
New Revision: 96501
URL: http://llvm.org/viewvc/llvm-project?rev=96501&view=rev
Log:
Patch to remove arbitrary imporation of 'self' into
a block without it being used. This causes over release
of objects in certain runtime-senitive apps.
(fixes radar 7581175).
Added:
cfe/trunk/test/CodeGenObjC/blocks-5.m
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=96501&r1=96500&r2=96501&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Feb 17 13:54:08 2010
@@ -110,19 +110,6 @@
/// invoke function.
static void AllocateAllBlockDeclRefs(const CodeGenFunction::BlockInfo &Info,
CodeGenFunction *CGF) {
- // Always allocate self, as it is often handy in the debugger, even if there
- // is no codegen in the block that uses it. This is also useful to always do
- // this as if we didn't, we'd have to figure out all code that uses a self
- // pointer, including implicit uses.
- if (const ObjCMethodDecl *OMD
- = dyn_cast_or_null<ObjCMethodDecl>(CGF->CurFuncDecl)) {
- ImplicitParamDecl *SelfDecl = OMD->getSelfDecl();
- BlockDeclRefExpr *BDRE = new (CGF->getContext())
- BlockDeclRefExpr(SelfDecl,
- SelfDecl->getType(), SourceLocation(), false);
- CGF->AllocateBlockDecl(BDRE);
- }
-
// FIXME: Also always forward the this pointer in C++ as well.
for (size_t i = 0; i < Info.DeclRefs.size(); ++i)
Added: cfe/trunk/test/CodeGenObjC/blocks-5.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/blocks-5.m?rev=96501&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/blocks-5.m (added)
+++ cfe/trunk/test/CodeGenObjC/blocks-5.m Wed Feb 17 13:54:08 2010
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// radar 7581175
+
+extern void dispatch_async (void (^)(void));
+
+ at interface Foo
+ at end
+
+ at implementation Foo
+- (void)dealloc {
+ dispatch_async(^{});
+}
+ at end
+
+// CHECK: self.addr
+// CHECK: self.addr
More information about the cfe-commits
mailing list