Commit 953cec75 by Derek Mauro Committed by Copybara-Service

Adds ABSL_ATTRIBUTE_LIFETIME_BOUND to absl::BitGenRef

PiperOrigin-RevId: 611151721
Change-Id: Ic7b342770fb3e1aab8e54ff125f1529534eedc3c
parent cfde5f74
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include "absl/base/attributes.h"
#include "absl/base/internal/fast_type_id.h" #include "absl/base/internal/fast_type_id.h"
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/meta/type_traits.h" #include "absl/meta/type_traits.h"
...@@ -114,7 +115,7 @@ class BitGenRef { ...@@ -114,7 +115,7 @@ class BitGenRef {
(!std::is_same<URBG, BitGenRef>::value && (!std::is_same<URBG, BitGenRef>::value &&
random_internal::is_urbg<URBG>::value && random_internal::is_urbg<URBG>::value &&
!HasInvokeMock<URBG>::value)>* = nullptr> !HasInvokeMock<URBG>::value)>* = nullptr>
BitGenRef(URBG& gen) // NOLINT BitGenRef(URBG& gen ABSL_ATTRIBUTE_LIFETIME_BOUND) // NOLINT
: t_erased_gen_ptr_(reinterpret_cast<uintptr_t>(&gen)), : t_erased_gen_ptr_(reinterpret_cast<uintptr_t>(&gen)),
mock_call_(NotAMock), mock_call_(NotAMock),
generate_impl_fn_(ImplFn<URBG>) {} generate_impl_fn_(ImplFn<URBG>) {}
...@@ -123,7 +124,7 @@ class BitGenRef { ...@@ -123,7 +124,7 @@ class BitGenRef {
typename absl::enable_if_t<(!std::is_same<URBG, BitGenRef>::value && typename absl::enable_if_t<(!std::is_same<URBG, BitGenRef>::value &&
random_internal::is_urbg<URBG>::value && random_internal::is_urbg<URBG>::value &&
HasInvokeMock<URBG>::value)>* = nullptr> HasInvokeMock<URBG>::value)>* = nullptr>
BitGenRef(URBG& gen) // NOLINT BitGenRef(URBG& gen ABSL_ATTRIBUTE_LIFETIME_BOUND) // NOLINT
: t_erased_gen_ptr_(reinterpret_cast<uintptr_t>(&gen)), : t_erased_gen_ptr_(reinterpret_cast<uintptr_t>(&gen)),
mock_call_(&MockCall<URBG>), mock_call_(&MockCall<URBG>),
generate_impl_fn_(ImplFn<URBG>) {} generate_impl_fn_(ImplFn<URBG>) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment