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:
Devin Coughlin
2015-02-13 23:44:28 +00:00
parent 55e76bf15a
commit 503e824e12
8 changed files with 96 additions and 1 deletions

View File

@@ -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