def warn_setter_getter_impl_required : Warning<
"property %0 requires method %1 to be defined - "
- "use @synthesize, @dynamic or provide a method implementation">;
+ "use @synthesize, @dynamic or provide a method implementation "
+ "in this class implementation">;
def warn_setter_getter_impl_required_in_category : Warning<
"property %0 requires method %1 to be defined - "
- "use @dynamic or provide a method implementation in category">;
+ "use @dynamic or provide a method implementation in this category">;
def note_property_impl_required : Note<
"implementation is here">;
def note_parameter_named_here : Note<
PropImplMap.count(Prop) || Prop->hasAttr<UnavailableAttr>())
continue;
if (!InsMap.count(Prop->getGetterName())) {
- Diag(Prop->getLocation(),
+ Diag(IMPDecl->getLocation(),
isa<ObjCCategoryDecl>(CDecl) ?
diag::warn_setter_getter_impl_required_in_category :
diag::warn_setter_getter_impl_required)
<< Prop->getDeclName() << Prop->getGetterName();
- Diag(IMPDecl->getLocation(),
- diag::note_property_impl_required);
+ Diag(Prop->getLocation(),
+ diag::note_property_declare);
}
if (!Prop->isReadOnly() && !InsMap.count(Prop->getSetterName())) {
- Diag(Prop->getLocation(),
+ Diag(IMPDecl->getLocation(),
isa<ObjCCategoryDecl>(CDecl) ?
diag::warn_setter_getter_impl_required_in_category :
diag::warn_setter_getter_impl_required)
<< Prop->getDeclName() << Prop->getSetterName();
- Diag(IMPDecl->getLocation(),
- diag::note_property_impl_required);
+ Diag(Prop->getLocation(),
+ diag::note_property_declare);
}
}
}
// rdar://7920807
@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}}
+@property int p; // expected-note 2 {{property declared here}}
@end
-@implementation C (Category) // expected-note 2 {{implementation is here}}
+@implementation C (Category) // expected-warning {{property 'p' requires method 'p' to be defined}} \
+ // expected-warning {{property 'p' requires method 'setP:' to be defined}}
@end
// Don't complain if a property is already @synthesized by usr.
///
@interface I0
-@property(readonly) int p0; // expected-warning {{property 'p0' requires method 'p0' to be defined}}
+@property(readonly) int p0; // expected-note {{property declared here}}
@end
@interface I0 (Cat0)
@interface I0 (Cat1)
@end
-@implementation I0 // expected-note {{implementation is here}}
+@implementation I0 // expected-warning {{property 'p0' requires method 'p0' to be define}}
- (void) foo {
self.p0 = 0; // expected-error {{assigning to property with 'readonly' attribute not allowed}}
}
@protocol MyProtocol
@property float myFloat;
-@property float anotherFloat; // expected-warning {{property 'anotherFloat' requires method 'anotherFloat' to be defined - use @dynamic}} \
- // expected-warning {{property 'anotherFloat' requires method 'setAnotherFloat:' to be defined }}
+@property float anotherFloat; // expected-note 2 {{property declared}}
@end
@interface MyObject { float anotherFloat; }
@interface MyObject (CAT) <MyProtocol>
@end
-@implementation MyObject (CAT) // expected-note 2 {{implementation is here}}
+@implementation MyObject (CAT) // expected-warning {{property 'anotherFloat' requires method}} \
+ // expected-warning {{property 'anotherFloat' requires method 'setAnotherFloat:'}}
@dynamic myFloat; // OK
@synthesize anotherFloat; // expected-error {{@synthesize not allowed in a category's implementation}}
@end
@end
@interface MyClass (public)
-@property(readwrite) int foo; // expected-warning {{property 'foo' requires method 'setFoo:' to be defined }}
+@property(readwrite) int foo; // expected-note {{property declared here}}
@end
-@implementation MyClass (public)// expected-note {{implementation is here}}
+@implementation MyClass (public)// expected-warning {{property 'foo' requires method 'setFoo:' to be defined }}
@end
@end
@interface I(CAT)
-@property int d1; // expected-warning {{property 'd1' requires method 'd1' to be defined }} \
- // expected-warning {{property 'd1' requires method 'setD1:' to be defined }}
+@property int d1; // expected-note 2 {{property declared here}}
@end
@implementation I
@synthesize name; // OK! property with same name as an accessible ivar of same name
@end
-@implementation I(CAT) // expected-note 2 {{implementation is here}}
+@implementation I(CAT) // expected-warning {{property 'd1' requires method 'd1' to be defined }} \
+ // expected-warning {{property 'd1' requires method 'setD1:' to be defined }}
@synthesize d1; // expected-error {{@synthesize not allowed in a category's implementation}}
@dynamic bad; // expected-error {{property implementation must have its declaration in the category 'CAT'}}
@end
@interface NSObject @end
@protocol TopProtocol
- @property (readonly) id myString; // expected-warning {{property 'myString' requires method 'myString' to be defined}}
+ @property (readonly) id myString; // expected-note {{property}}
@end
@protocol SubProtocol <TopProtocol>
@implementation SubClass1 @end // Test1 - No Warning
-@implementation TopClass // expected-note {{implementation is here}}
+@implementation TopClass // expected-warning {{property 'myString' requires method 'myString' to be defined}}
@end
@implementation SubClass // Test3 - No Warning
@implementation SubClass4 @end // Test 5 - No Warning
@protocol NewProtocol
- @property (readonly) id myNewString; // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}}
+ @property (readonly) id myNewString; // expected-note {{property}}
@end
@interface SubClass5 : SubClass4 <NewProtocol> @end
-@implementation SubClass5 @end // expected-note {{implementation is here}}
+@implementation SubClass5 @end // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}}
// Radar 8035776
@end
@protocol ProtocolWithProperty <SuperProtocol>
-@property (readonly, assign) id invalidationBacktrace; // expected-warning {{property 'invalidationBacktrace' requires method 'invalidationBacktrace' to be defined}}
+@property (readonly, assign) id invalidationBacktrace; // expected-note {{property}}
@end
@interface INTF : Super <ProtocolWithProperty>
@end
-@implementation INTF @end // expected-note {{implementation is here}}
+@implementation INTF @end // expected-warning{{property 'invalidationBacktrace' requires method 'invalidationBacktrace' to be defined}}
@protocol PROTOCOL0
@required
-@property float MyProperty0; // expected-warning {{property 'MyProperty0' requires method 'MyProperty0' to be defined }} \
- // expected-warning {{property 'MyProperty0' requires method 'setMyProperty0:' to be defined}}
+@property float MyProperty0; // expected-note 2 {{property declared}}
@end
@protocol PROTOCOL<PROTOCOL0>
@required
-@property float MyProperty; // expected-warning {{property 'MyProperty' requires method 'MyProperty' to be defined}} \
- // expected-warning {{property 'MyProperty' requires method 'setMyProperty:' to be defined}}
+@property float MyProperty; // expected-note 2 {{property declared}}
@optional
@property float OptMyProperty;
@end
@interface I <PROTOCOL>
@end
-@implementation I @end // expected-note 4 {{implementation is here}}
+@implementation I @end // expected-warning {{property 'MyProperty0' requires method 'MyProperty0' to be defined}} \
+ // expected-warning {{property 'MyProperty0' requires method 'setMyProperty0:' to be defined}}\
+ // expected-warning {{property 'MyProperty' requires method 'MyProperty' to be defined}} \
+ // expected-warning {{property 'MyProperty' requires method 'setMyProperty:' to be defined}}