Method = LookupFactoryMethodInGlobalPool(Sel,
SourceRange(LBracLoc,RBracLoc),
receiverIsId);
- if (Method)
+ if (Method) {
if (ObjCMethodDecl *BestMethod =
SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))
Method = BestMethod;
+ SmallVector<ObjCMethodDecl*, 4> Methods;
+ if (!CollectMultipleMethodsInGlobalPool(Sel, Methods, Method->isInstanceMethod()))
+ DiagnoseUseOfDecl(Method, SelLoc);
+ }
} else if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType()) {
// Handle messages to Class.
typedef unsigned NSUInteger;
@protocol NSObject
-- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note {{'retain' has been explicitly marked unavailable here}}
- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
-- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note 4 {{'release' has been explicitly marked unavailable here}}
- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
@end
void test1(A *a, BOOL b, struct UnsafeS *unsafeS) {
[[a delegate] release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}} \
// expected-error {{ARC forbids explicit message send}}
[a.delegate release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}} \
// expected-error {{ARC forbids explicit message send}}
[unsafeS->unsafeObj retain]; // expected-error {{it is not safe to remove 'retain' message on an __unsafe_unretained type}} \
// expected-error {{ARC forbids explicit message send}} \
// expected-error {{'retain' is unavailable}}
id foo = [unsafeS->unsafeObj retain]; // no warning.
[global_foo retain]; // expected-error {{it is not safe to remove 'retain' message on a global variable}} \
+ // expected-error {{'retain' is unavailable: not available in automatic reference counting mode}} \
// expected-error {{ARC forbids explicit message send}}
[global_foo release]; // expected-error {{it is not safe to remove 'release' message on a global variable}} \
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}} \
// expected-error {{ARC forbids explicit message send}}
[a dealloc];
[a retain];
// rdar://9504750
void rdar9504750(id p) {
- RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}}
+ RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} \
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}}
}
// rdar://8939557
int X __attribute__((deprecated)); // expected-note 2 {{'X' has been explicitly marked deprecated here}}
}
+ (void)F __attribute__((deprecated)); // expected-note 2 {{'F' has been explicitly marked deprecated here}}
-- (void)f __attribute__((deprecated)); // expected-note 4 {{'f' has been explicitly marked deprecated here}}
+- (void)f __attribute__((deprecated)); // expected-note 5 {{'f' has been explicitly marked deprecated here}}
@end
@implementation A
void t2(id a)
{
- [a f];
+ [a f]; // expected-warning {{'f' is deprecated}}
}
void t3(A<P>* a)
@end
+// rdar://18848183
+@interface NSString
+- (const char *)cString __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" ))); // expected-note {{'cString' has been explicitly marked deprecated here}}
+@end
+
+id PID = 0;
+const char * func() {
+ return [PID cString]; // expected-warning {{'cString' is deprecated: first deprecated in OS X 10.4}}
+}
+