diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-26 23:20:29 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-26 23:20:29 +0000 |
commit | b2eb0b494c2384f3935e5092d4227e4ea62eacb1 (patch) | |
tree | f154f1bcb31c1ec44fc63777f12942c4999d8d73 | |
parent | 314fe782fda562d1fe7d14d7135cc3f7736321c0 (diff) |
Another test for property code gen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60128 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CodeGenObjC/property-incr-decr-1.m | 29 |
1 files changed, 29 insertions, 0 deletions
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); +} + |