[PATCH] D138621: [ADT] Deprecate Optional::getPointer
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 16:50:48 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG80145dcb011b: [ADT] Deprecate Optional::getPointer (authored by kazu).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138621/new/
https://reviews.llvm.org/D138621
Files:
llvm/include/llvm/ADT/Optional.h
Index: llvm/include/llvm/ADT/Optional.h
===================================================================
--- llvm/include/llvm/ADT/Optional.h
+++ llvm/include/llvm/ADT/Optional.h
@@ -274,15 +274,17 @@
void reset() { Storage.reset(); }
+ LLVM_DEPRECATED("Use &*X instead.", "&*X")
constexpr const T *getPointer() const { return &Storage.value(); }
+ LLVM_DEPRECATED("Use &*X instead.", "&*X")
T *getPointer() { return &Storage.value(); }
constexpr const T &value() const & { return Storage.value(); }
T &value() & { return Storage.value(); }
constexpr explicit operator bool() const { return has_value(); }
constexpr bool has_value() const { return Storage.has_value(); }
- constexpr const T *operator->() const { return getPointer(); }
- T *operator->() { return getPointer(); }
+ constexpr const T *operator->() const { return &Storage.value(); }
+ T *operator->() { return &Storage.value(); }
constexpr const T &operator*() const & { return value(); }
T &operator*() & { return value(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138621.477655.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221124/ab6109dd/attachment.bin>
More information about the llvm-commits
mailing list