diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 55ef065d5cf4..0eb249ddaf64 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -1212,13 +1212,15 @@ const upb_MiniTable google_protobuf_MessageOptions_msg_init = { }) }; -static const upb_MiniTableSub google_protobuf_FieldOptions_submsgs[3] = { +static const upb_MiniTableSub google_protobuf_FieldOptions_submsgs[5] = { {.subenum = &google_protobuf_FieldOptions_CType_enum_init}, {.subenum = &google_protobuf_FieldOptions_JSType_enum_init}, + {.subenum = &google_protobuf_FieldOptions_OptionRetention_enum_init}, + {.subenum = &google_protobuf_FieldOptions_OptionTargetType_enum_init}, {.submsg = &google_protobuf_UninterpretedOption_msg_init}, }; -static const upb_MiniTableField google_protobuf_FieldOptions__fields[9] = { +static const upb_MiniTableField google_protobuf_FieldOptions__fields[11] = { {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, @@ -1227,13 +1229,15 @@ static const upb_MiniTableField google_protobuf_FieldOptions__fields[9] = { {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {16, 18, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, - {999, UPB_SIZE(20, 24), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, + {17, 20, 9, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, + {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_FieldOptions_msg_init = { &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(24, 32), 9, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, + UPB_SIZE(32, 40), 11, kUpb_ExtMode_Extendable, 3, UPB_FASTTABLE_MASK(248), 0, UPB_FASTTABLE_INIT({ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, @@ -1258,7 +1262,7 @@ const upb_MiniTable google_protobuf_FieldOptions_msg_init = { {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, - {0x001800003f023eba, &upb_prm_2bt_max128b}, + {0x002000003f043eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 2a878177c080..bd1ce0bf3339 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -6468,12 +6468,42 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_debug_redact(const google_proto const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } +UPB_INLINE void google_protobuf_FieldOptions_clear_retention(google_protobuf_FieldOptions* msg) { + const upb_MiniTableField field = {17, 20, 9, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE int32_t google_protobuf_FieldOptions_retention(const google_protobuf_FieldOptions* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = {17, 20, 9, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FieldOptions_has_retention(const google_protobuf_FieldOptions* msg) { + const upb_MiniTableField field = {17, 20, 9, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} +UPB_INLINE void google_protobuf_FieldOptions_clear_target(google_protobuf_FieldOptions* msg) { + const upb_MiniTableField field = {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE int32_t google_protobuf_FieldOptions_target(const google_protobuf_FieldOptions* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FieldOptions_has_target(const google_protobuf_FieldOptions* msg) { + const upb_MiniTableField field = {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} UPB_INLINE void google_protobuf_FieldOptions_clear_uninterpreted_option(google_protobuf_FieldOptions* msg) { - const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* size) { - const upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + const upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; const upb_Array* arr = upb_Message_GetArray(msg, &field); if (arr) { if (size) *size = arr->size; @@ -6521,8 +6551,16 @@ UPB_INLINE void google_protobuf_FieldOptions_set_debug_redact(google_protobuf_Fi const upb_MiniTableField field = {16, 18, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); } +UPB_INLINE void google_protobuf_FieldOptions_set_retention(google_protobuf_FieldOptions *msg, int32_t value) { + const upb_MiniTableField field = {17, 20, 9, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); +} +UPB_INLINE void google_protobuf_FieldOptions_set_target(google_protobuf_FieldOptions *msg, int32_t value) { + const upb_MiniTableField field = {18, 24, 10, 3, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); +} UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* size) { - upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetMutableArray(msg, &field); if (arr) { if (size) *size = arr->size; @@ -6533,11 +6571,11 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu } } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t size, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; return (google_protobuf_UninterpretedOption**)upb_Message_ResizeArray(msg, &field, size, arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions* msg, upb_Arena* arena) { - upb_MiniTableField field = {999, UPB_SIZE(20, 24), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; + upb_MiniTableField field = {999, UPB_SIZE(28, 32), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; upb_Array* arr = upb_Message_GetOrCreateMutableArray(msg, &field, arena); if (!arr || !_upb_Array_ResizeUninitialized(arr, arr->size + 1, arena)) { return NULL; diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index b10a8d4c93c4..84d346ec58ef 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -366,7 +366,9 @@ PROTOBUF_CONSTEXPR FieldOptions::FieldOptions( , /* ._impl_.weak_ = */ false , /* ._impl_.debug_redact_ = */ false -} {} + + , /*decltype(_impl_.retention_)*/0 + , /*decltype(_impl_.target_)*/0} {} struct FieldOptionsDefaultTypeInternal { PROTOBUF_CONSTEXPR FieldOptionsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~FieldOptionsDefaultTypeInternal() {} @@ -903,6 +905,8 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.deprecated_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.weak_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.debug_redact_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.retention_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.target_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_.uninterpreted_option_), 0, 2, @@ -912,6 +916,8 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P 5, 6, 7, + 8, + 9, ~0u, ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofOptions, _internal_metadata_), @@ -1083,18 +1089,18 @@ static const ::_pbi::MigrationSchema { 206, 220, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)}, { 226, 255, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileOptions)}, { 276, 290, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)}, - { 296, 313, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, - { 322, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, - { 331, 343, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, - { 347, 357, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, - { 359, 369, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, - { 371, 382, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, - { 385, 395, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, - { 397, 412, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, - { 419, 432, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, - { 437, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, - { 446, 459, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, - { 464, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, + { 296, 315, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, + { 326, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, + { 335, 347, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, + { 351, 361, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, + { 363, 373, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, + { 375, 386, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, + { 389, 399, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, + { 401, 416, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, + { 423, 436, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, + { 441, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, + { 450, 463, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, + { 468, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -1229,78 +1235,81 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR "eld_conflicts\030\013 \001(\010B\002\030\001\022C\n\024uninterpreted" "_option\030\347\007 \003(\0132$.google.protobuf.Uninter" "pretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005J\004\010\005\020\006J\004\010\006\020" - "\007J\004\010\010\020\tJ\004\010\t\020\n\"\301\006\n\014FieldOptions\022:\n\005ctype\030" + "\007J\004\010\010\020\tJ\004\010\t\020\n\"\303\007\n\014FieldOptions\022:\n\005ctype\030" "\001 \001(\0162#.google.protobuf.FieldOptions.CTy" "pe:\006STRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001" "(\0162$.google.protobuf.FieldOptions.JSType" ":\tJS_NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\036\n\017unve" "rified_lazy\030\017 \001(\010:\005false\022\031\n\ndeprecated\030\003" " \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022\033\n\014debu" - "g_redact\030\020 \001(\010:\005false\022C\n\024uninterpreted_o" - "ption\030\347\007 \003(\0132$.google.protobuf.Uninterpr" - "etedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020" - "\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022\r\n\tJS_NORM" - "AL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMBER\020\002\"U\n\017Op" - "tionRetention\022\025\n\021RETENTION_UNKNOWN\020\000\022\025\n\021" - "RETENTION_RUNTIME\020\001\022\024\n\020RETENTION_SOURCE\020" - "\002\"\214\002\n\020OptionTargetType\022\027\n\023TARGET_TYPE_UN" - "KNOWN\020\000\022\024\n\020TARGET_TYPE_FILE\020\001\022\037\n\033TARGET_" - "TYPE_EXTENSION_RANGE\020\002\022\027\n\023TARGET_TYPE_ME" - "SSAGE\020\003\022\025\n\021TARGET_TYPE_FIELD\020\004\022\025\n\021TARGET" - "_TYPE_ONEOF\020\005\022\024\n\020TARGET_TYPE_ENUM\020\006\022\032\n\026T" - "ARGET_TYPE_ENUM_ENTRY\020\007\022\027\n\023TARGET_TYPE_S" - "ERVICE\020\010\022\026\n\022TARGET_TYPE_METHOD\020\t*\t\010\350\007\020\200\200" - "\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024uninterpret" - "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" - "erpretedOption*\t\010\350\007\020\200\200\200\200\002\"\307\001\n\013EnumOption" - "s\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001" - "(\010:\005false\0222\n&deprecated_legacy_json_fiel" - "d_conflicts\030\006 \001(\010B\002\030\001\022C\n\024uninterpreted_o" - "ption\030\347\007 \003(\0132$.google.protobuf.Uninterpr" - "etedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n\020EnumValue" - "Options\022\031\n\ndeprecated\030\001 \001(\010:\005false\022C\n\024un" - "interpreted_option\030\347\007 \003(\0132$.google.proto" - "buf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016Se" - "rviceOptions\022\031\n\ndeprecated\030! \001(\010:\005false\022" - "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google." - "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"" - "\255\002\n\rMethodOptions\022\031\n\ndeprecated\030! \001(\010:\005f" - "alse\022_\n\021idempotency_level\030\" \001(\0162/.google" - ".protobuf.MethodOptions.IdempotencyLevel" - ":\023IDEMPOTENCY_UNKNOWN\022C\n\024uninterpreted_o" - "ption\030\347\007 \003(\0132$.google.protobuf.Uninterpr" - "etedOption\"P\n\020IdempotencyLevel\022\027\n\023IDEMPO" - "TENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001\022\016\n\n" - "IDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023Uninterprete" - "dOption\022;\n\004name\030\002 \003(\0132-.google.protobuf." - "UninterpretedOption.NamePart\022\030\n\020identifi" - "er_value\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001" - "(\004\022\032\n\022negative_int_value\030\005 \001(\003\022\024\n\014double" - "_value\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017ag" - "gregate_value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_" - "part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016Sou" - "rceCodeInfo\022:\n\010location\030\001 \003(\0132(.google.p" - "rotobuf.SourceCodeInfo.Location\032\206\001\n\010Loca" - "tion\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001" - "\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021trailing_c" - "omments\030\004 \001(\t\022!\n\031leading_detached_commen" - "ts\030\006 \003(\t\"\234\002\n\021GeneratedCodeInfo\022A\n\nannota" - "tion\030\001 \003(\0132-.google.protobuf.GeneratedCo" - "deInfo.Annotation\032\303\001\n\nAnnotation\022\020\n\004path" - "\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin" - "\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626." - "google.protobuf.GeneratedCodeInfo.Annota" - "tion.Semantic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003S" - "ET\020\001\022\t\n\005ALIAS\020\002B~\n\023com.google.protobufB\020" - "DescriptorProtosH\001Z-google.golang.org/pr" - "otobuf/types/descriptorpb\370\001\001\242\002\003GPB\252\002\032Goo" - "gle.Protobuf.Reflection" + "g_redact\030\020 \001(\010:\005false\022@\n\tretention\030\021 \001(\016" + "2-.google.protobuf.FieldOptions.OptionRe" + "tention\022>\n\006target\030\022 \001(\0162..google.protobu" + "f.FieldOptions.OptionTargetType\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption\"/\n\005CType\022\n\n\006STRING\020" + "\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022" + "\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMB" + "ER\020\002\"U\n\017OptionRetention\022\025\n\021RETENTION_UNK" + "NOWN\020\000\022\025\n\021RETENTION_RUNTIME\020\001\022\024\n\020RETENTI" + "ON_SOURCE\020\002\"\214\002\n\020OptionTargetType\022\027\n\023TARG" + "ET_TYPE_UNKNOWN\020\000\022\024\n\020TARGET_TYPE_FILE\020\001\022" + "\037\n\033TARGET_TYPE_EXTENSION_RANGE\020\002\022\027\n\023TARG" + "ET_TYPE_MESSAGE\020\003\022\025\n\021TARGET_TYPE_FIELD\020\004" + "\022\025\n\021TARGET_TYPE_ONEOF\020\005\022\024\n\020TARGET_TYPE_E" + "NUM\020\006\022\032\n\026TARGET_TYPE_ENUM_ENTRY\020\007\022\027\n\023TAR" + "GET_TYPE_SERVICE\020\010\022\026\n\022TARGET_TYPE_METHOD" + "\020\t*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024u" + "ninterpreted_option\030\347\007 \003(\0132$.google.prot" + "obuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\307\001\n\013" + "EnumOptions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndepr" + "ecated\030\003 \001(\010:\005false\0222\n&deprecated_legacy" + "_json_field_conflicts\030\006 \001(\010B\002\030\001\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption*\t\010\350\007\020\200\200\200\200\002J\004\010\005\020\006\"}\n" + "\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:\005f" + "alse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" + "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" + "\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030! \001" + "(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003(\013" + "2$.google.protobuf.UninterpretedOption*\t" + "\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprecate" + "d\030! \001(\010:\005false\022_\n\021idempotency_level\030\" \001(" + "\0162/.google.protobuf.MethodOptions.Idempo" + "tencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption\"P\n\020IdempotencyLevel" + "\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_EFF" + "ECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023Un" + "interpretedOption\022;\n\004name\030\002 \003(\0132-.google" + ".protobuf.UninterpretedOption.NamePart\022\030" + "\n\020identifier_value\030\003 \001(\t\022\032\n\022positive_int" + "_value\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001(\003" + "\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_value\030\007" + " \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NamePar" + "t\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002" + "(\010\"\325\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003(\0132" + "(.google.protobuf.SourceCodeInfo.Locatio" + "n\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span" + "\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021" + "trailing_comments\030\004 \001(\t\022!\n\031leading_detac" + "hed_comments\030\006 \003(\t\"\234\002\n\021GeneratedCodeInfo" + "\022A\n\nannotation\030\001 \003(\0132-.google.protobuf.G" + "eneratedCodeInfo.Annotation\032\303\001\n\nAnnotati" + "on\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013source_file\030\002 \001(" + "\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 \001(\005\022H\n\010semanti" + "c\030\005 \001(\01626.google.protobuf.GeneratedCodeI" + "nfo.Annotation.Semantic\"(\n\010Semantic\022\010\n\004N" + "ONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002B~\n\023com.google." + "protobufB\020DescriptorProtosH\001Z-google.gol" + "ang.org/protobuf/types/descriptorpb\370\001\001\242\002" + "\003GPB\252\002\032Google.Protobuf.Reflection" }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = { false, false, - 6703, + 6833, descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto, "google/protobuf/descriptor.proto", &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once, @@ -8159,6 +8168,12 @@ class FieldOptions::_Internal { static void set_has_debug_redact(HasBits* has_bits) { (*has_bits)[0] |= 128u; } + static void set_has_retention(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } + static void set_has_target(HasBits* has_bits) { + (*has_bits)[0] |= 512u; + } }; FieldOptions::FieldOptions(::PROTOBUF_NAMESPACE_ID::Arena* arena) @@ -8187,13 +8202,15 @@ FieldOptions::FieldOptions(const FieldOptions& from) , decltype(_impl_.weak_) {} , decltype(_impl_.debug_redact_) {} - }; + + , decltype(_impl_.retention_){} + , decltype(_impl_.target_){}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); ::memcpy(&_impl_.ctype_, &from._impl_.ctype_, - static_cast<::size_t>(reinterpret_cast(&_impl_.debug_redact_) - - reinterpret_cast(&_impl_.ctype_)) + sizeof(_impl_.debug_redact_)); + static_cast<::size_t>(reinterpret_cast(&_impl_.target_) - + reinterpret_cast(&_impl_.ctype_)) + sizeof(_impl_.target_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions) } @@ -8218,6 +8235,8 @@ inline void FieldOptions::SharedCtor(::_pb::Arena* arena) { , decltype(_impl_.debug_redact_) { false } + , decltype(_impl_.retention_){0} + , decltype(_impl_.target_){0} }; } @@ -8254,6 +8273,11 @@ void FieldOptions::Clear() { reinterpret_cast(&_impl_.debug_redact_) - reinterpret_cast(&_impl_.ctype_)) + sizeof(_impl_.debug_redact_)); } + if (cached_has_bits & 0x00000300u) { + ::memset(&_impl_.retention_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.target_) - + reinterpret_cast(&_impl_.retention_)) + sizeof(_impl_.target_)); + } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -8353,6 +8377,34 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::_pbi::ParseContext* goto handle_unusual; } continue; + // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; + case 17: + if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 136)) { + ::uint32_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention_IsValid(static_cast(val)))) { + _internal_set_retention(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(17, val, mutable_unknown_fields()); + } + } else { + goto handle_unusual; + } + continue; + // optional .google.protobuf.FieldOptions.OptionTargetType target = 18; + case 18: + if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 144)) { + ::uint32_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType_IsValid(static_cast(val)))) { + _internal_set_target(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(18, val, mutable_unknown_fields()); + } + } else { + goto handle_unusual; + } + continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) { @@ -8459,6 +8511,20 @@ ::uint8_t* FieldOptions::_InternalSerialize( 16, this->_internal_debug_redact(), target); } + // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 17, this->_internal_retention(), target); + } + + // optional .google.protobuf.FieldOptions.OptionTargetType target = 18; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 18, this->_internal_target(), target); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned i = 0, n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { @@ -8540,6 +8606,20 @@ ::size_t FieldOptions::ByteSizeLong() const { total_size += 3; } + } + if (cached_has_bits & 0x00000300u) { + // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; + if (cached_has_bits & 0x00000100u) { + total_size += 2 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_retention()); + } + + // optional .google.protobuf.FieldOptions.OptionTargetType target = 18; + if (cached_has_bits & 0x00000200u) { + total_size += 2 + + ::_pbi::WireFormatLite::EnumSize(this->_internal_target()); + } + } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -8588,6 +8668,15 @@ void FieldOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::P } _this->_impl_._has_bits_[0] |= cached_has_bits; } + if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000100u) { + _this->_impl_.retention_ = from._impl_.retention_; + } + if (cached_has_bits & 0x00000200u) { + _this->_impl_.target_ = from._impl_.target_; + } + _this->_impl_._has_bits_[0] |= cached_has_bits; + } _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -8616,8 +8705,8 @@ void FieldOptions::InternalSwap(FieldOptions* other) { swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); _impl_.uninterpreted_option_.InternalSwap(&other->_impl_.uninterpreted_option_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.debug_redact_) - + sizeof(FieldOptions::_impl_.debug_redact_) + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.target_) + + sizeof(FieldOptions::_impl_.target_) - PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.ctype_)>( reinterpret_cast(&_impl_.ctype_), reinterpret_cast(&other->_impl_.ctype_)); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 8963b4e804dc..3c102ac45d0f 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -4842,6 +4842,8 @@ class PROTOBUF_EXPORT FieldOptions final : kDeprecatedFieldNumber = 3, kWeakFieldNumber = 10, kDebugRedactFieldNumber = 16, + kRetentionFieldNumber = 17, + kTargetFieldNumber = 18, }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; @@ -4944,6 +4946,24 @@ class PROTOBUF_EXPORT FieldOptions final : bool _internal_debug_redact() const; void _internal_set_debug_redact(bool value); + public: + // optional .google.protobuf.FieldOptions.OptionRetention retention = 17; + bool has_retention() const; + void clear_retention() ; + ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention retention() const; + void set_retention(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention value); + private: + ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention _internal_retention() const; + void _internal_set_retention(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention value); + public: + // optional .google.protobuf.FieldOptions.OptionTargetType target = 18; + bool has_target() const; + void clear_target() ; + ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType target() const; + void set_target(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value); + private: + ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType _internal_target() const; + void _internal_set_target(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value); public: template @@ -5117,6 +5137,8 @@ class PROTOBUF_EXPORT FieldOptions final : bool deprecated_; bool weak_; bool debug_redact_; + int retention_; + int target_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; @@ -12711,6 +12733,58 @@ inline void FieldOptions::_internal_set_debug_redact(bool value) { _impl_.debug_redact_ = value; } +// optional .google.protobuf.FieldOptions.OptionRetention retention = 17; +inline bool FieldOptions::has_retention() const { + bool value = (_impl_._has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline void FieldOptions::clear_retention() { + _impl_.retention_ = 0; + _impl_._has_bits_[0] &= ~0x00000100u; +} +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention FieldOptions::_internal_retention() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention >(_impl_.retention_); +} +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention FieldOptions::retention() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.retention) + return _internal_retention(); +} +inline void FieldOptions::_internal_set_retention(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention value) { + assert(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000100u; + _impl_.retention_ = value; +} +inline void FieldOptions::set_retention(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionRetention value) { + _internal_set_retention(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.retention) +} + +// optional .google.protobuf.FieldOptions.OptionTargetType target = 18; +inline bool FieldOptions::has_target() const { + bool value = (_impl_._has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline void FieldOptions::clear_target() { + _impl_.target_ = 0; + _impl_._has_bits_[0] &= ~0x00000200u; +} +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType FieldOptions::_internal_target() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType >(_impl_.target_); +} +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType FieldOptions::target() const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.target) + return _internal_target(); +} +inline void FieldOptions::_internal_set_target(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value) { + assert(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000200u; + _impl_.target_ = value; +} +inline void FieldOptions::set_target(::PROTOBUF_NAMESPACE_ID::FieldOptions_OptionTargetType value) { + _internal_set_target(value); + // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.target) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int FieldOptions::_internal_uninterpreted_option_size() const { return _impl_.uninterpreted_option_.size(); diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index b6108d03b8f6..3b3867543cef 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -640,6 +640,8 @@ message FieldOptions { RETENTION_SOURCE = 2; } + optional OptionRetention retention = 17; + // This indicates the types of entities that the field may apply to when used // as an option. If it is unset, then the field may be freely used as an // option on any kind of entity. Note: as of January 2023, support for this is @@ -657,6 +659,8 @@ message FieldOptions { TARGET_TYPE_METHOD = 9; } + optional OptionTargetType target = 18; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999;