From 1892185aee0038e8e26382072fb812e5d7c26643 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 9 Sep 2024 15:02:00 -0700 Subject: [PATCH] Untangle `GenericTypeHandler` cross-references + more IWYU in repeated_ptr_field.* * `GenericTypeHandler` used to be forward-declared in message_lite.h and unncessarily friended by `MessageLite`, which was its only use in that source. repeated_ptr_field.h relied on that forward declaration being there, and fully defined `GenericTypeHandler` below the first use. * `StringPieceField` was forward-declared, and now IWYU'ed. PiperOrigin-RevId: 672686570 --- src/google/protobuf/message_lite.h | 5 ----- src/google/protobuf/repeated_ptr_field.h | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index ec1168d2cc6a..4dc6278d2c19 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -225,9 +225,6 @@ class WireFormatLite; class WeakFieldMap; class RustMapHelper; -template -class GenericTypeHandler; // defined in repeated_field.h - // We compute sizes as size_t but cache them as int. This function converts a // computed size to a cached size. Since we don't proceed with serialization // if the total size was > INT_MAX, it is not important what this function @@ -959,8 +956,6 @@ class PROTOBUF_EXPORT MessageLite { template friend class Arena::InternalHelper; - template - friend class internal::GenericTypeHandler; friend auto internal::GetClassData(const MessageLite& msg); diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h index 64957225e63d..10c57127dab8 100644 --- a/src/google/protobuf/repeated_ptr_field.h +++ b/src/google/protobuf/repeated_ptr_field.h @@ -94,6 +94,10 @@ struct ArenaOffsetHelper { static constexpr size_t value = offsetof(T, arena_); }; +// Defined further below. +template +class GenericTypeHandler; + // This is the common base class for RepeatedPtrFields. It deals only in void* // pointers. Users should not use this interface directly. //