From ebef52ec2fb8675c4a2e7946c40bd2715768f7c1 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 7 Nov 2023 20:35:14 +0000 Subject: [PATCH] Auto-generate files after cl/580263087 --- php/ext/google/protobuf/php-upb.c | 19 +++++++++++++++++-- ruby/ext/google/protobuf_c/ruby-upb.c | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 4225aa3a7d..cdd27ede87 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -9395,11 +9395,26 @@ upb_CType upb_FieldDef_CType(const upb_FieldDef* f) { UPB_UNREACHABLE(); } -upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) { return f->type_; } +upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) { + // TODO: remove once we can deprecate kUpb_FieldType_Group. + if (f->type_ == kUpb_FieldType_Message && + UPB_DESC(FeatureSet_message_encoding)(f->resolved_features) == + UPB_DESC(FeatureSet_DELIMITED)) { + return kUpb_FieldType_Group; + } + return f->type_; +} uint32_t upb_FieldDef_Index(const upb_FieldDef* f) { return f->index_; } -upb_Label upb_FieldDef_Label(const upb_FieldDef* f) { return f->label_; } +upb_Label upb_FieldDef_Label(const upb_FieldDef* f) { + // TODO: remove once we can deprecate kUpb_Label_Required. + if (UPB_DESC(FeatureSet_field_presence)(f->resolved_features) == + UPB_DESC(FeatureSet_LEGACY_REQUIRED)) { + return kUpb_Label_Required; + } + return f->label_; +} uint32_t upb_FieldDef_Number(const upb_FieldDef* f) { return f->number_; } diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 998f4c0891..63627d4b83 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -8910,11 +8910,26 @@ upb_CType upb_FieldDef_CType(const upb_FieldDef* f) { UPB_UNREACHABLE(); } -upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) { return f->type_; } +upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) { + // TODO: remove once we can deprecate kUpb_FieldType_Group. + if (f->type_ == kUpb_FieldType_Message && + UPB_DESC(FeatureSet_message_encoding)(f->resolved_features) == + UPB_DESC(FeatureSet_DELIMITED)) { + return kUpb_FieldType_Group; + } + return f->type_; +} uint32_t upb_FieldDef_Index(const upb_FieldDef* f) { return f->index_; } -upb_Label upb_FieldDef_Label(const upb_FieldDef* f) { return f->label_; } +upb_Label upb_FieldDef_Label(const upb_FieldDef* f) { + // TODO: remove once we can deprecate kUpb_Label_Required. + if (UPB_DESC(FeatureSet_field_presence)(f->resolved_features) == + UPB_DESC(FeatureSet_LEGACY_REQUIRED)) { + return kUpb_Label_Required; + } + return f->label_; +} uint32_t upb_FieldDef_Number(const upb_FieldDef* f) { return f->number_; }