@@ -92,7 +92,10 @@ class OptionalStorage {
92
92
}
93
93
94
94
constexpr bool has_value () const noexcept { return hasVal; }
95
+ // Workaround to avoid deprecation warnings: rdar://102362022
96
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
95
97
LLVM_DEPRECATED (" Use has_value instead." , " has_value" )
98
+ #endif
96
99
constexpr bool hasValue () const noexcept {
97
100
return hasVal;
98
101
}
@@ -311,18 +314,28 @@ template <typename T> class Optional {
311
314
constexpr const T *getPointer () const { return &Storage.value (); }
312
315
T *getPointer () { return &Storage.value (); }
313
316
constexpr const T &value () const & { return Storage.value (); }
317
+ // Workaround to avoid deprecation warnings: rdar://102362022
318
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
314
319
LLVM_DEPRECATED (" Use value instead." , " value" )
320
+ #endif
315
321
constexpr const T &getValue () const & {
316
322
return Storage.value ();
317
323
}
318
324
T &value () & { return Storage.value (); }
319
- LLVM_DEPRECATED (" Use value instead." , " value" ) T &getValue () & {
325
+ // Workaround to avoid deprecation warnings: rdar://102362022
326
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
327
+ LLVM_DEPRECATED (" Use value instead." , " value" )
328
+ #endif
329
+ T &getValue () & {
320
330
return Storage.value ();
321
331
}
322
332
323
333
constexpr explicit operator bool () const { return has_value (); }
324
334
constexpr bool has_value () const { return Storage.has_value (); }
335
+ // Workaround to avoid deprecation warnings: rdar://102362022
336
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
325
337
LLVM_DEPRECATED (" Use has_value instead." , " has_value" )
338
+ #endif
326
339
constexpr bool hasValue () const {
327
340
return Storage.has_value ();
328
341
}
@@ -335,7 +348,10 @@ template <typename T> class Optional {
335
348
return has_value () ? value () : std::forward<U>(alt);
336
349
}
337
350
template <typename U>
351
+ // Workaround to avoid deprecation warnings: rdar://102362022
352
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
338
353
LLVM_DEPRECATED (" Use value_or instead." , " value_or" )
354
+ #endif
339
355
constexpr T getValueOr (U &&alt) const & {
340
356
return has_value () ? value () : std::forward<U>(alt);
341
357
}
@@ -356,7 +372,11 @@ template <typename T> class Optional {
356
372
}
357
373
358
374
T &&value() && { return std::move (Storage.value ()); }
359
- LLVM_DEPRECATED (" Use value instead." , " value" ) T &&getValue() && {
375
+ // Workaround to avoid deprecation warnings: rdar://102362022
376
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
377
+ LLVM_DEPRECATED (" Use value instead." , " value" )
378
+ #endif
379
+ T &&getValue() && {
360
380
return std::move (Storage.value ());
361
381
}
362
382
T &&operator *() && { return std::move (Storage.value ()); }
@@ -365,7 +385,10 @@ template <typename T> class Optional {
365
385
return has_value () ? std::move (value ()) : std::forward<U>(alt);
366
386
}
367
387
template <typename U>
388
+ // Workaround to avoid deprecation warnings: rdar://102362022
389
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
368
390
LLVM_DEPRECATED (" Use value_or instead." , " value_or" )
391
+ #endif
369
392
T getValueOr (U &&alt) && {
370
393
return has_value () ? std::move (value ()) : std::forward<U>(alt);
371
394
}
@@ -379,7 +402,10 @@ template <typename T> class Optional {
379
402
return None;
380
403
}
381
404
template <class Function >
405
+ // Workaround to avoid deprecation warnings: rdar://102362022
406
+ #ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
382
407
LLVM_DEPRECATED (" Use transform instead." , " transform" )
408
+ #endif
383
409
auto map (const Function &F)
384
410
&& -> Optional<decltype(F(std::move(*this ).value()))> {
385
411
if (*this )
0 commit comments