@@ -88,57 +88,50 @@ bool CodeCompletionDiagnostics::getDiagnosticForDeprecated(
88
88
// So getter/setter specific availability doesn't work in code completion.
89
89
90
90
auto Domain = Attr.getDomain ();
91
- llvm::VersionTuple DeprecatedVersion;
92
- if (Attr.getDeprecated ())
93
- DeprecatedVersion = Attr.getDeprecated ().value ();
94
-
95
- llvm::VersionTuple RemappedDeprecatedVersion;
96
- if (AvailabilityInference::updateDeprecatedAvailabilityDomainForFallback (
97
- Attr, Ctx, Domain, RemappedDeprecatedVersion))
98
- DeprecatedVersion = RemappedDeprecatedVersion;
99
-
91
+ auto DeprecatedRange = Attr.getDeprecatedRange (Ctx);
100
92
auto Message = Attr.getMessage ();
101
93
auto NewName = Attr.getRename ();
102
94
if (!isSoftDeprecated) {
103
95
if (Message.empty () && NewName.empty ()) {
104
96
getDiagnostics (severity, Out, diag::availability_deprecated, D,
105
97
Attr.isPlatformSpecific (), Domain,
106
- Attr. getDeprecated (). has_value (), DeprecatedVersion ,
98
+ DeprecatedRange. hasMinimumVersion (), DeprecatedRange ,
107
99
/* message*/ StringRef ());
108
100
} else if (!Message.empty ()) {
109
101
EncodedDiagnosticMessage EncodedMessage (Message);
110
102
getDiagnostics (severity, Out, diag::availability_deprecated, D,
111
103
Attr.isPlatformSpecific (), Domain,
112
- Attr. getDeprecated (). has_value (), DeprecatedVersion ,
104
+ DeprecatedRange. hasMinimumVersion (), DeprecatedRange ,
113
105
EncodedMessage.Message );
114
106
} else {
115
107
getDiagnostics (severity, Out, diag::availability_deprecated_rename, D,
116
108
Attr.isPlatformSpecific (), Domain,
117
- Attr.getDeprecated ().has_value (), DeprecatedVersion, false ,
109
+ DeprecatedRange.hasMinimumVersion (), DeprecatedRange,
110
+ false ,
118
111
/* ReplaceKind*/ 0 , NewName);
119
112
}
120
113
} else {
121
114
// '100000' is used as a version number in API that will be deprecated in an
122
115
// upcoming release. This number is to match the 'API_TO_BE_DEPRECATED'
123
116
// macro defined in Darwin platforms.
124
- static llvm::VersionTuple DISTANT_FUTURE_VESION ( 100000 );
125
- bool isDistantFuture = DeprecatedVersion >= DISTANT_FUTURE_VESION ;
117
+ bool isDistantFuture = DeprecatedRange. isContainedIn (
118
+ AvailabilityRange ( llvm::VersionTuple ( 100000 ))) ;
126
119
127
120
if (Message.empty () && NewName.empty ()) {
128
121
getDiagnostics (severity, Out, diag::ide_availability_softdeprecated, D,
129
122
Attr.isPlatformSpecific (), Domain, !isDistantFuture,
130
- DeprecatedVersion ,
123
+ DeprecatedRange ,
131
124
/* message*/ StringRef ());
132
125
} else if (!Message.empty ()) {
133
126
EncodedDiagnosticMessage EncodedMessage (Message);
134
127
getDiagnostics (severity, Out, diag::ide_availability_softdeprecated, D,
135
128
Attr.isPlatformSpecific (), Domain, !isDistantFuture,
136
- DeprecatedVersion , EncodedMessage.Message );
129
+ DeprecatedRange , EncodedMessage.Message );
137
130
} else {
138
131
getDiagnostics (severity, Out,
139
132
diag::ide_availability_softdeprecated_rename, D,
140
133
Attr.isPlatformSpecific (), Domain, !isDistantFuture,
141
- DeprecatedVersion , NewName);
134
+ DeprecatedRange , NewName);
142
135
}
143
136
}
144
137
return false ;
0 commit comments