[cfe-commits] r67697 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp test/CodeGen/blocks-1.c test/CodeGenObjC/blocks-unsupported.m

Mike Stump mrs at apple.com
Wed Mar 25 11:05:39 PDT 2009


Author: mrs
Date: Wed Mar 25 13:05:39 2009
New Revision: 67697

URL: http://llvm.org/viewvc/llvm-project?rev=67697&view=rev
Log:
Remove -f__block as codegen for __block variables should be solid.

Removed:
    cfe/trunk/test/CodeGenObjC/blocks-unsupported.m
Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/test/CodeGen/blocks-1.c

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=67697&r1=67696&r2=67697&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Mar 25 13:05:39 2009
@@ -25,14 +25,6 @@
 // Temporary code to enable testing of __block variables
 // #include "clang/Frontend/CompileOptions.h"
 #include "llvm/Support/CommandLine.h"
-static llvm::cl::opt<bool>
-Enable__block("f__block",
-              // See all the FIXMEs for the various work that needs to be done
-              llvm::cl::desc("temporary option to turn on __block precessing "
-                             "even though the code isn't done yet"),
-              llvm::cl::ValueDisallowed, llvm::cl::AllowInverse,
-              llvm::cl::ZeroOrMore,
-              llvm::cl::init(true));
 
 llvm::Constant *CodeGenFunction::
 BuildDescriptorBlockDecl(bool BlockHasCopyDispose, uint64_t Size,
@@ -166,9 +158,6 @@
     BlockHasCopyDispose |= subBlockHasCopyDispose;
     Elts[3] = Fn;
 
-    if (!Enable__block && BlockHasCopyDispose)
-      ErrorUnsupported(BE, "block literal that requires copy/dispose");
-
     if (subBlockHasCopyDispose)
       flags |= BLOCK_HAS_COPY_DISPOSE;
 
@@ -488,17 +477,6 @@
   const llvm::Type *Ty;
   Ty = CGM.getTypes().ConvertType(E->getDecl()->getType());
 
-  if (!Enable__block && E->isByRef())
-    ErrorUnsupported(E, "__block variable in block literal");
-  else if (!Enable__block && E->getType()->isBlockPointerType())
-    ErrorUnsupported(E, "block pointer in block literal");
-  else if (!Enable__block && (E->getDecl()->getAttr<ObjCNSObjectAttr>() ||
-                              getContext().isObjCNSObjectType(E->getType())))
-    ErrorUnsupported(E, "__attribute__((NSObject)) variable in block "
-                     "literal");
-  else if (!Enable__block && getContext().isObjCObjectPointerType(E->getType()))
-    ErrorUnsupported(E, "Objective-C variable in block literal");
-
   // See if we have already allocated an offset for this variable.
   if (offset == 0) {
     // Don't run the expensive check, unless we have to.

Modified: cfe/trunk/test/CodeGen/blocks-1.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/blocks-1.c?rev=67697&r1=67696&r2=67697&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/blocks-1.c (original)
+++ cfe/trunk/test/CodeGen/blocks-1.c Wed Mar 25 13:05:39 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc %s -emit-llvm -o %t -fblocks -f__block &&
+// RUN: clang-cc %s -emit-llvm -o %t -fblocks &&
 // RUN: grep "_Block_object_dispose" %t | count 15 &&
 // RUN: grep "__copy_helper_block_" %t | count 12 &&
 // RUN: grep "__destroy_helper_block_" %t | count 12 &&

Removed: cfe/trunk/test/CodeGenObjC/blocks-unsupported.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/blocks-unsupported.m?rev=67696&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/blocks-unsupported.m (original)
+++ cfe/trunk/test/CodeGenObjC/blocks-unsupported.m (removed)
@@ -1,32 +0,0 @@
-// RUN: clang-cc -fblocks -fno-__block -fnext-runtime --emit-llvm -o %t %s -verify
-
- at class Foo;
- at protocol P;
-
-void t1()
-{
-  __block int a;
-  ^{ a = 10; }(); // expected-error {{cannot compile this __block variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  void (^block)(void);
-  ^{ (void)block; }(); // expected-error {{cannot compile this block pointer in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  struct Foo *__attribute__ ((NSObject)) foo;
-  ^{ (void)foo; }(); // expected-error {{cannot compile this __attribute__((NSObject)) variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef;
-  CGColorRef color;
-  ^{ (void)color; }(); // expected-error {{cannot compile this __attribute__((NSObject)) variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  id a1;
-  ^{ (void)a1; }(); // expected-error {{cannot compile this Objective-C variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  Foo *a2;
-  ^{ (void)a2; }(); // expected-error {{cannot compile this Objective-C variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  id<P> a3;
-  ^{ (void)a3; }(); // expected-error {{cannot compile this Objective-C variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-
-  Foo<P> *a4;
-  ^{ (void)a4; }(); // expected-error {{cannot compile this Objective-C variable in block literal yet}} expected-error {{cannot compile this block literal that requires copy/dispose yet}}
-}





More information about the cfe-commits mailing list