diff options
author | Alex Lorenz <arphaman@gmail.com> | 2018-05-03 01:12:06 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2018-05-03 01:12:06 +0000 |
commit | f4d4cfbefa4c1e61a69f47ac41790cd15a65fb07 (patch) | |
tree | b38163d45f8f9547286ba83eb9a8534f343c62fb /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | 61ffbf21cdc92e1acc4794b75ea0c12e2caa9414 (diff) | |
download | bcm5719-llvm-f4d4cfbefa4c1e61a69f47ac41790cd15a65fb07.tar.gz bcm5719-llvm-f4d4cfbefa4c1e61a69f47ac41790cd15a65fb07.zip |
[ObjC] Supress the 'implementing unavailable method' warning when
the method declaration is unavailable for an app extension platform
Rationale:
Classes are often shared between an app extension code and
non-app extension code. There's no way to remove the implementation
using preprocessor when building the app extension, so we should not warn here.
rdar://38150617
llvm-svn: 331421
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 5b8a9f39176..e1eed827167 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -266,12 +266,20 @@ static void DiagnoseObjCImplementedDeprecations(Sema &S, const NamedDecl *ND, if (!ND) return; bool IsCategory = false; - AvailabilityResult Availability = ND->getAvailability(); + StringRef RealizedPlatform; + AvailabilityResult Availability = ND->getAvailability( + /*Message=*/nullptr, /*EnclosingVersion=*/VersionTuple(), + &RealizedPlatform); if (Availability != AR_Deprecated) { if (isa<ObjCMethodDecl>(ND)) { if (Availability != AR_Unavailable) return; - // Warn about implementing unavailable methods. + if (RealizedPlatform.empty()) + RealizedPlatform = S.Context.getTargetInfo().getPlatformName(); + // Warn about implementing unavailable methods, unless the unavailable + // is for an app extension. + if (RealizedPlatform.endswith("_app_extension")) + return; S.Diag(ImplLoc, diag::warn_unavailable_def); S.Diag(ND->getLocation(), diag::note_method_declared_at) << ND->getDeclName(); |