From b2eb0b494c2384f3935e5092d4227e4ea62eacb1 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 26 Nov 2008 23:20:29 +0000 Subject: [PATCH] Another test for property code gen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60128 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGenObjC/property-incr-decr-1.m | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/CodeGenObjC/property-incr-decr-1.m 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); +} + -- 2.50.1