mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Warn on uses of deprecated APIs
Emit a warning when the developer uses an API that has been marked deprecated with an availability attribute. Following the Clang behavior, we will only warn if the API is deprecated on all deployment targets. For example, if an API is deprecated as of OS X 10.11 but the minimum deployment target is 10.10 then no warning will be emitted. rdar://problem/17406050 Swift SVN r25288
This commit is contained in:
@@ -540,6 +540,11 @@ static bool diagAvailability(TypeChecker &TC, const ValueDecl *D,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Diagnose for deprecation
|
||||
if (const AvailabilityAttr *Attr = D->getAttrs().getDeprecated(TC.Context)) {
|
||||
TC.diagnoseDeprecated(R.Start, Attr, D->getFullName());
|
||||
}
|
||||
|
||||
// We only diagnose potentially unavailability here if availability checking
|
||||
// is turned on, but we are not treating unavailable symbols as having
|
||||
|
||||
Reference in New Issue
Block a user