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