summaryrefslogtreecommitdiff
path: root/test/ARCMT
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-10-09 18:30:56 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-10-09 18:30:56 +0000
commit24102cbb723f89e96c0876e7d85a7f64053c95ca (patch)
tree75719d1480323771001d498dd1bfe497c7c68c1b /test/ARCMT
parent4cdae708987963d75db8e91d4a1c19754b7625c2 (diff)
Objective-C SDK modernization. convert message expression
to Objective-C dot-syntax. rdar://18498572 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ARCMT')
-rw-r--r--test/ARCMT/objcmt-property-dot-syntax.m39
-rw-r--r--test/ARCMT/objcmt-property-dot-syntax.m.result39
2 files changed, 78 insertions, 0 deletions
diff --git a/test/ARCMT/objcmt-property-dot-syntax.m b/test/ARCMT/objcmt-property-dot-syntax.m
new file mode 100644
index 0000000000..ce6dc162ea
--- /dev/null
+++ b/test/ARCMT/objcmt-property-dot-syntax.m
@@ -0,0 +1,39 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
+// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
+// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
+
+// rdar://18498572
+@interface NSObject @end
+
+@interface P : NSObject
+{
+ P* obj;
+ int i1, i2, i3;
+}
+@property int count;
+@property (copy) P* PropertyReturnsPObj;
+- (P*) MethodReturnsPObj;
+@end
+
+P* fun();
+
+@implementation P
+- (int) Meth : (P*)array {
+ [obj setCount : 100];
+
+ [(P*)0 setCount : [array count]];
+
+ [[obj PropertyReturnsPObj] setCount : [array count]];
+
+ [obj setCount : (i1+i2*i3 - 100)];
+
+ return [obj count] -
+ [(P*)0 count] + [array count] +
+ [fun() count] -
+ [[obj PropertyReturnsPObj] count] +
+ [self->obj count];
+}
+
+- (P*) MethodReturnsPObj { return 0; }
+@end
diff --git a/test/ARCMT/objcmt-property-dot-syntax.m.result b/test/ARCMT/objcmt-property-dot-syntax.m.result
new file mode 100644
index 0000000000..0532c6f67c
--- /dev/null
+++ b/test/ARCMT/objcmt-property-dot-syntax.m.result
@@ -0,0 +1,39 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -objcmt-migrate-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
+// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
+// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
+
+// rdar://18498572
+@interface NSObject @end
+
+@interface P : NSObject
+{
+ P* obj;
+ int i1, i2, i3;
+}
+@property int count;
+@property (copy) P* PropertyReturnsPObj;
+@property (nonatomic, readonly, strong) P *MethodReturnsPObj;
+@end
+
+P* fun();
+
+@implementation P
+- (int) Meth : (P*)array {
+ obj.count = 100;
+
+ ((P*)0).count = array.count;
+
+ obj.PropertyReturnsPObj.count = array.count;
+
+ obj.count = (i1+i2*i3 - 100);
+
+ return obj.count -
+ ((P*)0).count + array.count +
+ fun().count -
+ obj.PropertyReturnsPObj.count +
+ self->obj.count;
+}
+
+- (P*) MethodReturnsPObj { return 0; }
+@end