Skip to content

Commit

Permalink
Deprecate StatusOr<T>::ValueOrDie()
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 377575672
Change-Id: I63b08cdb4ea292517d3118e5294d6a35115d367a
  • Loading branch information
newgrp committed Jun 4, 2021
1 parent 90d7619 commit 49ea8b3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions asylo/util/statusor.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,25 @@ class StatusOr {
/// This method should only be called if this StatusOr object's status is OK
/// (i.e. a call to ok() returns true), otherwise this call will abort.
///
/// \deprecated Deprecated as part of Asylo's `absl::Status` migration. Use
/// `value()`, `operator*()`, or `operator->()` instead.
/// \return The stored `T` value.
ABSL_DEPRECATED(
"Deprecated as part of Asylo's absl::Status migration. Use value(), "
"operator*(), or operator->() instead.")
const T &ValueOrDie() const & { return **this; }

/// Gets a mutable reference to the stored `T` value.
///
/// This method should only be called if this StatusOr object's status is OK
/// (i.e. a call to ok() returns true), otherwise this call will abort.
///
/// \deprecated Deprecated as part of Asylo's `absl::Status` migration. Use
/// `value()`, `operator*()`, or `operator->()` instead.
/// \return The stored `T` value.
ABSL_DEPRECATED(
"Deprecated as part of Asylo's absl::Status migration. Use value(), "
"operator*(), or operator->() instead.")
T &ValueOrDie() & { return **this; }

/// Moves and returns the internally-stored `T` value.
Expand All @@ -467,7 +477,12 @@ class StatusOr {
/// StatusOr object is changed after this call to a valid but unspecified
/// state.
///
/// \deprecated Deprecated as part of Asylo's `absl::Status` migration. Use
/// `value()`, `operator*()`, or `operator->()` instead.
/// \return The stored `T` value.
ABSL_DEPRECATED(
"Deprecated as part of Asylo's absl::Status migration. Use value(), "
"operator*(), or operator->() instead.")
T ValueOrDie() && { return *std::move(*this); }

/// Gets the stored `T` value.
Expand Down

0 comments on commit 49ea8b3

Please sign in to comment.