The ARC Migration Tool. All the credit goes to Argyrios and Fariborz
for this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133104 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/ARCMT/rewrite-block-var.m b/test/ARCMT/rewrite-block-var.m
new file mode 100644
index 0000000..70da6786
--- /dev/null
+++ b/test/ARCMT/rewrite-block-var.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c %s.result -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000
+// RUN: arcmt-test --args -arch x86_64 %s -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 > %t
+// RUN: diff %t %s.result
+
+#include "Common.h"
+
+@interface Foo : NSObject
+-(Foo *)something;
+@end
+
+void bar(void (^block)());
+
+void test1(Foo *p) {
+ __block Foo *x = p; // __block used just to break cycle.
+ bar(^{
+ [x something];
+ });
+}
+
+void test2(Foo *p) {
+ __block Foo *x; // __block used as output variable.
+ bar(^{
+ x = [p something];
+ });
+}