Auto-generate files after cl/588166536

pull/14943/head
Protobuf Team Bot 12 months ago
parent 6efd909a9b
commit 7d4ead2f82
  1. 5
      php/ext/google/protobuf/php-upb.c
  2. 44
      php/ext/google/protobuf/php-upb.h
  3. 5
      ruby/ext/google/protobuf_c/ruby-upb.c
  4. 44
      ruby/ext/google/protobuf_c/ruby-upb.h

@ -13288,7 +13288,7 @@ static const char* _upb_Decoder_DecodeToSubMessage(
UPB_PRIVATE(_upb_Message_SetHasbit)(msg, field);
} else if (field->presence < 0) {
/* Oneof case */
uint32_t* oneof_case = _upb_Message_OneofCasePtr(msg, field);
uint32_t* oneof_case = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, field);
if (op == kUpb_DecodeOp_SubMessage &&
*oneof_case != field->UPB_PRIVATE(number)) {
memset(mem, 0, sizeof(void*));
@ -15430,7 +15430,8 @@ static bool encode_shouldencode(upb_encstate* e, const upb_Message* msg,
return UPB_PRIVATE(_upb_Message_GetHasbit)(msg, f);
} else {
// Field is in a oneof.
return _upb_Message_GetOneofCase(msg, f) == f->UPB_PRIVATE(number);
return UPB_PRIVATE(_upb_Message_GetOneofCase)(msg, f) ==
f->UPB_PRIVATE(number);
}
}

@ -1245,6 +1245,12 @@ UPB_PRIVATE(_upb_MiniTableField_Number)(const struct upb_MiniTableField* f) {
return f->UPB_ONLYBITS(number);
}
UPB_INLINE size_t
_upb_MiniTableField_OneofOffset(const struct upb_MiniTableField* f) {
UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_IsInOneof)(f));
return ~(ptrdiff_t)f->presence;
}
UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(
const struct upb_MiniTableField* f) {
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
@ -2459,24 +2465,20 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearHasbit)(
// Oneof case access ///////////////////////////////////////////////////////////
UPB_INLINE size_t _upb_MiniTableField_OneofOffset(const upb_MiniTableField* f) {
UPB_ASSERT(f->presence < 0);
return ~(ptrdiff_t)f->presence;
}
UPB_INLINE uint32_t* _upb_Message_OneofCasePtr(upb_Message* msg,
const upb_MiniTableField* f) {
UPB_INLINE uint32_t* UPB_PRIVATE(_upb_Message_OneofCasePtr)(
upb_Message* msg, const upb_MiniTableField* f) {
return UPB_PTR_AT(msg, _upb_MiniTableField_OneofOffset(f), uint32_t);
}
UPB_INLINE uint32_t _upb_Message_GetOneofCase(const upb_Message* msg,
const upb_MiniTableField* f) {
return *_upb_Message_OneofCasePtr((upb_Message*)msg, f);
UPB_INLINE uint32_t UPB_PRIVATE(_upb_Message_GetOneofCase)(
const upb_Message* msg, const upb_MiniTableField* f) {
return *UPB_PRIVATE(_upb_Message_OneofCasePtr)((upb_Message*)msg, f);
}
UPB_INLINE void _upb_Message_SetOneofCase(upb_Message* msg,
const upb_MiniTableField* f) {
*_upb_Message_OneofCasePtr(msg, f) = upb_MiniTableField_Number(f);
UPB_INLINE void UPB_PRIVATE(_upb_Message_SetOneofCase)(
upb_Message* msg, const upb_MiniTableField* f) {
*UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f) =
upb_MiniTableField_Number(f);
}
// TODO: implement _upb_Message_ClearOneofCase()
@ -2493,12 +2495,12 @@ UPB_INLINE const void* _upb_MiniTableField_GetConstPtr(
return (char*)msg + field->offset;
}
UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
const upb_MiniTableField* field) {
UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)(
upb_Message* msg, const upb_MiniTableField* field) {
if (field->presence > 0) {
UPB_PRIVATE(_upb_Message_SetHasbit)(msg, field);
} else if (upb_MiniTableField_IsInOneof(field)) {
_upb_Message_SetOneofCase(msg, field);
UPB_PRIVATE(_upb_Message_SetOneofCase)(msg, field);
}
}
@ -2584,7 +2586,7 @@ UPB_INLINE bool _upb_Message_HasNonExtensionField(
UPB_ASSERT(upb_MiniTableField_HasPresence(field));
UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
if (upb_MiniTableField_IsInOneof(field)) {
return _upb_Message_GetOneofCase(msg, field) ==
return UPB_PRIVATE(_upb_Message_GetOneofCase)(msg, field) ==
upb_MiniTableField_Number(field);
} else {
return UPB_PRIVATE(_upb_Message_GetHasbit)(msg, field);
@ -2647,7 +2649,7 @@ UPB_INLINE upb_MutableMessageValue _upb_Message_GetMutableField(
UPB_INLINE void _upb_Message_SetNonExtensionField(
upb_Message* msg, const upb_MiniTableField* field, const void* val) {
UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
_upb_Message_SetPresence(msg, field);
UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
_upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val,
field);
}
@ -2682,7 +2684,7 @@ UPB_INLINE void _upb_Message_ClearNonExtensionField(
if (field->presence > 0) {
UPB_PRIVATE(_upb_Message_ClearHasbit)(msg, field);
} else if (upb_MiniTableField_IsInOneof(field)) {
uint32_t* ptr = _upb_Message_OneofCasePtr(msg, field);
uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, field);
if (*ptr != upb_MiniTableField_Number(field)) return;
*ptr = 0;
}
@ -2929,7 +2931,7 @@ UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg,
UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
const upb_Message* message, const upb_MiniTableField* oneof_field) {
UPB_ASSUME(upb_MiniTableField_IsInOneof(oneof_field));
return _upb_Message_GetOneofCase(message, oneof_field);
return UPB_PRIVATE(_upb_Message_GetOneofCase)(message, oneof_field);
}
// NOTE: The default_val is only used for fields that support presence.
@ -3232,7 +3234,7 @@ UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
UPB_ASSERT(sub_mini_table);
sub_message = _upb_Message_New(sub_mini_table, arena);
*UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
_upb_Message_SetPresence(msg, field);
UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
}
return sub_message;
}

@ -12802,7 +12802,7 @@ static const char* _upb_Decoder_DecodeToSubMessage(
UPB_PRIVATE(_upb_Message_SetHasbit)(msg, field);
} else if (field->presence < 0) {
/* Oneof case */
uint32_t* oneof_case = _upb_Message_OneofCasePtr(msg, field);
uint32_t* oneof_case = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, field);
if (op == kUpb_DecodeOp_SubMessage &&
*oneof_case != field->UPB_PRIVATE(number)) {
memset(mem, 0, sizeof(void*));
@ -14944,7 +14944,8 @@ static bool encode_shouldencode(upb_encstate* e, const upb_Message* msg,
return UPB_PRIVATE(_upb_Message_GetHasbit)(msg, f);
} else {
// Field is in a oneof.
return _upb_Message_GetOneofCase(msg, f) == f->UPB_PRIVATE(number);
return UPB_PRIVATE(_upb_Message_GetOneofCase)(msg, f) ==
f->UPB_PRIVATE(number);
}
}

@ -1247,6 +1247,12 @@ UPB_PRIVATE(_upb_MiniTableField_Number)(const struct upb_MiniTableField* f) {
return f->UPB_ONLYBITS(number);
}
UPB_INLINE size_t
_upb_MiniTableField_OneofOffset(const struct upb_MiniTableField* f) {
UPB_ASSERT(UPB_PRIVATE(_upb_MiniTableField_IsInOneof)(f));
return ~(ptrdiff_t)f->presence;
}
UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_CheckIsArray)(
const struct upb_MiniTableField* f) {
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(f) ==
@ -2461,24 +2467,20 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_ClearHasbit)(
// Oneof case access ///////////////////////////////////////////////////////////
UPB_INLINE size_t _upb_MiniTableField_OneofOffset(const upb_MiniTableField* f) {
UPB_ASSERT(f->presence < 0);
return ~(ptrdiff_t)f->presence;
}
UPB_INLINE uint32_t* _upb_Message_OneofCasePtr(upb_Message* msg,
const upb_MiniTableField* f) {
UPB_INLINE uint32_t* UPB_PRIVATE(_upb_Message_OneofCasePtr)(
upb_Message* msg, const upb_MiniTableField* f) {
return UPB_PTR_AT(msg, _upb_MiniTableField_OneofOffset(f), uint32_t);
}
UPB_INLINE uint32_t _upb_Message_GetOneofCase(const upb_Message* msg,
const upb_MiniTableField* f) {
return *_upb_Message_OneofCasePtr((upb_Message*)msg, f);
UPB_INLINE uint32_t UPB_PRIVATE(_upb_Message_GetOneofCase)(
const upb_Message* msg, const upb_MiniTableField* f) {
return *UPB_PRIVATE(_upb_Message_OneofCasePtr)((upb_Message*)msg, f);
}
UPB_INLINE void _upb_Message_SetOneofCase(upb_Message* msg,
const upb_MiniTableField* f) {
*_upb_Message_OneofCasePtr(msg, f) = upb_MiniTableField_Number(f);
UPB_INLINE void UPB_PRIVATE(_upb_Message_SetOneofCase)(
upb_Message* msg, const upb_MiniTableField* f) {
*UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, f) =
upb_MiniTableField_Number(f);
}
// TODO: implement _upb_Message_ClearOneofCase()
@ -2495,12 +2497,12 @@ UPB_INLINE const void* _upb_MiniTableField_GetConstPtr(
return (char*)msg + field->offset;
}
UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg,
const upb_MiniTableField* field) {
UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)(
upb_Message* msg, const upb_MiniTableField* field) {
if (field->presence > 0) {
UPB_PRIVATE(_upb_Message_SetHasbit)(msg, field);
} else if (upb_MiniTableField_IsInOneof(field)) {
_upb_Message_SetOneofCase(msg, field);
UPB_PRIVATE(_upb_Message_SetOneofCase)(msg, field);
}
}
@ -2586,7 +2588,7 @@ UPB_INLINE bool _upb_Message_HasNonExtensionField(
UPB_ASSERT(upb_MiniTableField_HasPresence(field));
UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
if (upb_MiniTableField_IsInOneof(field)) {
return _upb_Message_GetOneofCase(msg, field) ==
return UPB_PRIVATE(_upb_Message_GetOneofCase)(msg, field) ==
upb_MiniTableField_Number(field);
} else {
return UPB_PRIVATE(_upb_Message_GetHasbit)(msg, field);
@ -2649,7 +2651,7 @@ UPB_INLINE upb_MutableMessageValue _upb_Message_GetMutableField(
UPB_INLINE void _upb_Message_SetNonExtensionField(
upb_Message* msg, const upb_MiniTableField* field, const void* val) {
UPB_ASSUME(!upb_MiniTableField_IsExtension(field));
_upb_Message_SetPresence(msg, field);
UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
_upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val,
field);
}
@ -2684,7 +2686,7 @@ UPB_INLINE void _upb_Message_ClearNonExtensionField(
if (field->presence > 0) {
UPB_PRIVATE(_upb_Message_ClearHasbit)(msg, field);
} else if (upb_MiniTableField_IsInOneof(field)) {
uint32_t* ptr = _upb_Message_OneofCasePtr(msg, field);
uint32_t* ptr = UPB_PRIVATE(_upb_Message_OneofCasePtr)(msg, field);
if (*ptr != upb_MiniTableField_Number(field)) return;
*ptr = 0;
}
@ -2931,7 +2933,7 @@ UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg,
UPB_API_INLINE uint32_t upb_Message_WhichOneofFieldNumber(
const upb_Message* message, const upb_MiniTableField* oneof_field) {
UPB_ASSUME(upb_MiniTableField_IsInOneof(oneof_field));
return _upb_Message_GetOneofCase(message, oneof_field);
return UPB_PRIVATE(_upb_Message_GetOneofCase)(message, oneof_field);
}
// NOTE: The default_val is only used for fields that support presence.
@ -3234,7 +3236,7 @@ UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
UPB_ASSERT(sub_mini_table);
sub_message = _upb_Message_New(sub_mini_table, arena);
*UPB_PTR_AT(msg, field->offset, upb_Message*) = sub_message;
_upb_Message_SetPresence(msg, field);
UPB_PRIVATE(_upb_Message_SetPresence)(msg, field);
}
return sub_message;
}

Loading…
Cancel
Save