[cfe-commits] r154592 - in /cfe/trunk: lib/Rewrite/RewriteModernObjC.cpp test/Rewriter/rewrite-modern-block.mm

Fariborz Jahanian fjahanian at apple.com
Thu Apr 12 09:33:31 PDT 2012


Author: fjahanian
Date: Thu Apr 12 11:33:31 2012
New Revision: 154592

URL: http://llvm.org/viewvc/llvm-project?rev=154592&view=rev
Log:
modern objective-c translator. ifdef'out 
__weak and __block when rewriting.
// rdar://11236342


Modified:
    cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
    cfe/trunk/test/Rewriter/rewrite-modern-block.mm

Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=154592&r1=154591&r2=154592&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Thu Apr 12 11:33:31 2012
@@ -5726,7 +5726,12 @@
     Preamble += "#ifndef KEEP_ATTRIBUTES\n";  // We use this for clang tests.
     Preamble += "#define __attribute__(X)\n";
     Preamble += "#endif\n";
+    Preamble += "#ifndef __weak\n";
     Preamble += "#define __weak\n";
+    Preamble += "#endif\n";
+    Preamble += "#ifndef __block\n";
+    Preamble += "#define __block\n";
+    Preamble += "#endif\n";
   }
   else {
     Preamble += "#define __block\n";

Modified: cfe/trunk/test/Rewriter/rewrite-modern-block.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-modern-block.mm?rev=154592&r1=154591&r2=154592&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-modern-block.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-modern-block.mm Thu Apr 12 11:33:31 2012
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
 // rdar://11230308
 
 typedef struct {
@@ -16,3 +16,8 @@
         x(&bytes);
     };
 }
+
+// rdar://11236342
+int foo() {
+    __block int hello;
+}





More information about the cfe-commits mailing list