bool CanUseDecl(NamedDecl *D);
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
const ObjCInterfaceDecl *UnknownObjCClass=0);
+ AvailabilityResult DiagnoseAvailabilityOfDecl(NamedDecl *D,
+ SourceLocation Loc,
+ const ObjCInterfaceDecl *UnknownObjCClass);
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
ObjCMethodDecl *Getter,
return true;
}
-static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S,
+AvailabilityResult
+Sema::DiagnoseAvailabilityOfDecl(
NamedDecl *D, SourceLocation Loc,
const ObjCInterfaceDecl *UnknownObjCClass) {
// See if this declaration is unavailable or deprecated.
break;
case AR_Deprecated:
- S.EmitDeprecationWarning(D, Message, Loc, UnknownObjCClass);
+ EmitDeprecationWarning(D, Message, Loc, UnknownObjCClass);
break;
case AR_Unavailable:
- if (S.getCurContextAvailability() != AR_Unavailable) {
+ if (getCurContextAvailability() != AR_Unavailable) {
if (Message.empty()) {
if (!UnknownObjCClass)
- S.Diag(Loc, diag::err_unavailable) << D->getDeclName();
+ Diag(Loc, diag::err_unavailable) << D->getDeclName();
else
- S.Diag(Loc, diag::warn_unavailable_fwdclass_message)
+ Diag(Loc, diag::warn_unavailable_fwdclass_message)
<< D->getDeclName();
}
else
- S.Diag(Loc, diag::err_unavailable_message)
+ Diag(Loc, diag::err_unavailable_message)
<< D->getDeclName() << Message;
- S.Diag(D->getLocation(), diag::note_unavailable_here)
+ Diag(D->getLocation(), diag::note_unavailable_here)
<< isa<FunctionDecl>(D) << false;
}
break;
return true;
}
}
- DiagnoseAvailabilityOfDecl(*this, D, Loc, UnknownObjCClass);
+ DiagnoseAvailabilityOfDecl(D, Loc, UnknownObjCClass);
// Warn if this is used but marked unused.
if (D->hasAttr<UnusedAttr>())
Method = LookupFactoryMethodInGlobalPool(Sel,
SourceRange(LBracLoc, RBracLoc),
receiverIsId);
+ if (Method)
+ DiagnoseAvailabilityOfDecl(Method, Loc, 0);
+
} else if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType()) {
// Handle messages to Class.
void t2(id a)
{
- [a f];
+ [a f]; // expected-warning {{'f' is deprecated}}
}
void t3(A<P>* a)
__attribute__((deprecated))
@interface A(Blah) // expected-error{{attributes may not be specified on a category}}
@end
+
+// rdar://10459930
+
+@class NSString;
+@interface NSDocumentController
+{
+ id iv;
+}
+- (void)fileExtensionsFromType:(NSString *)typeName __attribute__((deprecated));
+@end
+
+@implementation NSDocumentController
+- (void) Meth {
+ [iv fileExtensionsFromType:@"public.text"]; // expected-warning {{'fileExtensionsFromType:' is deprecated}}
+}
+- (void)fileExtensionsFromType:(NSString *)typeName {}
+@end