]> granicus.if.org Git - clang/commitdiff
Don't assert when we think we need copy/dispose, but don't need them.
authorMike Stump <mrs@apple.com>
Fri, 1 May 2009 01:31:57 +0000 (01:31 +0000)
committerMike Stump <mrs@apple.com>
Fri, 1 May 2009 01:31:57 +0000 (01:31 +0000)
Radar 6838889

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70525 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp
test/CodeGen/blocks.c

index 8ab4a44f40b7e64887ff0ec26da7d4597cabeb5c..dee9d4ce9b4110b778bf63d4f8f4dc9294b01f9c 100644 (file)
@@ -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();
index c7fe3a91d25bf0cf6bb67aff90f9980c6e1bbcaf..39c5b06b1727f6ff4aefa560b7743a0c17b743e6 100644 (file)
@@ -22,5 +22,9 @@ void *P = ^{
   void *Q = __func__;
 };
 
+void (^test1)(void) = ^(void) {
+  __block int i;
+  ^ { i = 1; }();
+};
 
 // RUN: true