Skip to content

Revert "rebranch: temporarily disable deprecation warnings for Optional in swift sources" #6988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions llvm/include/llvm/ADT/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ class OptionalStorage {
}

constexpr bool has_value() const noexcept { return hasVal; }
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use has_value instead.", "has_value")
#endif
constexpr bool hasValue() const noexcept {
return hasVal;
}
Expand Down Expand Up @@ -314,28 +311,18 @@ template <typename T> class Optional {
constexpr const T *getPointer() const { return &Storage.value(); }
T *getPointer() { return &Storage.value(); }
constexpr const T &value() const & { return Storage.value(); }
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use value instead.", "value")
#endif
constexpr const T &getValue() const & {
return Storage.value();
}
T &value() & { return Storage.value(); }
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use value instead.", "value")
#endif
T &getValue() & {
LLVM_DEPRECATED("Use value instead.", "value") T &getValue() & {
return Storage.value();
}

constexpr explicit operator bool() const { return has_value(); }
constexpr bool has_value() const { return Storage.has_value(); }
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use has_value instead.", "has_value")
#endif
constexpr bool hasValue() const {
return Storage.has_value();
}
Expand All @@ -348,10 +335,7 @@ template <typename T> class Optional {
return has_value() ? value() : std::forward<U>(alt);
}
template <typename U>
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use value_or instead.", "value_or")
#endif
constexpr T getValueOr(U &&alt) const & {
return has_value() ? value() : std::forward<U>(alt);
}
Expand All @@ -372,11 +356,7 @@ template <typename T> class Optional {
}

T &&value() && { return std::move(Storage.value()); }
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use value instead.", "value")
#endif
T &&getValue() && {
LLVM_DEPRECATED("Use value instead.", "value") T &&getValue() && {
return std::move(Storage.value());
}
T &&operator*() && { return std::move(Storage.value()); }
Expand All @@ -385,10 +365,7 @@ template <typename T> class Optional {
return has_value() ? std::move(value()) : std::forward<U>(alt);
}
template <typename U>
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use value_or instead.", "value_or")
#endif
T getValueOr(U &&alt) && {
return has_value() ? std::move(value()) : std::forward<U>(alt);
}
Expand All @@ -402,10 +379,7 @@ template <typename T> class Optional {
return None;
}
template <class Function>
// Workaround to avoid deprecation warnings: rdar://102362022
#ifndef SWIFT_LLVM_SUPPORT_IS_AVAILABLE
LLVM_DEPRECATED("Use transform instead.", "transform")
#endif
auto map(const Function &F)
&& -> Optional<decltype(F(std::move(*this).value()))> {
if (*this)
Expand Down