Skip to content

Commit

Permalink
Open sourcing reflection_visit_fieds.
Browse files Browse the repository at this point in the history
Note that VisitFields() is an internal API and only meant for internal protobuf
usages.

PiperOrigin-RevId: 611586588
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Feb 29, 2024
1 parent 988194a commit cfc07df
Show file tree
Hide file tree
Showing 6 changed files with 2,338 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/google/protobuf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ PROTOBUF_HEADERS = [
"reflection_internal.h",
"reflection_mode.h",
"reflection_ops.h",
"reflection_visit_fields.h",
"reflection_visit_field_info.h",
"service.h",
"text_format.h",
"unknown_field_set.h",
Expand Down
4 changes: 0 additions & 4 deletions src/google/protobuf/generated_message_reflection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,6 @@ bool Reflection::IsEagerlyVerifiedLazyField(
schema_.IsEagerlyVerifiedLazyField(field));
}
bool Reflection::IsInlined(const FieldDescriptor* field) const {
return schema_.IsFieldInlined(field);
}
size_t Reflection::SpaceUsedLong(const Message& message) const {
// object_size_ already includes the in-memory representation of each field
// in the message, so we only need to account for additional memory used by
Expand Down
4 changes: 3 additions & 1 deletion src/google/protobuf/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,9 @@ class PROTOBUF_EXPORT Reflection final {

internal::InternalMetadata* MutableInternalMetadata(Message* message) const;

inline bool IsInlined(const FieldDescriptor* field) const;
inline bool IsInlined(const FieldDescriptor* field) const {
return schema_.IsFieldInlined(field);
}

bool HasBit(const Message& message, const FieldDescriptor* field) const;
void SetBit(Message* message, const FieldDescriptor* field) const;
Expand Down
Loading

0 comments on commit cfc07df

Please sign in to comment.