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