[llvm] eeac9e9 - [ADT] Deprecate Optional::map
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 14 17:52:06 PDT 2022
Author: Kazu Hirata
Date: 2022-08-14T17:51:59-07:00
New Revision: eeac9e923283d8535e4175fef35e132e796fa78e
URL: https://github.com/llvm/llvm-project/commit/eeac9e923283d8535e4175fef35e132e796fa78e
DIFF: https://github.com/llvm/llvm-project/commit/eeac9e923283d8535e4175fef35e132e796fa78e.diff
LOG: [ADT] Deprecate Optional::map
This patch deprecates Optional::map in favor of Optional::transform
for consistency with std::optional::transform in C++23.
Note that I've migrated all known users of Optional::map.
Differential Revision: https://reviews.llvm.org/D131842
Added:
Modified:
llvm/include/llvm/ADT/Optional.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h
index 874183ce190e5..0f4e500834855 100644
--- a/llvm/include/llvm/ADT/Optional.h
+++ b/llvm/include/llvm/ADT/Optional.h
@@ -348,6 +348,7 @@ template <typename T> class Optional {
return None;
}
template <class Function>
+ LLVM_DEPRECATED("Use transform instead.", "transform")
auto map(const Function &F) const & -> Optional<decltype(F(value()))> {
if (*this)
return F(value());
@@ -378,6 +379,7 @@ template <typename T> class Optional {
return None;
}
template <class Function>
+ LLVM_DEPRECATED("Use transform instead.", "transform")
auto map(const Function &F)
&& -> Optional<decltype(F(std::move(*this).value()))> {
if (*this)
More information about the llvm-commits
mailing list