Fariborz Jahanian | 4abe3d3 | 2012-05-10 17:05:15 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -E %s -o %t.mm |
| 2 | // RUN: %clang_cc1 -x objective-c++ -fms-extensions -fobjc-default-synthesize-properties -rewrite-objc %t.mm -o %t-rw.cpp |
| 3 | // RUN: FileCheck --input-file=%t-rw.cpp %s |
| 4 | // RUN: %clang_cc1 -fsyntax-only -Werror -DSEL="void *" -Did="struct objc_object *" -Wno-attributes -Wno-address-of-temporary -U__declspec -D"__declspec(X)=" %t-rw.cpp |
| 5 | // rdar://11374235 |
| 6 | |
| 7 | extern "C" void *sel_registerName(const char *); |
| 8 | |
| 9 | @interface NSObject |
| 10 | - (void) release; |
| 11 | - (id) retain; |
| 12 | @end |
| 13 | @class NSString; |
| 14 | |
| 15 | @interface SynthItAll : NSObject |
| 16 | @property int howMany; |
| 17 | @property (retain) NSString* what; |
| 18 | @end |
| 19 | |
| 20 | @implementation SynthItAll |
| 21 | @end |
| 22 | |
| 23 | |
| 24 | @interface SynthSetter : NSObject |
| 25 | @property (nonatomic) int howMany; |
| 26 | @property (nonatomic, retain) NSString* what; |
| 27 | @end |
| 28 | |
| 29 | @implementation SynthSetter |
| 30 | |
| 31 | - (int) howMany { |
| 32 | return _howMany; |
| 33 | } |
| 34 | // - (void) setHowMany: (int) value |
| 35 | |
| 36 | - (NSString*) what { |
| 37 | return _what; |
| 38 | } |
| 39 | // - (void) setWhat: (NSString*) value |
| 40 | @end |
| 41 | |
| 42 | |
| 43 | @interface SynthGetter : NSObject |
| 44 | @property (nonatomic) int howMany; |
| 45 | @property (nonatomic, retain) NSString* what; |
| 46 | @end |
| 47 | |
| 48 | @implementation SynthGetter |
| 49 | // - (int) howMany |
| 50 | - (void) setHowMany: (int) value { |
| 51 | _howMany = value; |
| 52 | } |
| 53 | |
| 54 | // - (NSString*) what |
| 55 | - (void) setWhat: (NSString*) value { |
| 56 | if (_what != value) { |
| 57 | [_what release]; |
| 58 | _what = [value retain]; |
| 59 | } |
| 60 | } |
| 61 | @end |
| 62 | |
| 63 | typedef struct { |
| 64 | int x:1; |
| 65 | int y:1; |
| 66 | } TBAR; |
| 67 | |
| 68 | @interface NONAME |
| 69 | { |
| 70 | TBAR _bar; |
| 71 | } |
| 72 | @property TBAR bad; |
| 73 | @end |
| 74 | |
| 75 | @implementation NONAME |
| 76 | @end |
| 77 | |
| 78 | // CHECK: (*(int *)((char *)self + OBJC_IVAR_$_SynthItAll$_howMany)) = howMany; |
| 79 | // CHECK: return (*(int *)((char *)self + OBJC_IVAR_$_SynthGetter$_howMany)); |
| 80 | // CHECK: (*(TBAR *)((char *)self + OBJC_IVAR_$_NONAME$_bad)) = bad; |