@@ -182,46 +182,19 @@ class VersionRange {
182
182
183
183
// / Records the reason a declaration is potentially unavailable.
184
184
class UnavailabilityReason {
185
- public:
186
- enum class Kind {
187
- // / The declaration is potentially unavailable because it requires an OS
188
- // / version range that is not guaranteed by the minimum deployment
189
- // / target.
190
- RequiresOSVersionRange,
191
-
192
- // / The declaration is potentially unavailable because it is explicitly
193
- // / weakly linked.
194
- ExplicitlyWeakLinked
195
- };
196
-
197
185
private:
198
- // A value of None indicates the declaration is potentially unavailable
199
- // because it is explicitly weak linked.
200
- Optional<VersionRange> RequiredDeploymentRange;
186
+ VersionRange RequiredDeploymentRange;
201
187
202
- UnavailabilityReason (const Optional< VersionRange> & RequiredDeploymentRange)
188
+ explicit UnavailabilityReason (const VersionRange RequiredDeploymentRange)
203
189
: RequiredDeploymentRange(RequiredDeploymentRange) {}
204
190
205
191
public:
206
- static UnavailabilityReason explicitlyWeaklyLinked () {
207
- return UnavailabilityReason (None);
208
- }
209
-
210
192
static UnavailabilityReason requiresVersionRange (const VersionRange Range) {
211
193
return UnavailabilityReason (Range);
212
194
}
213
195
214
- Kind getReasonKind () const {
215
- if (RequiredDeploymentRange.hasValue ()) {
216
- return Kind::RequiresOSVersionRange;
217
- } else {
218
- return Kind::ExplicitlyWeakLinked;
219
- }
220
- }
221
-
222
196
const VersionRange &getRequiredOSVersionRange () const {
223
- assert (getReasonKind () == Kind::RequiresOSVersionRange);
224
- return RequiredDeploymentRange.getValue ();
197
+ return RequiredDeploymentRange;
225
198
}
226
199
};
227
200
0 commit comments