]> granicus.if.org Git - clang/commitdiff
Another test for property code gen.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Nov 2008 23:20:29 +0000 (23:20 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Nov 2008 23:20:29 +0000 (23:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60128 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGenObjC/property-incr-decr-1.m [new file with mode: 0644]

diff --git a/test/CodeGenObjC/property-incr-decr-1.m b/test/CodeGenObjC/property-incr-decr-1.m
new file mode 100644 (file)
index 0000000..4ca84f1
--- /dev/null
@@ -0,0 +1,29 @@
+// RUN: clang -emit-llvm -o %t %s
+
+@interface Object
+- (id) new;
+@end
+
+@interface SomeClass : Object
+{
+  int _myValue;
+}
+@property int myValue;
+@end
+
+@implementation SomeClass
+@synthesize myValue=_myValue;
+@end
+
+int main()
+{
+    int val;
+    SomeClass *o = [SomeClass new];
+    o.myValue = -1;
+    val = o.myValue++; /* val -1, o.myValue 0 */
+    val += o.myValue--; /* val -1. o.myValue -1 */
+    val += ++o.myValue; /* val -1, o.myValue 0 */
+    val += --o.myValue; /* val -2, o.myValue -1 */
+    return ++o.myValue + (val+2);
+}
+