[cfe-commits] r60128 - /cfe/trunk/test/CodeGenObjC/property-incr-decr-1.m

Fariborz Jahanian fjahanian at apple.com
Wed Nov 26 15:20:29 PST 2008


Author: fjahanian
Date: Wed Nov 26 17:20:29 2008
New Revision: 60128

URL: http://llvm.org/viewvc/llvm-project?rev=60128&view=rev
Log:
Another test for property code gen.

Added:
    cfe/trunk/test/CodeGenObjC/property-incr-decr-1.m

Added: cfe/trunk/test/CodeGenObjC/property-incr-decr-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/property-incr-decr-1.m?rev=60128&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/property-incr-decr-1.m (added)
+++ cfe/trunk/test/CodeGenObjC/property-incr-decr-1.m Wed Nov 26 17:20:29 2008
@@ -0,0 +1,29 @@
+// RUN: clang -emit-llvm -o %t %s
+
+ at interface Object
+- (id) new;
+ at end
+
+ at interface SomeClass : Object
+{
+  int _myValue;
+}
+ at property int myValue;
+ at end
+
+ at implementation SomeClass
+ at synthesize myValue=_myValue;
+ at 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);
+}
+





More information about the cfe-commits mailing list