From: Fariborz Jahanian Date: Wed, 26 Nov 2008 23:20:29 +0000 (+0000) Subject: Another test for property code gen. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2eb0b494c2384f3935e5092d4227e4ea62eacb1;p=clang Another test for property code gen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60128 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenObjC/property-incr-decr-1.m b/test/CodeGenObjC/property-incr-decr-1.m new file mode 100644 index 0000000000..4ca84f1fb7 --- /dev/null +++ b/test/CodeGenObjC/property-incr-decr-1.m @@ -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); +} +