@@ -2821,28 +2821,23 @@ static void diagnoseIfDeprecated(SourceRange ReferenceRange,
28212821 return ;
28222822
28232823 auto Domain = Attr->getDomain ();
2824+ auto DeprecatedRange = Attr->getDeprecatedRange (Context);
28242825 llvm::VersionTuple DeprecatedVersion;
2825- if (Attr-> getDeprecated ())
2826- DeprecatedVersion = Attr-> getDeprecated (). value ();
2826+ if (DeprecatedRange. hasMinimumVersion ())
2827+ DeprecatedVersion = DeprecatedRange. getRawMinimumVersion ();
28272828
28282829 auto Message = Attr->getMessage ();
28292830 auto NewName = Attr->getRename ();
28302831 if (Message.empty () && NewName.empty ()) {
28312832 Context.Diags
28322833 .diagnose (ReferenceRange.Start , diag::availability_deprecated,
28332834 DeprecatedDecl, Attr->isPlatformSpecific (), Domain,
2834- Attr-> getDeprecated (). has_value (), DeprecatedVersion,
2835+ !DeprecatedVersion. empty (), DeprecatedVersion,
28352836 /* message*/ StringRef ())
28362837 .highlight (Attr->getParsedAttr ()->getRange ());
28372838 return ;
28382839 }
28392840
2840- // FIXME: [availability] Remap before emitting diagnostic above.
2841- llvm::VersionTuple RemappedDeprecatedVersion;
2842- if (AvailabilityInference::updateDeprecatedAvailabilityDomainForFallback (
2843- *Attr, Context, Domain, RemappedDeprecatedVersion))
2844- DeprecatedVersion = RemappedDeprecatedVersion;
2845-
28462841 SmallString<32 > newNameBuf;
28472842 std::optional<ReplacementDeclKind> replacementDeclKind =
28482843 describeRename (Context, NewName, /* decl*/ nullptr , newNameBuf);
@@ -2853,7 +2848,7 @@ static void diagnoseIfDeprecated(SourceRange ReferenceRange,
28532848 Context.Diags
28542849 .diagnose (ReferenceRange.Start , diag::availability_deprecated,
28552850 DeprecatedDecl, Attr->isPlatformSpecific (), Domain,
2856- Attr-> getDeprecated (). has_value (), DeprecatedVersion,
2851+ !DeprecatedVersion. empty (), DeprecatedVersion,
28572852 EncodedMessage.Message )
28582853 .highlight (Attr->getParsedAttr ()->getRange ());
28592854 } else {
@@ -2862,7 +2857,7 @@ static void diagnoseIfDeprecated(SourceRange ReferenceRange,
28622857 Context.Diags
28632858 .diagnose (ReferenceRange.Start , diag::availability_deprecated_rename,
28642859 DeprecatedDecl, Attr->isPlatformSpecific (), Domain,
2865- Attr-> getDeprecated (). has_value (), DeprecatedVersion,
2860+ !DeprecatedVersion. empty (), DeprecatedVersion,
28662861 replacementDeclKind.has_value (), rawReplaceKind, newName)
28672862 .highlight (Attr->getParsedAttr ()->getRange ());
28682863 }
@@ -2909,21 +2904,17 @@ static bool diagnoseIfDeprecated(SourceLoc loc,
29092904 auto proto = rootConf->getProtocol ()->getDeclaredInterfaceType ();
29102905
29112906 auto domain = attr->getDomain ();
2907+ auto deprecatedRange = attr->getDeprecatedRange (ctx);
29122908 llvm::VersionTuple deprecatedVersion;
2913- if (attr->getDeprecated ())
2914- deprecatedVersion = attr->getDeprecated ().value ();
2915-
2916- llvm::VersionTuple remappedDeprecatedVersion;
2917- if (AvailabilityInference::updateDeprecatedAvailabilityDomainForFallback (
2918- *attr, ctx, domain, remappedDeprecatedVersion))
2919- deprecatedVersion = remappedDeprecatedVersion;
2909+ if (deprecatedRange.hasMinimumVersion ())
2910+ deprecatedVersion = deprecatedRange.getRawMinimumVersion ();
29202911
29212912 auto message = attr->getMessage ();
29222913 if (message.empty ()) {
29232914 ctx.Diags
29242915 .diagnose (loc, diag::conformance_availability_deprecated, type, proto,
29252916 attr->isPlatformSpecific (), domain,
2926- attr-> getDeprecated (). has_value (), deprecatedVersion,
2917+ !deprecatedVersion. empty (), deprecatedVersion,
29272918 /* message*/ StringRef ())
29282919 .highlight (attr->getParsedAttr ()->getRange ());
29292920 return true ;
@@ -2933,7 +2924,7 @@ static bool diagnoseIfDeprecated(SourceLoc loc,
29332924 ctx.Diags
29342925 .diagnose (loc, diag::conformance_availability_deprecated, type, proto,
29352926 attr->isPlatformSpecific (), domain,
2936- attr-> getDeprecated (). has_value (), deprecatedVersion,
2927+ !deprecatedVersion. empty (), deprecatedVersion,
29372928 encodedMessage.Message )
29382929 .highlight (attr->getParsedAttr ()->getRange ());
29392930 return true ;
0 commit comments