]> granicus.if.org Git - clang/commitdiff
Be sure to mark blocks with no imports as being global.
authorMike Stump <mrs@apple.com>
Sun, 1 Mar 2009 20:07:53 +0000 (20:07 +0000)
committerMike Stump <mrs@apple.com>
Sun, 1 Mar 2009 20:07:53 +0000 (20:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65784 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp

index 703615a500bc7f3fa3c43faddda1fbc7b5927a68..da7afe1d436fc479ec42f5a0c76e66edd44e9d60 100644 (file)
@@ -223,6 +223,10 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
     Elts.push_back(BuildDescriptorBlockDecl(subBlockSize));
 
     if (subBlockDeclRefDecls.size() == 0) {
+      // Optimize to being a global block.
+      Elts[0] = CGM.getNSConcreteGlobalBlock();
+      Elts[1] = llvm::ConstantInt::get(IntTy, flags|BLOCK_IS_GLOBAL);
+
       C = llvm::ConstantStruct::get(Elts);
 
       char Name[32];