Skip to content

Commit

Permalink
Untangle GenericTypeHandler cross-references + more IWYU in repeate…
Browse files Browse the repository at this point in the history
…d_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
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Sep 9, 2024
1 parent 04e801f commit 1892185
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/google/protobuf/message_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ class WireFormatLite;
class WeakFieldMap;
class RustMapHelper;

template <typename Type>
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
Expand Down Expand Up @@ -959,8 +956,6 @@ class PROTOBUF_EXPORT MessageLite {

template <typename Type>
friend class Arena::InternalHelper;
template <typename Type>
friend class internal::GenericTypeHandler;

friend auto internal::GetClassData(const MessageLite& msg);

Expand Down
4 changes: 4 additions & 0 deletions src/google/protobuf/repeated_ptr_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ struct ArenaOffsetHelper {
static constexpr size_t value = offsetof(T, arena_);
};

// Defined further below.
template <typename Type>
class GenericTypeHandler;

// This is the common base class for RepeatedPtrFields. It deals only in void*
// pointers. Users should not use this interface directly.
//
Expand Down

0 comments on commit 1892185

Please sign in to comment.