2011-01-05 04:05:20 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
|
2010-02-10 05:49:50 +08:00
|
|
|
|
|
|
|
@interface NSString @end
|
|
|
|
|
|
|
|
@interface NSObject @end
|
|
|
|
|
|
|
|
@interface SynthItAll
|
|
|
|
@property int howMany;
|
|
|
|
@property (retain) NSString* what;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation SynthItAll
|
|
|
|
//@synthesize howMany, what;
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface SynthSetter : NSObject
|
|
|
|
@property (nonatomic) int howMany; // REM: nonatomic to avoid warnings about only implementing one of the pair
|
|
|
|
@property (nonatomic, retain) NSString* what;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation SynthSetter
|
|
|
|
//@synthesize howMany, what;
|
|
|
|
|
|
|
|
- (int) howMany {
|
2010-04-03 04:09:24 +08:00
|
|
|
return self.howMany;
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
// - (void) setHowMany: (int) value
|
|
|
|
|
|
|
|
- (NSString*) what {
|
2010-04-03 04:09:24 +08:00
|
|
|
return self.what;
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
// - (void) setWhat: (NSString*) value
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface SynthGetter : NSObject
|
|
|
|
@property (nonatomic) int howMany; // REM: nonatomic to avoid warnings about only implementing one of the pair
|
|
|
|
@property (nonatomic, retain) NSString* what;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation SynthGetter
|
|
|
|
//@synthesize howMany, what;
|
|
|
|
|
|
|
|
// - (int) howMany
|
|
|
|
- (void) setHowMany: (int) value {
|
2010-04-03 04:09:24 +08:00
|
|
|
self.howMany = value;
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// - (NSString*) what
|
|
|
|
- (void) setWhat: (NSString*) value {
|
2010-04-03 04:09:24 +08:00
|
|
|
if (self.what != value) {
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface SynthNone : NSObject
|
|
|
|
@property int howMany;
|
|
|
|
@property (retain) NSString* what;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation SynthNone
|
|
|
|
//@synthesize howMany, what; // REM: Redundant anyway
|
|
|
|
|
|
|
|
- (int) howMany {
|
2010-04-03 04:09:24 +08:00
|
|
|
return self.howMany;
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
- (void) setHowMany: (int) value {
|
2010-04-03 04:09:24 +08:00
|
|
|
self.howMany = value;
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString*) what {
|
2010-04-03 04:09:24 +08:00
|
|
|
return self.what;
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
- (void) setWhat: (NSString*) value {
|
2010-04-03 04:09:24 +08:00
|
|
|
if (self.what != value) {
|
2010-02-10 05:49:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2010-04-22 02:57:20 +08:00
|
|
|
@protocol TopProtocol
|
|
|
|
@property (readonly) id myString;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface TopClass <TopProtocol>
|
|
|
|
{
|
2010-05-03 23:49:20 +08:00
|
|
|
id myString;
|
2010-04-22 02:57:20 +08:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface SubClass : TopClass <TopProtocol>
|
|
|
|
@end
|
|
|
|
|
2010-05-03 23:49:20 +08:00
|
|
|
@implementation SubClass @end
|
2010-04-30 01:52:18 +08:00
|
|
|
|
2010-11-09 10:16:57 +08:00
|
|
|
// rdar://7920807
|
2010-04-30 01:52:18 +08:00
|
|
|
@interface C @end
|
|
|
|
@interface C (Category)
|
|
|
|
@property int p; // expected-warning {{property 'p' requires method 'p' to be defined }} \
|
|
|
|
// expected-warning {{property 'p' requires method 'setP:' to be defined}}
|
|
|
|
@end
|
|
|
|
@implementation C (Category) // expected-note 2 {{implementation is here}}
|
|
|
|
@end
|
|
|
|
|
2010-07-15 02:11:52 +08:00
|
|
|
// Don't complain if a property is already @synthesized by usr.
|
|
|
|
@interface D
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@property int PROP;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation D
|
|
|
|
- (int) Meth { return self.PROP; }
|
|
|
|
@synthesize PROP=IVAR;
|
|
|
|
@end
|
|
|
|
|