diff options
author | Mike Stump <mrs@apple.com> | 2009-05-01 01:31:57 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-05-01 01:31:57 +0000 |
commit | dd2fb9c5ebc02f48a5b91a9c2a5f1e4562d02a0b (patch) | |
tree | dcc7af7b431730efd269220965e8b38fdac147d4 | |
parent | bad3a94d506874355fc15b336c6f0ed360e46a06 (diff) |
Don't assert when we think we need copy/dispose, but don't need them.
Radar 6838889
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70525 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGBlocks.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/blocks.c | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 8ab4a44f40..dee9d4ce9b 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -158,6 +158,8 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { BlockHasCopyDispose |= subBlockHasCopyDispose; Elts[3] = Fn; + // FIXME: Don't use BlockHasCopyDispose, it is set more often then necessary, for + // example: { ^{ __block int i; ^{ i = 1; }(); }(); } if (subBlockHasCopyDispose) flags |= BLOCK_HAS_COPY_DISPOSE; @@ -557,7 +559,6 @@ BlockModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) { subBlockHasCopyDispose); assert(subBlockSize == BlockLiteralSize && "no imports allowed for global block"); - assert(!subBlockHasCopyDispose && "no imports allowed for global block"); // isa LiteralFields[0] = getNSConcreteGlobalBlock(); diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c index c7fe3a91d2..39c5b06b17 100644 --- a/test/CodeGen/blocks.c +++ b/test/CodeGen/blocks.c @@ -22,5 +22,9 @@ void *P = ^{ void *Q = __func__; }; +void (^test1)(void) = ^(void) { + __block int i; + ^ { i = 1; }(); +}; // RUN: true |