Skip to content

Commit 4d1b0b4

Browse files
committed
rebranch: temporarily disable deprecation warnings for Optional in swift sources
rdar://102362022
1 parent 41df8ab commit 4d1b0b4

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

llvm/include/llvm/ADT/Optional.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ class OptionalStorage {
9292
}
9393

9494
constexpr bool has_value() const noexcept { return hasVal; }
95+
// Workaround to avoid deprecation warnings: rdar://102362022
96+
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
9597
LLVM_DEPRECATED("Use has_value instead.", "has_value")
98+
#endif
9699
constexpr bool hasValue() const noexcept {
97100
return hasVal;
98101
}
@@ -311,18 +314,28 @@ template <typename T> class Optional {
311314
constexpr const T *getPointer() const { return &Storage.value(); }
312315
T *getPointer() { return &Storage.value(); }
313316
constexpr const T &value() const & { return Storage.value(); }
317+
// Workaround to avoid deprecation warnings: rdar://102362022
318+
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
314319
LLVM_DEPRECATED("Use value instead.", "value")
320+
#endif
315321
constexpr const T &getValue() const & {
316322
return Storage.value();
317323
}
318324
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() & {
320330
return Storage.value();
321331
}
322332

323333
constexpr explicit operator bool() const { return has_value(); }
324334
constexpr bool has_value() const { return Storage.has_value(); }
335+
// Workaround to avoid deprecation warnings: rdar://102362022
336+
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
325337
LLVM_DEPRECATED("Use has_value instead.", "has_value")
338+
#endif
326339
constexpr bool hasValue() const {
327340
return Storage.has_value();
328341
}
@@ -335,7 +348,10 @@ template <typename T> class Optional {
335348
return has_value() ? value() : std::forward<U>(alt);
336349
}
337350
template <typename U>
351+
// Workaround to avoid deprecation warnings: rdar://102362022
352+
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
338353
LLVM_DEPRECATED("Use value_or instead.", "value_or")
354+
#endif
339355
constexpr T getValueOr(U &&alt) const & {
340356
return has_value() ? value() : std::forward<U>(alt);
341357
}
@@ -356,7 +372,11 @@ template <typename T> class Optional {
356372
}
357373

358374
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() && {
360380
return std::move(Storage.value());
361381
}
362382
T &&operator*() && { return std::move(Storage.value()); }
@@ -365,7 +385,10 @@ template <typename T> class Optional {
365385
return has_value() ? std::move(value()) : std::forward<U>(alt);
366386
}
367387
template <typename U>
388+
// Workaround to avoid deprecation warnings: rdar://102362022
389+
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
368390
LLVM_DEPRECATED("Use value_or instead.", "value_or")
391+
#endif
369392
T getValueOr(U &&alt) && {
370393
return has_value() ? std::move(value()) : std::forward<U>(alt);
371394
}
@@ -379,7 +402,10 @@ template <typename T> class Optional {
379402
return None;
380403
}
381404
template <class Function>
405+
// Workaround to avoid deprecation warnings: rdar://102362022
406+
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
382407
LLVM_DEPRECATED("Use transform instead.", "transform")
408+
#endif
383409
auto map(const Function &F)
384410
&& -> Optional<decltype(F(std::move(*this).value()))> {
385411
if (*this)

0 commit comments

Comments
 (0)