diff options
-rw-r--r-- | lib/Rewrite/RewriteModernObjC.cpp | 5 | ||||
-rw-r--r-- | test/Rewriter/rewrite-modern-block.mm | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp index fd621a2a5c..ba62ad3c41 100644 --- a/lib/Rewrite/RewriteModernObjC.cpp +++ b/lib/Rewrite/RewriteModernObjC.cpp @@ -5726,7 +5726,12 @@ void RewriteModernObjC::Initialize(ASTContext &context) { 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"; diff --git a/test/Rewriter/rewrite-modern-block.mm b/test/Rewriter/rewrite-modern-block.mm index c5231bfceb..8da723d319 100644 --- a/test/Rewriter/rewrite-modern-block.mm +++ b/test/Rewriter/rewrite-modern-block.mm @@ -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 @@ void y() { x(&bytes); }; } + +// rdar://11236342 +int foo() { + __block int hello; +} |