From f39e6ad4753e06d4a0d6a9bf6310478757479984 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 19 Aug 2021 20:52:14 -0700 Subject: Export of internal Abseil changes -- 82011e44e917fb70fa00078f0bad7f787580bd8e by Abseil Team : Add lifetime annotations to status methods that return references. PiperOrigin-RevId: 391907063 GitOrigin-RevId: 82011e44e917fb70fa00078f0bad7f787580bd8e Change-Id: Icb2cafbf5eb1201b3bdb56a17263073e22b642e7 --- absl/status/statusor.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'absl/status') diff --git a/absl/status/statusor.h b/absl/status/statusor.h index 235a3433..7fa623fd 100644 --- a/absl/status/statusor.h +++ b/absl/status/statusor.h @@ -518,10 +518,10 @@ class StatusOr : private internal_statusor::StatusOrData, // // The `std::move` on statusor instead of on the whole expression enables // warnings about possible uses of the statusor object after the move. - const T& value() const&; - T& value() &; - const T&& value() const&&; - T&& value() &&; + const T& value() const& ABSL_ATTRIBUTE_LIFETIME_BOUND; + T& value() & ABSL_ATTRIBUTE_LIFETIME_BOUND; + const T&& value() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND; + T&& value() && ABSL_ATTRIBUTE_LIFETIME_BOUND; // StatusOr:: operator*() // @@ -533,10 +533,10 @@ class StatusOr : private internal_statusor::StatusOrData, // `absl::StatusOr`. Alternatively, see the `value()` member function for a // similar API that guarantees crashing or throwing an exception if there is // no current value. - const T& operator*() const&; - T& operator*() &; - const T&& operator*() const&&; - T&& operator*() &&; + const T& operator*() const& ABSL_ATTRIBUTE_LIFETIME_BOUND; + T& operator*() & ABSL_ATTRIBUTE_LIFETIME_BOUND; + const T&& operator*() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND; + T&& operator*() && ABSL_ATTRIBUTE_LIFETIME_BOUND; // StatusOr::operator->() // @@ -545,8 +545,8 @@ class StatusOr : private internal_statusor::StatusOrData, // REQUIRES: `this->ok() == true`, otherwise the behavior is undefined. // // Use `this->ok()` to verify that there is a current value. - const T* operator->() const; - T* operator->(); + const T* operator->() const ABSL_ATTRIBUTE_LIFETIME_BOUND; + T* operator->() ABSL_ATTRIBUTE_LIFETIME_BOUND; // StatusOr::value_or() // -- cgit v1.2.3