diff options
author | Dmitri Gribenko <dmitrig@google.com> | 2023-12-11 09:07:07 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-12-11 09:07:59 -0800 |
commit | 55621d1af55be7bf9a2c8e5dcef4368d9a6d4e51 (patch) | |
tree | 4c0e74b9a45b8875e35ee543089315a0d9989df1 /absl/strings/cordz_test_helpers.h | |
parent | fad946221cec37175e762c399760f54b9de9a9fa (diff) | |
download | abseil-55621d1af55be7bf9a2c8e5dcef4368d9a6d4e51.tar.gz abseil-55621d1af55be7bf9a2c8e5dcef4368d9a6d4e51.tar.bz2 abseil-55621d1af55be7bf9a2c8e5dcef4368d9a6d4e51.zip |
Add nullability annotations
PiperOrigin-RevId: 589842893
Change-Id: I9657761d1f71c665582406f278c6605f6d382f6d
Diffstat (limited to 'absl/strings/cordz_test_helpers.h')
-rw-r--r-- | absl/strings/cordz_test_helpers.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/absl/strings/cordz_test_helpers.h b/absl/strings/cordz_test_helpers.h index e410eecf..619f13c2 100644 --- a/absl/strings/cordz_test_helpers.h +++ b/absl/strings/cordz_test_helpers.h @@ -21,6 +21,7 @@ #include "gtest/gtest.h" #include "absl/base/config.h" #include "absl/base/macros.h" +#include "absl/base/nullability.h" #include "absl/strings/cord.h" #include "absl/strings/internal/cord_internal.h" #include "absl/strings/internal/cordz_info.h" @@ -33,15 +34,16 @@ namespace absl { ABSL_NAMESPACE_BEGIN // Returns the CordzInfo for the cord, or nullptr if the cord is not sampled. -inline const cord_internal::CordzInfo* GetCordzInfoForTesting( +inline absl::Nullable<const cord_internal::CordzInfo*> GetCordzInfoForTesting( const Cord& cord) { if (!cord.contents_.is_tree()) return nullptr; return cord.contents_.cordz_info(); } // Returns true if the provided cordz_info is in the list of sampled cords. -inline bool CordzInfoIsListed(const cord_internal::CordzInfo* cordz_info, - cord_internal::CordzSampleToken token = {}) { +inline bool CordzInfoIsListed( + absl::Nonnull<const cord_internal::CordzInfo*> cordz_info, + cord_internal::CordzSampleToken token = {}) { for (const cord_internal::CordzInfo& info : token) { if (cordz_info == &info) return true; } @@ -119,7 +121,7 @@ class CordzSamplingIntervalHelper { // Wrapper struct managing a small CordRep `rep` struct TestCordRep { - cord_internal::CordRepFlat* rep; + absl::Nonnull<cord_internal::CordRepFlat*> rep; TestCordRep() { rep = cord_internal::CordRepFlat::New(100); |