Auto-generate files after cl/626485595

pull/14552/head^2
Protobuf Team Bot 7 months ago
parent 37e484a0aa
commit d1cf09abcf
  1. 11
      php/ext/google/protobuf/php-upb.c
  2. 72
      php/ext/google/protobuf/php-upb.h
  3. 11
      ruby/ext/google/protobuf_c/ruby-upb.c
  4. 72
      ruby/ext/google/protobuf_c/ruby-upb.h

@ -5137,10 +5137,8 @@ bool upb_Message_SetMapEntry(upb_Map* map, const upb_MiniTable* m,
const upb_MiniTableField* f,
upb_Message* map_entry_message, upb_Arena* arena) {
UPB_ASSERT(!upb_Message_IsFrozen(map_entry_message));
// TODO: use a variant of upb_MiniTable_GetSubMessageTable() here.
const upb_MiniTable* map_entry_mini_table = upb_MiniTableSub_Message(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
const upb_MiniTable* map_entry_mini_table =
upb_MiniTable_MapEntrySubMessage(m, f);
UPB_ASSERT(map_entry_mini_table);
const upb_MiniTableField* map_entry_key_field =
upb_MiniTable_MapKey(map_entry_mini_table);
@ -6043,9 +6041,8 @@ static upb_Map* upb_Message_Map_DeepClone(const upb_Map* map,
const upb_MiniTableField* f,
upb_Message* clone,
upb_Arena* arena) {
// TODO: use a variant of upb_MiniTable_GetSubMessageTable() here.
const upb_MiniTable* map_entry_table = upb_MiniTableSub_Message(
mini_table->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
const upb_MiniTable* map_entry_table =
upb_MiniTable_MapEntrySubMessage(mini_table, f);
UPB_ASSERT(map_entry_table);
const upb_MiniTableField* key_field = upb_MiniTable_MapKey(map_entry_table);

@ -1409,6 +1409,7 @@ UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
#include <stddef.h>
#include <stdint.h>
@ -1540,34 +1541,44 @@ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
return &m->UPB_ONLYBITS(fields)[i];
}
UPB_INLINE const union upb_MiniTableSub* UPB_PRIVATE(
UPB_INLINE const union upb_MiniTableSub UPB_PRIVATE(
_upb_MiniTable_GetSubByIndex)(const struct upb_MiniTable* m, uint32_t i) {
return &m->UPB_PRIVATE(subs)[i];
return m->UPB_PRIVATE(subs)[i];
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
return NULL;
}
return m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(submsg);
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Message);
const struct upb_MiniTable* ret = upb_MiniTableSub_Message(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
UPB_ASSUME(upb_MiniTableField_CType(f) == kUpb_CType_Message);
const struct upb_MiniTable* ret = upb_MiniTable_SubMessage(m, f);
UPB_ASSUME(ret);
return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
return NULL;
}
return upb_MiniTableSub_Message(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTable_FieldIsLinked(m, f)); // Map entries must be linked.
UPB_ASSERT(upb_MiniTableField_IsMap(f)); // Function precondition.
return upb_MiniTable_SubMessage(m, f);
}
UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Enum);
return upb_MiniTableSub_Enum(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
return m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(
subenum);
}
UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapKey(
@ -1586,11 +1597,6 @@ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapValue(
return f;
}
UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
}
// Computes a bitmask in which the |m->required_count| lowest bits are set.
//
// Sample output:
@ -1645,10 +1651,20 @@ UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m);
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
const upb_MiniTable* m, const upb_MiniTableField* f);
// Returns the MiniTable for a message field if it is a submessage.
// Returns the MiniTable for a message field if it is a submessage, otherwise
// returns NULL.
//
// WARNING: if dynamic tree shaking is in use, the return value may be the
// "empty", zero-field placeholder message instead of the real message type.
// If the message is later linked, this function will begin returning the real
// message type.
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
const upb_MiniTable* m, const upb_MiniTableField* f);
// Returns the MiniTable for a map field. The given field must refer to a map.
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
const upb_MiniTable* m, const upb_MiniTableField* f);
// Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
const upb_MiniTable* m, const upb_MiniTableField* f);
@ -3047,12 +3063,6 @@ UPB_API_INLINE bool upb_Map_IsFrozen(const upb_Map* map);
#endif /* UPB_MESSAGE_MAP_H_ */
#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
#define UPB_MINI_TABLE_TAGGED_PTR_H_
#include <stdint.h>
// Public APIs for message operations that do not depend on the schema.
//
// MiniTable-based accessors live in accessors.h.
@ -3108,6 +3118,12 @@ UPB_INLINE void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
#endif /* UPB_MESSAGE_MESSAGE_H_ */
#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
#define UPB_MINI_TABLE_TAGGED_PTR_H_
#include <stdint.h>
// Must be last.
// When a upb_Message* is stored in a message, array, or map, it is stored in a
@ -3501,8 +3517,6 @@ UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
UPB_ASSUME(upb_MiniTableField_IsScalar(field));
UPB_ASSERT(upb_MiniTableSub_Message(
mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]));
upb_Message_SetBaseField(msg, field, &sub_message);
}
@ -3526,8 +3540,8 @@ UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
upb_Message* sub_message =
*UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*);
if (!sub_message) {
const upb_MiniTable* sub_mini_table = upb_MiniTableSub_Message(
mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]);
const upb_MiniTable* sub_mini_table =
upb_MiniTable_SubMessage(mini_table, field);
UPB_ASSERT(sub_mini_table);
sub_message = _upb_Message_New(sub_mini_table, arena);
*UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*) = sub_message;

@ -4630,10 +4630,8 @@ bool upb_Message_SetMapEntry(upb_Map* map, const upb_MiniTable* m,
const upb_MiniTableField* f,
upb_Message* map_entry_message, upb_Arena* arena) {
UPB_ASSERT(!upb_Message_IsFrozen(map_entry_message));
// TODO: use a variant of upb_MiniTable_GetSubMessageTable() here.
const upb_MiniTable* map_entry_mini_table = upb_MiniTableSub_Message(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
const upb_MiniTable* map_entry_mini_table =
upb_MiniTable_MapEntrySubMessage(m, f);
UPB_ASSERT(map_entry_mini_table);
const upb_MiniTableField* map_entry_key_field =
upb_MiniTable_MapKey(map_entry_mini_table);
@ -5536,9 +5534,8 @@ static upb_Map* upb_Message_Map_DeepClone(const upb_Map* map,
const upb_MiniTableField* f,
upb_Message* clone,
upb_Arena* arena) {
// TODO: use a variant of upb_MiniTable_GetSubMessageTable() here.
const upb_MiniTable* map_entry_table = upb_MiniTableSub_Message(
mini_table->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
const upb_MiniTable* map_entry_table =
upb_MiniTable_MapEntrySubMessage(mini_table, f);
UPB_ASSERT(map_entry_table);
const upb_MiniTableField* key_field = upb_MiniTable_MapKey(map_entry_table);

@ -1411,6 +1411,7 @@ UPB_API_INLINE bool upb_MiniTableEnum_CheckValue(const upb_MiniTableEnum* e,
#ifndef UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
#define UPB_MINI_TABLE_INTERNAL_MESSAGE_H_
#include <stddef.h>
#include <stdint.h>
@ -1542,34 +1543,44 @@ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_GetFieldByIndex(
return &m->UPB_ONLYBITS(fields)[i];
}
UPB_INLINE const union upb_MiniTableSub* UPB_PRIVATE(
UPB_INLINE const union upb_MiniTableSub UPB_PRIVATE(
_upb_MiniTable_GetSubByIndex)(const struct upb_MiniTable* m, uint32_t i) {
return &m->UPB_PRIVATE(subs)[i];
return m->UPB_PRIVATE(subs)[i];
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
return NULL;
}
return m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(submsg);
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_GetSubMessageTable(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Message);
const struct upb_MiniTable* ret = upb_MiniTableSub_Message(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
UPB_ASSUME(upb_MiniTableField_CType(f) == kUpb_CType_Message);
const struct upb_MiniTable* ret = upb_MiniTable_SubMessage(m, f);
UPB_ASSUME(ret);
return UPB_PRIVATE(_upb_MiniTable_IsEmpty)(ret) ? NULL : ret;
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_SubMessage(
UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
if (upb_MiniTableField_CType(f) != kUpb_CType_Message) {
return NULL;
}
return upb_MiniTableSub_Message(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
}
UPB_API_INLINE const struct upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTable_FieldIsLinked(m, f)); // Map entries must be linked.
UPB_ASSERT(upb_MiniTableField_IsMap(f)); // Function precondition.
return upb_MiniTable_SubMessage(m, f);
}
UPB_API_INLINE const struct upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
UPB_ASSERT(upb_MiniTableField_CType(f) == kUpb_CType_Enum);
return upb_MiniTableSub_Enum(
m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)]);
return m->UPB_PRIVATE(subs)[f->UPB_PRIVATE(submsg_index)].UPB_PRIVATE(
subenum);
}
UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapKey(
@ -1588,11 +1599,6 @@ UPB_API_INLINE const struct upb_MiniTableField* upb_MiniTable_MapValue(
return f;
}
UPB_API_INLINE bool upb_MiniTable_FieldIsLinked(
const struct upb_MiniTable* m, const struct upb_MiniTableField* f) {
return upb_MiniTable_GetSubMessageTable(m, f) != NULL;
}
// Computes a bitmask in which the |m->required_count| lowest bits are set.
//
// Sample output:
@ -1647,10 +1653,20 @@ UPB_API_INLINE int upb_MiniTable_FieldCount(const upb_MiniTable* m);
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_GetSubMessageTable(
const upb_MiniTable* m, const upb_MiniTableField* f);
// Returns the MiniTable for a message field if it is a submessage.
// Returns the MiniTable for a message field if it is a submessage, otherwise
// returns NULL.
//
// WARNING: if dynamic tree shaking is in use, the return value may be the
// "empty", zero-field placeholder message instead of the real message type.
// If the message is later linked, this function will begin returning the real
// message type.
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_SubMessage(
const upb_MiniTable* m, const upb_MiniTableField* f);
// Returns the MiniTable for a map field. The given field must refer to a map.
UPB_API_INLINE const upb_MiniTable* upb_MiniTable_MapEntrySubMessage(
const upb_MiniTable* m, const upb_MiniTableField* f);
// Returns the MiniTableEnum for a message field, NULL if the field is unlinked.
UPB_API_INLINE const upb_MiniTableEnum* upb_MiniTable_GetSubEnumTable(
const upb_MiniTable* m, const upb_MiniTableField* f);
@ -3049,12 +3065,6 @@ UPB_API_INLINE bool upb_Map_IsFrozen(const upb_Map* map);
#endif /* UPB_MESSAGE_MAP_H_ */
#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
#define UPB_MINI_TABLE_TAGGED_PTR_H_
#include <stdint.h>
// Public APIs for message operations that do not depend on the schema.
//
// MiniTable-based accessors live in accessors.h.
@ -3110,6 +3120,12 @@ UPB_INLINE void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
#endif /* UPB_MESSAGE_MESSAGE_H_ */
#ifndef UPB_MINI_TABLE_TAGGED_PTR_H_
#define UPB_MINI_TABLE_TAGGED_PTR_H_
#include <stdint.h>
// Must be last.
// When a upb_Message* is stored in a message, array, or map, it is stored in a
@ -3503,8 +3519,6 @@ UPB_API_INLINE void _upb_Message_SetTaggedMessagePtr(
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(field) ==
UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
UPB_ASSUME(upb_MiniTableField_IsScalar(field));
UPB_ASSERT(upb_MiniTableSub_Message(
mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]));
upb_Message_SetBaseField(msg, field, &sub_message);
}
@ -3528,8 +3542,8 @@ UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
upb_Message* sub_message =
*UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*);
if (!sub_message) {
const upb_MiniTable* sub_mini_table = upb_MiniTableSub_Message(
mini_table->UPB_PRIVATE(subs)[field->UPB_PRIVATE(submsg_index)]);
const upb_MiniTable* sub_mini_table =
upb_MiniTable_SubMessage(mini_table, field);
UPB_ASSERT(sub_mini_table);
sub_message = _upb_Message_New(sub_mini_table, arena);
*UPB_PTR_AT(msg, field->UPB_ONLYBITS(offset), upb_Message*) = sub_message;

Loading…
Cancel
Save