diff options
author | Abseil Team <absl-team@google.com> | 2021-08-20 22:47:15 -0700 |
---|---|---|
committer | rogeeff <rogeeff@google.com> | 2021-08-24 03:24:23 -0400 |
commit | 9134967d017fcd09f71539c8957b73eb05c26f45 (patch) | |
tree | 4e241d0ebded6663028d518a4885431741e225b8 /absl/functional | |
parent | f39e6ad4753e06d4a0d6a9bf6310478757479984 (diff) |
Export of internal Abseil changes
--
2aa219620f39aa490fa989f5d92e1bd3e52a46c5 by Abseil Team <absl-team@google.com>:
Add lifetime annotations to FunctionRef.
PiperOrigin-RevId: 392131866
GitOrigin-RevId: 2aa219620f39aa490fa989f5d92e1bd3e52a46c5
Change-Id: I295b808986857e46a565e047db25a951dd7ce0e3
Diffstat (limited to 'absl/functional')
-rw-r--r-- | absl/functional/BUILD.bazel | 1 | ||||
-rw-r--r-- | absl/functional/CMakeLists.txt | 1 | ||||
-rw-r--r-- | absl/functional/function_ref.h | 4 |
3 files changed, 5 insertions, 1 deletions
diff --git a/absl/functional/BUILD.bazel b/absl/functional/BUILD.bazel index ebd9b99b..4555cd59 100644 --- a/absl/functional/BUILD.bazel +++ b/absl/functional/BUILD.bazel @@ -60,6 +60,7 @@ cc_library( linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ "//absl/base:base_internal", + "//absl/base:core_headers", "//absl/meta:type_traits", ], ) diff --git a/absl/functional/CMakeLists.txt b/absl/functional/CMakeLists.txt index 3919e9a1..338ddc6c 100644 --- a/absl/functional/CMakeLists.txt +++ b/absl/functional/CMakeLists.txt @@ -53,6 +53,7 @@ absl_cc_library( ${ABSL_DEFAULT_COPTS} DEPS absl::base_internal + absl::core_headers absl::meta PUBLIC ) diff --git a/absl/functional/function_ref.h b/absl/functional/function_ref.h index 5790a652..824e3cea 100644 --- a/absl/functional/function_ref.h +++ b/absl/functional/function_ref.h @@ -50,6 +50,7 @@ #include <functional> #include <type_traits> +#include "absl/base/attributes.h" #include "absl/functional/internal/function_ref.h" #include "absl/meta/type_traits.h" @@ -98,7 +99,8 @@ class FunctionRef<R(Args...)> { public: // Constructs a FunctionRef from any invokable type. template <typename F, typename = EnableIfCompatible<const F&>> - FunctionRef(const F& f) // NOLINT(runtime/explicit) + // NOLINTNEXTLINE(runtime/explicit) + FunctionRef(const F& f ABSL_ATTRIBUTE_LIFETIME_BOUND) : invoker_(&absl::functional_internal::InvokeObject<F, R, Args...>) { absl::functional_internal::AssertNonNull(f); ptr_.obj = &f; |