Fix clang-tidy warnings in `arena.h`. PiperOrigin-RevId: 1001361822
diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 34f1c25..db347db 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel
@@ -643,6 +643,7 @@ "//src/google/protobuf/stubs:lite", "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/base:dynamic_annotations", + "@abseil-cpp//absl/base:nullability", "@abseil-cpp//absl/base:prefetch", "@abseil-cpp//absl/container:layout", "@abseil-cpp//absl/hash", @@ -652,6 +653,7 @@ "@abseil-cpp//absl/numeric:bits", "@abseil-cpp//absl/strings:str_format", "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:optional", "@abseil-cpp//absl/types:span", ], ) @@ -813,6 +815,7 @@ "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/base:dynamic_annotations", "@abseil-cpp//absl/base:no_destructor", + "@abseil-cpp//absl/base:nullability", "@abseil-cpp//absl/base:prefetch", "@abseil-cpp//absl/cleanup", "@abseil-cpp//absl/container:btree",
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index f8cb584..c3429c5 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h
@@ -14,6 +14,7 @@ #include <cstddef> #include <cstdint> #include <limits> +#include <memory> #include <new> // IWYU pragma: keep for operator new(). #include <string> #include <type_traits> @@ -21,6 +22,8 @@ #include <vector> #include "absl/base/macros.h" +#include "absl/base/nullability.h" +#include "absl/types/optional.h" #include "google/protobuf/internal_visibility.h" #if defined(_MSC_VER) && !defined(_LIBCPP_STD_VER) && !_HAS_EXCEPTIONS // Work around bugs in MSVC <typeinfo> header when _HAS_EXCEPTIONS=0. @@ -300,13 +303,13 @@ // Default constructor with sensible default options, tuned for average // use-cases. - inline Arena() : impl_() {} + Arena() : impl_() {} // Construct an arena with default options, except for the supplied // initial block. It is more efficient to use this constructor // instead of passing ArenaOptions if the only configuration needed // by the caller is supplying an initial block. - inline Arena(char* PROTOBUF_NULLABLE initial_block, size_t initial_block_size) + Arena(char* PROTOBUF_NULLABLE initial_block, size_t initial_block_size) : impl_(initial_block, initial_block_size) {} // Arena constructor taking custom options. See ArenaOptions above for @@ -325,7 +328,7 @@ internal::ThreadSafeArena::kBlockHeaderSize + internal::ThreadSafeArena::kSerialArenaSize; - inline ~Arena() = default; + ~Arena() = default; // Allocates an object type T if the arena passed in is not nullptr; // otherwise, returns a heap-allocated object. @@ -651,7 +654,7 @@ return InternalHelper<T>::GetArena(p); } - // Helper typetraits that indicates support for arenas in a type T at compile + // Helper type traits that indicates support for arenas in a type T at compile // time. This is public only to allow construction of higher-level templated // utilities. //