|
@@ -336,20 +336,34 @@ bool Decl::isReferenced() const {
|
|
|
static AvailabilityResult CheckAvailability(ASTContext &Context,
|
|
|
const AvailabilityAttr *A,
|
|
|
std::string *Message) {
|
|
|
- StringRef TargetPlatform = Context.getTargetInfo().getPlatformName();
|
|
|
- StringRef PrettyPlatformName
|
|
|
- = AvailabilityAttr::getPrettyPlatformName(TargetPlatform);
|
|
|
- if (PrettyPlatformName.empty())
|
|
|
- PrettyPlatformName = TargetPlatform;
|
|
|
+ VersionTuple TargetMinVersion =
|
|
|
+ Context.getTargetInfo().getPlatformMinVersion();
|
|
|
|
|
|
- VersionTuple TargetMinVersion = Context.getTargetInfo().getPlatformMinVersion();
|
|
|
if (TargetMinVersion.empty())
|
|
|
return AR_Available;
|
|
|
|
|
|
+ // Check if this is an App Extension "platform", and if so chop off
|
|
|
+ // the suffix for matching with the actual platform.
|
|
|
+ StringRef ActualPlatform = A->getPlatform()->getName();
|
|
|
+ StringRef RealizedPlatform = ActualPlatform;
|
|
|
+ if (Context.getLangOpts().AppExt) {
|
|
|
+ size_t suffix = RealizedPlatform.rfind("_app_extension");
|
|
|
+ if (suffix != StringRef::npos)
|
|
|
+ RealizedPlatform = RealizedPlatform.slice(0, suffix);
|
|
|
+ }
|
|
|
+
|
|
|
+ StringRef TargetPlatform = Context.getTargetInfo().getPlatformName();
|
|
|
+
|
|
|
// Match the platform name.
|
|
|
- if (A->getPlatform()->getName() != TargetPlatform)
|
|
|
+ if (RealizedPlatform != TargetPlatform)
|
|
|
return AR_Available;
|
|
|
-
|
|
|
+
|
|
|
+ StringRef PrettyPlatformName
|
|
|
+ = AvailabilityAttr::getPrettyPlatformName(ActualPlatform);
|
|
|
+
|
|
|
+ if (PrettyPlatformName.empty())
|
|
|
+ PrettyPlatformName = ActualPlatform;
|
|
|
+
|
|
|
std::string HintMessage;
|
|
|
if (!A->getMessage().empty()) {
|
|
|
HintMessage = " - ";
|