From d955a548e10f9c68dcdc8cf070287295e3a92768 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 12 Dec 2022 12:02:56 -0800 Subject: [PATCH 01/43] Fix open-source builds due to references to lazy fields. PiperOrigin-RevId: 494789853 --- src/google/protobuf/generated_message_tctable_lite.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc index a54127128573..d2c89e826665 100644 --- a/src/google/protobuf/generated_message_tctable_lite.cc +++ b/src/google/protobuf/generated_message_tctable_lite.cc @@ -1797,13 +1797,6 @@ bool TcParser::ChangeOneof(const TcParseTableBase* table, } break; } - case field_layout::kRepLazy: { - auto& field = RefAt(msg, current_entry->offset); - if (!msg->GetArenaForAllocation()) { - delete field; - } - break; - } default: GOOGLE_LOG(DFATAL) << "message rep not handled: " << (current_rep >> field_layout::kRepShift); From 1050599cb01a47ac1dfd311d163d1ab29a57087a Mon Sep 17 00:00:00 2001 From: Eric Salo Date: Mon, 12 Dec 2022 12:16:36 -0800 Subject: [PATCH 02/43] update protobuf_deps.bzl to pull in the latest upb PiperOrigin-RevId: 494793478 --- php/ext/google/protobuf/convert.c | 2 +- php/ext/google/protobuf/php-upb.c | 361 +++--- php/ext/google/protobuf/php-upb.h | 1498 ++++++++++++++----------- protobuf_deps.bzl | 4 +- ruby/ext/google/protobuf_c/ruby-upb.c | 361 +++--- ruby/ext/google/protobuf_c/ruby-upb.h | 1498 ++++++++++++++----------- 6 files changed, 2033 insertions(+), 1691 deletions(-) diff --git a/php/ext/google/protobuf/convert.c b/php/ext/google/protobuf/convert.c index 6a8cca9cf1db..f47ff6e5d21e 100644 --- a/php/ext/google/protobuf/convert.c +++ b/php/ext/google/protobuf/convert.c @@ -510,7 +510,7 @@ bool Convert_PhpToUpbAutoWrap(zval *val, upb_MessageValue *upb_val, TypeInfo typ const upb_FieldDef *val_f = upb_MessageDef_FindFieldByNumber(subm, 1); upb_MessageValue msgval; if (!Convert_PhpToUpb(val, &msgval, TypeInfo_Get(val_f), arena)) return false; - upb_Message_Set(wrapper, val_f, msgval, arena); + upb_Message_SetFieldByDef(wrapper, val_f, msgval, arena); upb_val->msg_val = wrapper; return true; } else { diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index baa3af0cf216..a2cb3b5859d8 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -147,6 +147,12 @@ #if defined(__GNUC__) || defined(__clang__) #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#elif defined(_MSC_VER) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __assume(0); \ + } while (0) #else #define UPB_UNREACHABLE() do { assert(0); } while(0) #endif @@ -5508,6 +5514,11 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray( if (ret.status == kUpb_UnknownToMessage_Ok) { upb_MessageValue value; value.msg_val = ret.message; + // Allocate array on demand before append. + if (!repeated_messages) { + upb_MiniTable_ResizeArray(msg, field, 0, arena); + repeated_messages = upb_MiniTable_GetMutableArray(msg, field); + } if (!upb_Array_Append(repeated_messages, value, arena)) { return kUpb_UnknownToMessage_OutOfMemory; } @@ -5650,20 +5661,6 @@ const upb_Message_Extension* _upb_Message_Getext( return NULL; } -void _upb_Message_Clearext(upb_Message* msg, - const upb_MiniTableExtension* ext_l) { - upb_Message_Internal* in = upb_Message_Getinternal(msg); - if (!in->internal) return; - const upb_Message_Extension* base = - UPB_PTR_AT(in->internal, in->internal->ext_begin, void); - upb_Message_Extension* ext = - (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); - if (ext) { - *ext = *base; - in->internal->ext_begin += sizeof(upb_Message_Extension); - } -} - upb_Message_Extension* _upb_Message_GetOrCreateExtension( upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* arena) { upb_Message_Extension* ext = @@ -6391,6 +6388,21 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data, } upb_MtDecoder_ParseMessage(d, data, len); + if (UPB_UNLIKELY(d->table->field_count != 2)) { + upb_MtDecoder_ErrorFormat(d, "%hu fields in map", d->table->field_count); + UPB_UNREACHABLE(); + } + if (UPB_UNLIKELY(d->table->fields[0].number != 1)) { + upb_MtDecoder_ErrorFormat(d, "field %d in map key", + d->table->fields[0].number); + UPB_UNREACHABLE(); + } + if (UPB_UNLIKELY(d->table->fields[1].number != 2)) { + upb_MtDecoder_ErrorFormat(d, "field %d in map val", + d->table->fields[1].number); + UPB_UNREACHABLE(); + } + upb_MtDecoder_AssignHasbits(d->table); // Map entries have a pre-determined layout, regardless of types. @@ -8079,7 +8091,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]); const int32_t end = google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]); - const int32_t max = kUpb_MaxFieldNumber + 1; // A full validation would also check that each range is disjoint, and that // none of the fields overlap with the extension ranges, but we are just @@ -8087,7 +8098,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( // Note: Not a typo! Unlike extension ranges and message reserved ranges, // the end value of an enum reserved range is *inclusive*! - if (start < 1 || end < start || end > max) { + if (end < start) { _upb_DefBuilder_Errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n", (int)start, (int)end, upb_EnumDef_FullName(e)); } @@ -9482,7 +9493,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, bool upb_Message_HasFieldByDef(const upb_Message* msg, const upb_FieldDef* f) { UPB_ASSERT(upb_FieldDef_HasPresence(f)); - return _upb_MiniTable_HasField(msg, upb_FieldDef_MiniTable(f)); + return upb_Message_HasField(msg, upb_FieldDef_MiniTable(f)); } const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, @@ -9504,7 +9515,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, const upb_FieldDef* f) { upb_MessageValue default_val = upb_FieldDef_Default(f); upb_MessageValue ret; - _upb_MiniTable_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret); + _upb_Message_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret); return ret; } @@ -9549,11 +9560,11 @@ upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, upb_MessageValue val, upb_Arena* a) { - return _upb_MiniTable_SetField(msg, upb_FieldDef_MiniTable(f), &val, a); + return _upb_Message_SetField(msg, upb_FieldDef_MiniTable(f), &val, a); } void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { - _upb_MiniTable_ClearField(msg, upb_FieldDef_MiniTable(f)); + upb_Message_ClearField(msg, upb_FieldDef_MiniTable(f)); } void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) { @@ -10788,6 +10799,7 @@ const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status) { UPB_LONGJMP(d->err, status); return NULL; } + static void _upb_Decoder_VerifyUtf8(upb_Decoder* d, const char* buf, int len) { if (!_upb_Decoder_VerifyUtf8Inline(buf, len)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); @@ -10863,7 +10875,8 @@ static const char* upb_Decoder_DecodeSize(upb_Decoder* d, const char* ptr, uint32_t* size) { uint64_t size64; ptr = _upb_Decoder_DecodeVarint(d, ptr, &size64); - if (size64 >= INT32_MAX || ptr - d->end + (int)size64 > d->limit) { + if (size64 >= INT32_MAX || + !upb_EpsCopyInputStream_CheckSize(&d->input, ptr, (int)size64)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); } *size = size64; @@ -10910,15 +10923,6 @@ static upb_Message* _upb_Decoder_NewSubMessage( return msg; } -UPB_NOINLINE -const char* _upb_Decoder_IsDoneFallback(upb_Decoder* d, const char* ptr, - int overrun) { - int status; - ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status); - if (ptr == NULL) _upb_Decoder_ErrorJmp(d, status); - return ptr; -} - static const char* _upb_Decoder_ReadString(upb_Decoder* d, const char* ptr, int size, upb_StringView* str) { if (d->options & kUpb_DecodeOption_AliasString) { @@ -10954,11 +10958,11 @@ UPB_FORCEINLINE static const char* _upb_Decoder_DecodeSubMessage( upb_Decoder* d, const char* ptr, upb_Message* submsg, const upb_MiniTableSub* subs, const upb_MiniTableField* field, int size) { - int saved_delta = _upb_Decoder_PushLimit(d, ptr, size); + int saved_delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, size); const upb_MiniTable* subl = subs[field->submsg_index].submsg; UPB_ASSERT(subl); ptr = _upb_Decoder_RecurseSubMessage(d, ptr, submsg, subl, DECODE_NOGROUP); - _upb_Decoder_PopLimit(d, ptr, saved_delta); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_delta); return ptr; } @@ -11105,7 +11109,7 @@ static const char* _upb_Decoder_DecodeVarintPacked( upb_Decoder* d, const char* ptr, upb_Array* arr, wireval* val, const upb_MiniTableField* field, int lg2) { int scale = 1 << lg2; - int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size); + int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size); char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size << lg2, void); while (!_upb_Decoder_IsDone(d, &ptr)) { wireval elem; @@ -11118,7 +11122,7 @@ static const char* _upb_Decoder_DecodeVarintPacked( memcpy(out, &elem, scale); out += scale; } - _upb_Decoder_PopLimit(d, ptr, saved_limit); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit); return ptr; } @@ -11128,7 +11132,7 @@ static const char* _upb_Decoder_DecodeEnumPacked( const upb_MiniTableSub* subs, const upb_MiniTableField* field, wireval* val) { const upb_MiniTableEnum* e = subs[field->submsg_index].subenum; - int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size); + int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size); char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size * 4, void); while (!_upb_Decoder_IsDone(d, &ptr)) { wireval elem; @@ -11144,7 +11148,7 @@ static const char* _upb_Decoder_DecodeEnumPacked( memcpy(out, &elem, 4); out += 4; } - _upb_Decoder_PopLimit(d, ptr, saved_limit); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit); return ptr; } @@ -11892,7 +11896,7 @@ static const char* _upb_Decoder_DecodeMessage(upb_Decoder* d, const char* ptr, d->debug_tagstart = ptr; #endif - UPB_ASSERT(ptr < d->limit_ptr); + UPB_ASSERT(ptr < d->input.limit_ptr); ptr = _upb_Decoder_DecodeTag(d, ptr, &tag); field_number = tag >> 3; wire_type = tag & 7; @@ -11950,6 +11954,13 @@ static upb_DecodeStatus _upb_Decoder_DecodeTop(struct upb_Decoder* d, return kUpb_DecodeStatus_Ok; } +UPB_NOINLINE +const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, + const char* ptr, int overrun) { + return _upb_EpsCopyInputStream_IsDoneFallbackInline( + e, ptr, overrun, _upb_Decoder_BufferFlipCallback); +} + upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg, const upb_MiniTable* l, const upb_ExtensionRegistry* extreg, int options, @@ -11957,20 +11968,11 @@ upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg, upb_Decoder state; unsigned depth = (unsigned)options >> 16; - if (size <= 16) { - memset(&state.patch, 0, 32); - if (size) memcpy(&state.patch, buf, size); - buf = state.patch; - state.end = buf + size; - state.limit = 0; + if (upb_EpsCopyInputStream_Init(&state.input, &buf, size)) { options &= ~kUpb_DecodeOption_AliasString; // Can't alias patch buf. - } else { - state.end = buf + size - 16; - state.limit = 16; } state.extreg = extreg; - state.limit_ptr = state.end; state.unknown = NULL; state.depth = depth ? depth : 64; state.end_group = DECODE_NOGROUP; @@ -12035,28 +12037,27 @@ typedef enum { UPB_NOINLINE static const char* fastdecode_isdonefallback(UPB_PARSE_PARAMS) { int overrun = data; - int status; - ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status); - if (ptr == NULL) _upb_FastDecoder_ErrorJmp(d, status); + ptr = _upb_EpsCopyInputStream_IsDoneFallbackInline( + &d->input, ptr, overrun, _upb_Decoder_BufferFlipCallback); data = _upb_FastDecoder_LoadTag(ptr); UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); } UPB_FORCEINLINE static const char* fastdecode_dispatch(UPB_PARSE_PARAMS) { - if (UPB_UNLIKELY(ptr >= d->limit_ptr)) { - int overrun = ptr - d->end; - if (UPB_LIKELY(overrun == d->limit)) { - // Parse is finished. + int overrun; + switch (upb_EpsCopyInputStream_IsDoneStatus(&d->input, ptr, &overrun)) { + case kUpb_IsDoneStatus_Done: *(uint32_t*)msg |= hasbits; // Sync hasbits. const upb_MiniTable* l = decode_totablep(table); return UPB_UNLIKELY(l->required_count) ? _upb_Decoder_CheckRequired(d, ptr, msg, l) : ptr; - } else { + case kUpb_IsDoneStatus_NotDone: + break; + case kUpb_IsDoneStatus_NeedFallback: data = overrun; UPB_MUSTTAIL return fastdecode_isdonefallback(UPB_PARSE_ARGS); - } } // Read two bytes of tag data (for a one-byte tag, the high byte is junk). @@ -12094,37 +12095,17 @@ static const char* fastdecode_longsize(const char* ptr, int* size) { } UPB_FORCEINLINE -static bool fastdecode_boundscheck(const char* ptr, size_t len, - const char* end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end + 16; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - -UPB_FORCEINLINE -static bool fastdecode_boundscheck2(const char* ptr, size_t len, - const char* end) { - // This is one extra branch compared to the more normal: - // return (size_t)(end - ptr) < size; - // However it is one less computation if we are just about to use "ptr + len": - // https://godbolt.org/z/35YGPz - // In microbenchmarks this shows an overall 4% improvement. - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - -typedef const char* fastdecode_delimfunc(upb_Decoder* d, const char* ptr, - void* ctx); - -UPB_FORCEINLINE -static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr, - fastdecode_delimfunc* func, void* ctx) { +static const char* fastdecode_delimited( + upb_Decoder* d, const char* ptr, + upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { ptr++; + + // Sign-extend so varint greater than one byte becomes negative, causing + // fast delimited parse to fail. int len = (int8_t)ptr[-1]; - if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) { + + if (!upb_EpsCopyInputStream_TryParseDelimitedFast(&d->input, &ptr, len, func, + ctx)) { // Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer. // If it exceeds the buffer limit, limit/limit_ptr will change during // sub-message parsing, so we need to preserve delta, not limit. @@ -12136,25 +12117,13 @@ static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr, return NULL; } } - if (ptr - d->end + (int)len > d->limit) { + if (!upb_EpsCopyInputStream_CheckSize(&d->input, ptr, len)) { // Corrupt wire format: invalid limit. return NULL; } - int delta = _upb_Decoder_PushLimit(d, ptr, len); - ptr = func(d, ptr, ctx); - _upb_Decoder_PopLimit(d, ptr, delta); - } else { - // Fast case: Sub-message is <128 bytes and fits in the current buffer. - // This means we can preserve limit/limit_ptr verbatim. - const char* saved_limit_ptr = d->limit_ptr; - int saved_limit = d->limit; - d->limit_ptr = ptr + len; - d->limit = d->limit_ptr - d->end; - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); - ptr = func(d, ptr, ctx); - d->limit_ptr = saved_limit_ptr; - d->limit = saved_limit; - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + int delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, len); + ptr = func(&d->input, ptr, ctx); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, delta); } return ptr; } @@ -12395,8 +12364,9 @@ typedef struct { } fastdecode_varintdata; UPB_FORCEINLINE -static const char* fastdecode_topackedvarint(upb_Decoder* d, const char* ptr, - void* ctx) { +static const char* fastdecode_topackedvarint(upb_EpsCopyInputStream* e, + const char* ptr, void* ctx) { + upb_Decoder* d = (upb_Decoder*)e; fastdecode_varintdata* data = ctx; void* dst = data->dst; uint64_t val; @@ -12544,7 +12514,8 @@ TAGBYTES(p) ptr = fastdecode_longsize(ptr, &size); \ } \ \ - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr) || \ + if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \ + &d->input, ptr, size) || \ (size % valbytes) != 0)) { \ _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \ } \ @@ -12636,7 +12607,8 @@ static const char* fastdecode_verifyutf8(upb_Decoder* d, const char* ptr, ptr = fastdecode_longsize(ptr, &size); \ } \ \ - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr))) { \ + if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \ + &d->input, ptr, size))) { \ dst->size = 0; \ _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \ } \ @@ -12689,91 +12661,92 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, UPB_POISON_MEMORY_REGION(data + size, copy - size); } -#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \ - card, validate_utf8) \ - upb_StringView* dst; \ - fastdecode_arr farr; \ - int64_t size; \ - size_t arena_has; \ - size_t common_has; \ - char* buf; \ - \ - UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \ - UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \ - \ - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \ - sizeof(upb_StringView), card); \ - \ - again: \ - if (card == CARD_r) { \ - dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \ - } \ - \ - size = (uint8_t)ptr[tagbytes]; \ - ptr += tagbytes + 1; \ - dst->size = size; \ - \ - buf = d->arena.head.ptr; \ - arena_has = _upb_ArenaHas(&d->arena); \ - common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); \ - \ - if (UPB_LIKELY(size <= 15 - tagbytes)) { \ - if (arena_has < 16) goto longstr; \ - d->arena.head.ptr += 16; \ - memcpy(buf, ptr - tagbytes - 1, 16); \ - dst->data = buf + tagbytes + 1; \ - } else if (UPB_LIKELY(size <= 32)) { \ - if (UPB_UNLIKELY(common_has < 32)) goto longstr; \ - fastdecode_docopy(d, ptr, size, 32, buf, dst); \ - } else if (UPB_LIKELY(size <= 64)) { \ - if (UPB_UNLIKELY(common_has < 64)) goto longstr; \ - fastdecode_docopy(d, ptr, size, 64, buf, dst); \ - } else if (UPB_LIKELY(size < 128)) { \ - if (UPB_UNLIKELY(common_has < 128)) goto longstr; \ - fastdecode_docopy(d, ptr, size, 128, buf, dst); \ - } else { \ - goto longstr; \ - } \ - \ - ptr += size; \ - \ - if (card == CARD_r) { \ - if (validate_utf8 && \ - !_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \ - _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \ - } \ - fastdecode_nextret ret = fastdecode_nextrepeated( \ - d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \ - switch (ret.next) { \ - case FD_NEXT_SAMEFIELD: \ - dst = ret.dst; \ - goto again; \ - case FD_NEXT_OTHERFIELD: \ - data = ret.tag; \ - UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \ - case FD_NEXT_ATLIMIT: \ - return ptr; \ - } \ - } \ - \ - if (card != CARD_r && validate_utf8) { \ - data = (uint64_t)dst; \ - UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \ - } \ - \ - UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \ - \ - longstr: \ - if (card == CARD_r) { \ - fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \ - } \ - ptr--; \ - if (validate_utf8) { \ - UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \ - hasbits, (uint64_t)dst); \ - } else { \ - UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \ - hasbits, (uint64_t)dst); \ +#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \ + card, validate_utf8) \ + upb_StringView* dst; \ + fastdecode_arr farr; \ + int64_t size; \ + size_t arena_has; \ + size_t common_has; \ + char* buf; \ + \ + UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \ + UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \ + \ + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \ + sizeof(upb_StringView), card); \ + \ + again: \ + if (card == CARD_r) { \ + dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \ + } \ + \ + size = (uint8_t)ptr[tagbytes]; \ + ptr += tagbytes + 1; \ + dst->size = size; \ + \ + buf = d->arena.head.ptr; \ + arena_has = _upb_ArenaHas(&d->arena); \ + common_has = UPB_MIN(arena_has, \ + upb_EpsCopyInputStream_BytesAvailable(&d->input, ptr)); \ + \ + if (UPB_LIKELY(size <= 15 - tagbytes)) { \ + if (arena_has < 16) goto longstr; \ + d->arena.head.ptr += 16; \ + memcpy(buf, ptr - tagbytes - 1, 16); \ + dst->data = buf + tagbytes + 1; \ + } else if (UPB_LIKELY(size <= 32)) { \ + if (UPB_UNLIKELY(common_has < 32)) goto longstr; \ + fastdecode_docopy(d, ptr, size, 32, buf, dst); \ + } else if (UPB_LIKELY(size <= 64)) { \ + if (UPB_UNLIKELY(common_has < 64)) goto longstr; \ + fastdecode_docopy(d, ptr, size, 64, buf, dst); \ + } else if (UPB_LIKELY(size < 128)) { \ + if (UPB_UNLIKELY(common_has < 128)) goto longstr; \ + fastdecode_docopy(d, ptr, size, 128, buf, dst); \ + } else { \ + goto longstr; \ + } \ + \ + ptr += size; \ + \ + if (card == CARD_r) { \ + if (validate_utf8 && \ + !_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \ + _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \ + } \ + fastdecode_nextret ret = fastdecode_nextrepeated( \ + d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \ + switch (ret.next) { \ + case FD_NEXT_SAMEFIELD: \ + dst = ret.dst; \ + goto again; \ + case FD_NEXT_OTHERFIELD: \ + data = ret.tag; \ + UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \ + case FD_NEXT_ATLIMIT: \ + return ptr; \ + } \ + } \ + \ + if (card != CARD_r && validate_utf8) { \ + data = (uint64_t)dst; \ + UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \ + } \ + \ + UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \ + \ + longstr: \ + if (card == CARD_r) { \ + fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \ + } \ + ptr--; \ + if (validate_utf8) { \ + UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \ + hasbits, (uint64_t)dst); \ + } else { \ + UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \ + hasbits, (uint64_t)dst); \ } #define FASTDECODE_STRING(d, ptr, msg, table, hasbits, data, tagbytes, card, \ @@ -12803,7 +12776,8 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, dst->data = ptr; \ dst->size = size; \ \ - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { \ + if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \ + &d->input, ptr, size))) { \ ptr--; \ if (validate_utf8) { \ return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, \ @@ -12916,8 +12890,9 @@ typedef struct { } fastdecode_submsgdata; UPB_FORCEINLINE -static const char* fastdecode_tosubmsg(upb_Decoder* d, const char* ptr, - void* ctx) { +static const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e, + const char* ptr, void* ctx) { + upb_Decoder* d = (upb_Decoder*)e; fastdecode_submsgdata* submsg = ctx; ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->table, 0, 0); UPB_ASSUME(ptr != NULL); diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index cae3bc1518ab..1db98915b7ac 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -146,6 +146,12 @@ #if defined(__GNUC__) || defined(__clang__) #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#elif defined(_MSC_VER) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __assume(0); \ + } while (0) #else #define UPB_UNREACHABLE() do { assert(0); } while(0) #endif @@ -1651,7 +1657,8 @@ extern "C" { #endif // Creates a new message with the given mini_table on the given arena. -upb_Message* upb_Message_New(const upb_MiniTable* mini_table, upb_Arena* arena); +UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, + upb_Arena* arena); // Adds unknown data (serialized protobuf data) to the given message. // The data is copied into the message instance. @@ -1893,8 +1900,6 @@ const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, const upb_Message_Extension* _upb_Message_Getext( const upb_Message* msg, const upb_MiniTableExtension* ext); -void _upb_Message_Clearext(upb_Message* msg, const upb_MiniTableExtension* ext); - #ifdef __cplusplus } /* extern "C" */ #endif @@ -1950,7 +1955,7 @@ typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; // Creates a upb_ExtensionRegistry in the given arena. // The arena must outlive any use of the extreg. -upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); +UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); // Adds the given extension info for the array |e| of size |count| into the // registry. If there are any errors, the entire array is backed out. @@ -2324,8 +2329,8 @@ UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( return (char*)msg + field->offset; } -UPB_INLINE void _upb_MiniTable_SetPresence(upb_Message* msg, - const upb_MiniTableField* field) { +UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, + const upb_MiniTableField* field) { if (field->presence > 0) { _upb_sethas_field(msg, field); } else if (_upb_MiniTableField_InOneOf(field)) { @@ -2333,9 +2338,6 @@ UPB_INLINE void _upb_MiniTable_SetPresence(upb_Message* msg, } } -UPB_INLINE bool upb_MiniTable_HasField(const upb_Message* msg, - const upb_MiniTableField* field); - UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, const upb_MiniTableField* field) { char zero[16] = {0}; @@ -2384,31 +2386,52 @@ UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; // // All value in "field" are compile-time known. -// _upb_MiniTable_SetNonExtensionField(msg, &field, &value); +// _upb_Message_SetNonExtensionField(msg, &field, &value); // } // // // Via UPB_ASSUME(). -// UPB_INLINE void upb_MiniTable_SetBool(upb_Message* msg, -// const upb_MiniTableField* field, -// bool value) { +// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, +// const upb_MiniTableField* field, +// bool value, upb_Arena* a) { // UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool); // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); -// _upb_MiniTable_SetNonExtensionField(msg, field, &value); +// _upb_Message_SetField(msg, field, &value, a); // } // // As a result, we can use these universal getters/setters for *all* message // accessors: generated code, MiniTable accessors, and reflection. The only // exception is the binary encoder/decoder, which need to be a bit more clever // about how the read/write the message data, for efficiency. +// +// These functions work on both extensions and non-extensions. If the field +// of a setter is known to be a non-extension, the arena may be NULL and the +// returned bool value may be ignored since it will always succeed. -static UPB_FORCEINLINE void _upb_MiniTable_GetNonExtensionField( +UPB_INLINE bool _upb_Message_HasExtensionField( + const upb_Message* msg, const upb_MiniTableExtension* ext) { + UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); + return _upb_Message_Getext(msg, ext) != NULL; +} + +UPB_INLINE bool _upb_Message_HasNonExtensionField( + const upb_Message* msg, const upb_MiniTableField* field) { + UPB_ASSERT(upb_MiniTableField_HasPresence(field)); + UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); + if (_upb_MiniTableField_InOneOf(field)) { + return _upb_getoneofcase_field(msg, field) == field->number; + } else { + return _upb_hasbit_field(msg, field); + } +} + +static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( const upb_Message* msg, const upb_MiniTableField* field, const void* default_val, void* val) { UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); if ((_upb_MiniTableField_InOneOf(field) || _upb_MiniTable_ValueIsNonZero(default_val, field)) && - !upb_MiniTable_HasField(msg, field)) { + !_upb_Message_HasNonExtensionField(msg, field)) { _upb_MiniTable_CopyFieldData(val, default_val, field); return; } @@ -2416,7 +2439,7 @@ static UPB_FORCEINLINE void _upb_MiniTable_GetNonExtensionField( field); } -UPB_INLINE void _upb_MiniTable_GetExtensionField( +UPB_INLINE void _upb_Message_GetExtensionField( const upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* default_val, void* val) { UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); @@ -2428,28 +2451,29 @@ UPB_INLINE void _upb_MiniTable_GetExtensionField( } } -UPB_INLINE void _upb_MiniTable_GetField(const upb_Message* msg, - const upb_MiniTableField* field, - const void* default_val, void* val) { +UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, + const upb_MiniTableField* field, + const void* default_val, void* val) { if (upb_MiniTableField_IsExtension(field)) { - _upb_MiniTable_GetExtensionField(msg, (upb_MiniTableExtension*)field, - default_val, val); + _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, + default_val, val); } else { - _upb_MiniTable_GetNonExtensionField(msg, field, default_val, val); + _upb_Message_GetNonExtensionField(msg, field, default_val, val); } } -UPB_INLINE void _upb_MiniTable_SetNonExtensionField( +UPB_INLINE void _upb_Message_SetNonExtensionField( upb_Message* msg, const upb_MiniTableField* field, const void* val) { UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); - _upb_MiniTable_SetPresence(msg, field); + _upb_Message_SetPresence(msg, field); _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, field); } -UPB_INLINE bool _upb_MiniTable_SetExtensionField( +UPB_INLINE bool _upb_Message_SetExtensionField( upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, upb_Arena* a) { + UPB_ASSERT(a); upb_Message_Extension* ext = _upb_Message_GetOrCreateExtension(msg, mt_ext, a); if (!ext) return false; @@ -2457,51 +2481,33 @@ UPB_INLINE bool _upb_MiniTable_SetExtensionField( return true; } -UPB_INLINE bool _upb_MiniTable_SetField(upb_Message* msg, - const upb_MiniTableField* field, - const void* val, upb_Arena* a) { +UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, + const upb_MiniTableField* field, + const void* val, upb_Arena* a) { if (upb_MiniTableField_IsExtension(field)) { - return _upb_MiniTable_SetExtensionField( - msg, (const upb_MiniTableExtension*)field, val, a); + const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; + return _upb_Message_SetExtensionField(msg, ext, val, a); } else { - _upb_MiniTable_SetNonExtensionField(msg, field, val); + _upb_Message_SetNonExtensionField(msg, field, val); return true; } } -UPB_INLINE bool _upb_MiniTable_HasExtensionField( - const upb_Message* msg, const upb_MiniTableExtension* ext) { - UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); - return _upb_Message_Getext(msg, ext) != NULL; -} - -UPB_INLINE bool _upb_MiniTable_HasNonExtensionField( - const upb_Message* msg, const upb_MiniTableField* field) { - UPB_ASSERT(upb_MiniTableField_HasPresence(field)); - UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); - if (_upb_MiniTableField_InOneOf(field)) { - return _upb_getoneofcase_field(msg, field) == field->number; - } else { - return _upb_hasbit_field(msg, field); - } -} - -UPB_INLINE bool _upb_MiniTable_HasField(const upb_Message* msg, - const upb_MiniTableField* field) { - if (upb_MiniTableField_IsExtension(field)) { - return _upb_MiniTable_HasExtensionField( - msg, (const upb_MiniTableExtension*)field); - } else { - return _upb_MiniTable_HasNonExtensionField(msg, field); +UPB_INLINE void _upb_Message_ClearExtensionField( + upb_Message* msg, const upb_MiniTableExtension* ext_l) { + upb_Message_Internal* in = upb_Message_Getinternal(msg); + if (!in->internal) return; + const upb_Message_Extension* base = + UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); + upb_Message_Extension* ext = + (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); + if (ext) { + *ext = *base; + in->internal->ext_begin += sizeof(upb_Message_Extension); } } -UPB_INLINE void _upb_MiniTable_ClearExtensionField( - upb_Message* msg, const upb_MiniTableExtension* ext) { - _upb_Message_Clearext(msg, ext); -} - -UPB_INLINE void _upb_MiniTable_ClearNonExtensionField( +UPB_INLINE void _upb_Message_ClearNonExtensionField( upb_Message* msg, const upb_MiniTableField* field) { if (field->presence > 0) { _upb_clearhas_field(msg, field); @@ -2515,50 +2521,51 @@ UPB_INLINE void _upb_MiniTable_ClearNonExtensionField( field); } -UPB_INLINE void _upb_MiniTable_ClearField(upb_Message* msg, - const upb_MiniTableField* field) { +// EVERYTHING ABOVE THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// + +UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, + const upb_MiniTableField* field) { if (upb_MiniTableField_IsExtension(field)) { - _upb_Message_Clearext(msg, (const upb_MiniTableExtension*)field); + const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; + _upb_Message_ClearExtensionField(msg, ext); } else { - _upb_MiniTable_ClearNonExtensionField(msg, field); + _upb_Message_ClearNonExtensionField(msg, field); } } -// EVERYTHING ABOVE THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// - -UPB_API_INLINE void upb_MiniTable_ClearField(upb_Message* msg, - const upb_MiniTableField* field) { - _upb_MiniTable_ClearNonExtensionField(msg, field); -} - -UPB_API_INLINE bool upb_MiniTable_HasField(const upb_Message* msg, - const upb_MiniTableField* field) { - return _upb_MiniTable_HasNonExtensionField(msg, field); +UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, + const upb_MiniTableField* field) { + if (upb_MiniTableField_IsExtension(field)) { + const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; + return _upb_Message_HasExtensionField(msg, ext); + } else { + return _upb_Message_HasNonExtensionField(msg, field); + } } -UPB_API_INLINE bool upb_MiniTable_GetBool(const upb_Message* msg, - const upb_MiniTableField* field, - bool default_val) { +UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, + const upb_MiniTableField* field, + bool default_val) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); bool ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetBool(upb_Message* msg, - const upb_MiniTableField* field, - bool value) { +UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, + const upb_MiniTableField* field, + bool value, upb_Arena* a) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE int32_t upb_MiniTable_GetInt32(const upb_Message* msg, - const upb_MiniTableField* field, - int32_t default_val) { +UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, + const upb_MiniTableField* field, + int32_t default_val) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Int32 || field->descriptortype == kUpb_FieldType_SInt32 || field->descriptortype == kUpb_FieldType_SFixed32 || @@ -2566,41 +2573,41 @@ UPB_API_INLINE int32_t upb_MiniTable_GetInt32(const upb_Message* msg, UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); int32_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetInt32(upb_Message* msg, - const upb_MiniTableField* field, - int32_t value) { +UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, + const upb_MiniTableField* field, + int32_t value, upb_Arena* a) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Int32 || field->descriptortype == kUpb_FieldType_SInt32 || field->descriptortype == kUpb_FieldType_SFixed32); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE uint32_t upb_MiniTable_GetUInt32(const upb_Message* msg, - const upb_MiniTableField* field, - uint32_t default_val) { +UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, + const upb_MiniTableField* field, + uint32_t default_val) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_UInt32 || field->descriptortype == kUpb_FieldType_Fixed32); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); uint32_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetUInt32(upb_Message* msg, - const upb_MiniTableField* field, - uint32_t value) { +UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, + const upb_MiniTableField* field, + uint32_t value, upb_Arena* a) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_UInt32 || field->descriptortype == kUpb_FieldType_Fixed32); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } UPB_API_INLINE void upb_MiniTable_SetEnumProto2( @@ -2611,115 +2618,115 @@ UPB_API_INLINE void upb_MiniTable_SetEnumProto2( UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); UPB_ASSERT(upb_MiniTableEnum_CheckValue( upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + _upb_Message_SetNonExtensionField(msg, field, &value); } -UPB_API_INLINE int64_t upb_MiniTable_GetInt64(const upb_Message* msg, - const upb_MiniTableField* field, - uint64_t default_val) { +UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, + const upb_MiniTableField* field, + uint64_t default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Int64 || field->descriptortype == kUpb_FieldType_SInt64 || field->descriptortype == kUpb_FieldType_SFixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); int64_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetInt64(upb_Message* msg, - const upb_MiniTableField* field, - int64_t value) { +UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, + const upb_MiniTableField* field, + int64_t value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Int64 || field->descriptortype == kUpb_FieldType_SInt64 || field->descriptortype == kUpb_FieldType_SFixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE uint64_t upb_MiniTable_GetUInt64(const upb_Message* msg, - const upb_MiniTableField* field, - uint64_t default_val) { +UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, + const upb_MiniTableField* field, + uint64_t default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_UInt64 || field->descriptortype == kUpb_FieldType_Fixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); uint64_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetUInt64(upb_Message* msg, - const upb_MiniTableField* field, - uint64_t value) { +UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, + const upb_MiniTableField* field, + uint64_t value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_UInt64 || field->descriptortype == kUpb_FieldType_Fixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE float upb_MiniTable_GetFloat(const upb_Message* msg, - const upb_MiniTableField* field, - float default_val) { +UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, + const upb_MiniTableField* field, + float default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Float); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); float ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetFloat(upb_Message* msg, - const upb_MiniTableField* field, - float value) { +UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, + const upb_MiniTableField* field, + float value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Float); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE double upb_MiniTable_GetDouble(const upb_Message* msg, - const upb_MiniTableField* field, - double default_val) { +UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, + const upb_MiniTableField* field, + double default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Double); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); double ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetDouble(upb_Message* msg, - const upb_MiniTableField* field, - double value) { +UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, + const upb_MiniTableField* field, + double value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Double); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } UPB_API_INLINE upb_StringView -upb_MiniTable_GetString(const upb_Message* msg, const upb_MiniTableField* field, - upb_StringView def_val) { +upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, + upb_StringView def_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Bytes || field->descriptortype == kUpb_FieldType_String); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); upb_StringView ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &def_val, &ret); + _upb_Message_GetField(msg, field, &def_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetString(upb_Message* msg, - const upb_MiniTableField* field, - upb_StringView value) { +UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, + const upb_MiniTableField* field, + upb_StringView value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Bytes || field->descriptortype == kUpb_FieldType_String); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } UPB_API_INLINE const upb_Message* upb_MiniTable_GetMessage( @@ -2731,7 +2738,7 @@ UPB_API_INLINE const upb_Message* upb_MiniTable_GetMessage( UPB_ASSUME(_upb_MiniTableField_GetRep(field) == UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); upb_Message* ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); return ret; } @@ -2745,7 +2752,7 @@ UPB_API_INLINE void upb_MiniTable_SetMessage(upb_Message* msg, UPB_ASSUME(_upb_MiniTableField_GetRep(field) == UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); UPB_ASSERT(mini_table->subs[field->submsg_index].submsg); - _upb_MiniTable_SetNonExtensionField(msg, field, &sub_message); + _upb_Message_SetNonExtensionField(msg, field, &sub_message); } UPB_API_INLINE upb_Message* upb_MiniTable_GetMutableMessage( @@ -2760,7 +2767,7 @@ UPB_API_INLINE upb_Message* upb_MiniTable_GetMutableMessage( 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_MiniTable_SetPresence(msg, field); + _upb_Message_SetPresence(msg, field); } return sub_message; } @@ -2769,7 +2776,7 @@ UPB_API_INLINE const upb_Array* upb_MiniTable_GetArray( const upb_Message* msg, const upb_MiniTableField* field) { const upb_Array* ret; const upb_Array* default_val = NULL; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); return ret; } @@ -2781,6 +2788,12 @@ UPB_API_INLINE upb_Array* upb_MiniTable_GetMutableArray( void* upb_MiniTable_ResizeArray(upb_Message* msg, const upb_MiniTableField* field, size_t len, upb_Arena* arena); + +UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( + const upb_MiniTableField* field) { + return field->descriptortype == kUpb_FieldType_Enum; +} + typedef enum { kUpb_GetExtension_Ok, kUpb_GetExtension_NotPresent, @@ -2921,10 +2934,10 @@ typedef enum { kUpb_DecodeStatus_MissingRequired = 5, } upb_DecodeStatus; -upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, - const upb_MiniTable* l, - const upb_ExtensionRegistry* extreg, int options, - upb_Arena* arena); +UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, + upb_Message* msg, const upb_MiniTable* l, + const upb_ExtensionRegistry* extreg, + int options, upb_Arena* arena); #ifdef __cplusplus } /* extern "C" */ @@ -3284,7 +3297,7 @@ UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_pro } UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, 0, len); @@ -3345,37 +3358,37 @@ UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(4, 40), len); @@ -3387,7 +3400,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_ } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(8, 48), len); @@ -3399,7 +3412,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const googl } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(12, 56), len); @@ -3411,7 +3424,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 64), len); @@ -3423,7 +3436,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_pro } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 72), len); @@ -3435,37 +3448,37 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_FileOptions* default_val = NULL; const google_protobuf_FileOptions* ret; const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_SourceCodeInfo* default_val = NULL; const google_protobuf_SourceCodeInfo* ret; const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(32, 96), len); @@ -3477,7 +3490,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(36, 104), len); @@ -3489,41 +3502,41 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const go } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* len) { return (upb_StringView*)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 40), len); } @@ -3583,7 +3596,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); if (sub == NULL) { @@ -3594,7 +3607,7 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_ } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); if (sub == NULL) { @@ -3623,10 +3636,10 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.DescriptorProto */ @@ -3665,22 +3678,22 @@ UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_proto } UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(4, 24), len); @@ -3692,7 +3705,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_ } UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(8, 32), len); @@ -3704,7 +3717,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_pro } UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(12, 40), len); @@ -3716,7 +3729,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_proto } UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(16, 48), len); @@ -3728,7 +3741,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google } UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 56), len); @@ -3740,22 +3753,22 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_proto } UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) { const google_protobuf_MessageOptions* default_val = NULL; const google_protobuf_MessageOptions* ret; const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(28, 72), len); @@ -3767,7 +3780,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_prot } UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(32, 80), len); @@ -3779,7 +3792,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_ } UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(36, 88), len); @@ -3792,7 +3805,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_p UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* len) { return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 24), len); } @@ -3855,7 +3868,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_Descript } UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); if (sub == NULL) { @@ -3935,59 +3948,59 @@ UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(con } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const google_protobuf_ExtensionRangeOptions* default_val = NULL; const google_protobuf_ExtensionRangeOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena) { struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); if (sub == NULL) { @@ -4034,41 +4047,41 @@ UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(cons } UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.ExtensionRangeOptions */ @@ -4107,7 +4120,7 @@ UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google } UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) { const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 0, len); @@ -4168,194 +4181,194 @@ UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_ } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = 1; int32_t ret; const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = 1; int32_t ret; const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { const google_protobuf_FieldOptions* default_val = NULL; const google_protobuf_FieldOptions* ret; const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); if (sub == NULL) { @@ -4366,13 +4379,13 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_Fi } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.OneofDescriptorProto */ @@ -4411,41 +4424,41 @@ UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_ } UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) { const google_protobuf_OneofOptions* default_val = NULL; const google_protobuf_OneofOptions* ret; const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); if (sub == NULL) { @@ -4492,22 +4505,22 @@ UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_p } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(4, 24), len); @@ -4519,22 +4532,22 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_proto } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) { const google_protobuf_EnumOptions* default_val = NULL; const google_protobuf_EnumOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(12, 40), len); @@ -4546,7 +4559,7 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const goo } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(16, 48), len); @@ -4559,7 +4572,7 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const goog UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 24), len); } @@ -4574,7 +4587,7 @@ UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_Enum } UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); if (sub == NULL) { @@ -4642,41 +4655,41 @@ UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize } UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.EnumValueDescriptorProto */ @@ -4715,59 +4728,59 @@ UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const goo } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) { const google_protobuf_EnumValueOptions* default_val = NULL; const google_protobuf_EnumValueOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); if (sub == NULL) { @@ -4814,22 +4827,22 @@ UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const googl } UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(4, 24), len); @@ -4841,23 +4854,23 @@ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_p } UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) { const google_protobuf_ServiceOptions* default_val = NULL; const google_protobuf_ServiceOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* len) { return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 24), len); } @@ -4872,7 +4885,7 @@ UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_Service } UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); if (sub == NULL) { @@ -4919,107 +4932,107 @@ UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) { const google_protobuf_MethodOptions* default_val = NULL; const google_protobuf_MethodOptions* ret; const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); if (sub == NULL) { @@ -5030,10 +5043,10 @@ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_M } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.FileOptions */ @@ -5072,307 +5085,307 @@ UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_ } UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { int32_t default_val = 1; int32_t ret; const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { bool default_val = true; bool ret; const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(20, 184), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 184), len); @@ -5385,64 +5398,64 @@ UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const googl UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 184), len); } @@ -5493,67 +5506,67 @@ UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protob } UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 8, len); @@ -5566,16 +5579,16 @@ UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const go UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, 8, len); } @@ -5626,112 +5639,112 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf } UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + 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)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 24), len); @@ -5744,25 +5757,25 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const goog UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len); } @@ -5813,7 +5826,7 @@ UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf } UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) { const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 0, len); @@ -5874,37 +5887,37 @@ UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_ } UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -5917,10 +5930,10 @@ UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const googl UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) { const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } @@ -5971,22 +5984,22 @@ UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_prot } UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -5999,7 +6012,7 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } @@ -6050,22 +6063,22 @@ UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protob } UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6078,7 +6091,7 @@ UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const go UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } @@ -6129,37 +6142,37 @@ UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobu } UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {999, 8, 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 8, len); @@ -6172,10 +6185,10 @@ UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const goo UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) { const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, 8, len); } @@ -6226,7 +6239,7 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_p } UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6238,93 +6251,93 @@ UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protob } UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { uint64_t default_val = (uint64_t)0ull; uint64_t ret; const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { int64_t default_val = (int64_t)0ll; int64_t ret; const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { double default_val = 0; double ret; const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* len) { @@ -6341,22 +6354,22 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.UninterpretedOption.NamePart */ @@ -6395,41 +6408,41 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.SourceCodeInfo */ @@ -6468,7 +6481,7 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protob } UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, 0, len); @@ -6529,7 +6542,7 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const goog } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6541,7 +6554,7 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_pr } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); @@ -6553,37 +6566,37 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_pr } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(12, 56), len); @@ -6614,10 +6627,10 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (upb_StringView*)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 56), len); } @@ -6665,7 +6678,7 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_pro } UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, 0, len); @@ -6726,7 +6739,7 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(4, 16), len); @@ -6738,63 +6751,63 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const goog } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* len) { @@ -6808,16 +6821,16 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; @@ -7887,32 +7900,6 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, int maxdepth); -// DEPRECATED FUNCTIONS -// PHP and Ruby need these until we can version-bump them to the current upb. - -UPB_INLINE void upb_Message_Clear(upb_Message* msg, const upb_MessageDef* m) { - return upb_Message_ClearByDef(msg, m); -} - -UPB_INLINE void upb_Message_ClearField(upb_Message* msg, - const upb_FieldDef* f) { - return upb_Message_ClearFieldByDef(msg, f); -} - -UPB_INLINE bool upb_Message_Has(const upb_Message* msg, const upb_FieldDef* f) { - return upb_Message_HasFieldByDef(msg, f); -} - -UPB_INLINE upb_MessageValue upb_Message_Get(const upb_Message* msg, - const upb_FieldDef* f) { - return upb_Message_GetFieldByDef(msg, f); -} - -UPB_INLINE bool upb_Message_Set(upb_Message* msg, const upb_FieldDef* f, - upb_MessageValue val, upb_Arena* a) { - return upb_Message_SetFieldByDef(msg, f, val, a); -} - #ifdef __cplusplus } /* extern "C" */ #endif @@ -8899,6 +8886,263 @@ enum { #ifndef UPB_WIRE_DECODE_INTERNAL_H_ #define UPB_WIRE_DECODE_INTERNAL_H_ + +#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ +#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ + +#include + +// Must be last. + +// The maximum number of bytes a single protobuf field can take up in the +// wire format. We only want to do one bounds check per field, so the input +// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, +// the decoder can read this many bytes without performing another bounds +// check. The stream will copy into a patch buffer as necessary to guarantee +// this invariant. +#define kUpb_EpsCopyInputStream_SlopBytes 16 + +typedef struct { + const char* end; // Can read up to SlopBytes bytes beyond this. + const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) + int limit; // Submessage limit relative to end + char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; +} upb_EpsCopyInputStream; + +typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( + upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); + +typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( + upb_EpsCopyInputStream* e, const char* ptr, int overrun); + +// Initializes a upb_EpsCopyInputStream using the contents of the buffer +// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least +// kUpb_EpsCopyInputStream_SlopBytes, and returns true if the pointer has been +// updated. +UPB_INLINE bool upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, + const char** ptr, size_t size) { + bool ret; + if (size <= kUpb_EpsCopyInputStream_SlopBytes) { + memset(&e->patch, 0, 32); + if (size) memcpy(&e->patch, *ptr, size); + *ptr = e->patch; + e->end = *ptr + size; + e->limit = 0; + ret = true; + } else { + e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; + e->limit = kUpb_EpsCopyInputStream_SlopBytes; + ret = false; + } + e->limit_ptr = e->end; + return ret; +} + +typedef enum { + // The current stream position is at a limit. + kUpb_IsDoneStatus_Done, + + // The current stream position is not at a limit. + kUpb_IsDoneStatus_NotDone, + + // The current stream position is not at a limit, and the stream needs to + // be flipped to a new buffer before more data can be read. + kUpb_IsDoneStatus_NeedFallback, +} upb_IsDoneStatus; + +// Returns the status of the current stream position. This is a low-level +// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. +UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( + upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { + *overrun = ptr - e->end; + if (UPB_LIKELY(ptr < e->limit_ptr)) { + return kUpb_IsDoneStatus_NotDone; + } else if (UPB_LIKELY(*overrun == e->limit)) { + return kUpb_IsDoneStatus_Done; + } else { + return kUpb_IsDoneStatus_NeedFallback; + } +} + +// Returns true if the stream has hit a limit, either the current delimited +// limit or the overall end-of-stream. As a side effect, this function may flip +// the pointer to a new buffer if there are less than +// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. +// +// Postcondition: if the function returns false, there are at least +// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. +UPB_INLINE bool upb_EpsCopyInputStream_IsDone( + upb_EpsCopyInputStream* e, const char** ptr, + upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { + int overrun; + switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { + case kUpb_IsDoneStatus_Done: + return true; + case kUpb_IsDoneStatus_NotDone: + return false; + case kUpb_IsDoneStatus_NeedFallback: + *ptr = func(e, *ptr, overrun); + return *ptr == NULL; + } +} + +// Returns the total number of bytes that are safe to read from the current +// buffer without reading uninitialized or unallocated memory. +// +// Note that this check does not respect any semantic limits on the stream, +// either limits from PushLimit() or the overall stream end, so some of these +// bytes may have unpredictable, nonsense values in them. The guarantee is only +// that the bytes are valid to read from the perspective of the C language +// (ie. you can read without triggering UBSAN or ASAN). +UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( + upb_EpsCopyInputStream* e, const char* ptr) { + return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; +} + +// Returns true if the given delimited field size is valid (it does not extend +// beyond any previously-pushed limits). `ptr` should point to the beginning +// of the field data, after the delimited size. +// +// Note that this does *not* guarantee that all of the data for this field is in +// the current buffer. +UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( + const upb_EpsCopyInputStream* e, const char* ptr, int size) { + UPB_ASSERT(size >= 0); + return ptr - e->end + size <= e->limit; +} + +UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( + upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { + // This is one extra branch compared to the more normal: + // return (size_t)(end - ptr) < size; + // However it is one less computation if we are just about to use "ptr + len": + // https://godbolt.org/z/35YGPz + // In microbenchmarks this shows a small improvement. + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)e->limit_ptr; + uintptr_t res = uptr + (size_t)size; + if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; + // NOTE: this check depends on having a linear address space. This is not + // technically guaranteed by uintptr_t. + bool ret = res >= uptr && res <= uend; + if (size < 0) UPB_ASSERT(!ret); + return ret; +} + +// Returns true if the given delimited field size is valid (it does not extend +// beyond any previously-pushed limited) *and* all of the data for this field is +// available to be read in the current buffer. +// +// If the size is negative, this function will always return false. This +// property can be useful in some cases. +UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( + upb_EpsCopyInputStream* e, const char* ptr, int size) { + return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); +} + +// Returns true if the given sub-message size is valid (it does not extend +// beyond any previously-pushed limited) *and* all of the data for this +// sub-message is available to be parsed in the current buffer. +// +// This implies that all fields from the sub-message can be parsed from the +// current buffer while maintaining the invariant that we always have at least +// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of +// any individual field start. +// +// If the size is negative, this function will always return false. This +// property can be useful in some cases. +UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( + upb_EpsCopyInputStream* e, const char* ptr, int size) { + return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); +} + +UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { + UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); +} + +// Pushes a limit onto the stack of limits for the current stream. The limit +// will extend for `size` bytes beyond the position in `ptr`. Future calls to +// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position +// reaches this limit. +// +// Returns a delta that the caller must store and supply to PopLimit() below. +UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, + const char* ptr, int size) { + int limit = size + (int)(ptr - e->end); + int delta = e->limit - limit; + _upb_EpsCopyInputStream_CheckLimit(e); + e->limit = limit; + e->limit_ptr = e->end + UPB_MIN(0, limit); + _upb_EpsCopyInputStream_CheckLimit(e); + return delta; +} + +// Pops the last limit that was pushed on this stream. This may only be called +// once IsDone() returns true. The user must pass the delta that was returned +// from PushLimit(). +UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, + const char* ptr, + int saved_delta) { + UPB_ASSERT(ptr - e->end == e->limit); + _upb_EpsCopyInputStream_CheckLimit(e); + e->limit += saved_delta; + e->limit_ptr = e->end + UPB_MIN(0, e->limit); + _upb_EpsCopyInputStream_CheckLimit(e); +} + +UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( + upb_EpsCopyInputStream* e, const char* ptr, int overrun, + upb_EpsCopyInputStream_BufferFlipCallback* callback) { + if (overrun < e->limit) { + // Need to copy remaining data into patch buffer. + UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); + const char* old_end = ptr; + const char* new_start = &e->patch[0] + overrun; + memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, + kUpb_EpsCopyInputStream_SlopBytes); + memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); + ptr = new_start; + e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; + e->limit -= kUpb_EpsCopyInputStream_SlopBytes; + e->limit_ptr = e->end + e->limit; + UPB_ASSERT(ptr < e->limit_ptr); + return callback(e, old_end, new_start); + } else { + return callback(e, NULL, NULL); + } +} + +typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( + upb_EpsCopyInputStream* e, const char* ptr, void* ctx); + +// Tries to perform a fast-path handling of the given delimited message data. +// If the sub-message beginning at `*ptr` and extending for `len` is short and +// fits within this buffer, calls `func` with `ctx` as a parameter, where the +// pushing and popping of limits is handled automatically and with lower cost +// than the normal PushLimit()/PopLimit() sequence. +static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( + upb_EpsCopyInputStream* e, const char** ptr, int len, + upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { + if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { + return false; + } + + // Fast case: Sub-message is <128 bytes and fits in the current buffer. + // This means we can preserve limit/limit_ptr verbatim. + const char* saved_limit_ptr = e->limit_ptr; + int saved_limit = e->limit; + e->limit_ptr = *ptr + len; + e->limit = e->limit_ptr - e->end; + UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); + *ptr = func(e, *ptr, ctx); + e->limit_ptr = saved_limit_ptr; + e->limit = saved_limit; + UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); + return true; +} + + +#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ #include "utf8_range.h" // Must be last. @@ -8906,18 +9150,14 @@ enum { #define DECODE_NOGROUP (uint32_t) - 1 typedef struct upb_Decoder { - const char* end; /* Can read up to 16 bytes slop beyond this. */ - const char* limit_ptr; /* = end + UPB_MIN(limit, 0) */ - upb_Message* unknown_msg; /* Used for preserving unknown data. */ - const char* unknown; /* Start of unknown data, preserve at buffer flip. */ - const upb_ExtensionRegistry* - extreg; /* For looking up extensions during the parse. */ - int limit; /* Submessage limit relative to end. */ - int depth; /* Tracks recursion depth to bound stack usage. */ - uint32_t end_group; /* field number of END_GROUP tag, else DECODE_NOGROUP */ + upb_EpsCopyInputStream input; + const upb_ExtensionRegistry* extreg; + const char* unknown; // Start of unknown data, preserve at buffer flip + upb_Message* unknown_msg; // Pointer to preserve data to + int depth; // Tracks recursion depth to bound stack usage. + uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP. uint16_t options; bool missing_required; - char patch[32]; upb_Arena arena; jmp_buf err; @@ -8976,49 +9216,29 @@ UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { return (const upb_MiniTable*)(table >> 8); } -UPB_INLINE -const char* _upb_Decoder_IsDoneFallbackInline(upb_Decoder* d, const char* ptr, - int overrun, int* status) { - if (overrun < d->limit) { - /* Need to copy remaining data into patch buffer. */ - UPB_ASSERT(overrun < 16); - if (d->unknown) { - if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, ptr - d->unknown, - &d->arena)) { - *status = kUpb_DecodeStatus_OutOfMemory; - return NULL; - } - d->unknown = &d->patch[0] + overrun; - } - memset(d->patch + 16, 0, 16); - memcpy(d->patch, d->end, 16); - ptr = &d->patch[0] + overrun; - d->end = &d->patch[16]; - d->limit -= 16; - d->limit_ptr = d->end + d->limit; - d->options &= ~kUpb_DecodeOption_AliasString; - UPB_ASSERT(ptr < d->limit_ptr); - return ptr; - } else { - *status = kUpb_DecodeStatus_Malformed; - return NULL; - } +const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, + const char* ptr, int overrun); + +UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { + return upb_EpsCopyInputStream_IsDone(&d->input, ptr, + &_upb_Decoder_IsDoneFallback); } -const char* _upb_Decoder_IsDoneFallback(upb_Decoder* d, const char* ptr, - int overrun); +UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( + upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { + upb_Decoder* d = (upb_Decoder*)e; + if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); -UPB_INLINE -bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { - int overrun = *ptr - d->end; - if (UPB_LIKELY(*ptr < d->limit_ptr)) { - return false; - } else if (UPB_LIKELY(overrun == d->limit)) { - return true; - } else { - *ptr = _upb_Decoder_IsDoneFallback(d, *ptr, overrun); - return false; + if (d->unknown) { + if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, + old_end - d->unknown, &d->arena)) { + _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); + } + d->unknown = new_start; } + + d->options &= ~kUpb_DecodeOption_AliasString; + return new_start; } #if UPB_FASTTABLE @@ -9044,30 +9264,6 @@ UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { return tag; } -UPB_INLINE void _upb_Decoder_CheckLimit(upb_Decoder* d) { - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); -} - -UPB_INLINE int _upb_Decoder_PushLimit(upb_Decoder* d, const char* ptr, - int size) { - int limit = size + (int)(ptr - d->end); - int delta = d->limit - limit; - _upb_Decoder_CheckLimit(d); - d->limit = limit; - d->limit_ptr = d->end + UPB_MIN(0, limit); - _upb_Decoder_CheckLimit(d); - return delta; -} - -UPB_INLINE void _upb_Decoder_PopLimit(upb_Decoder* d, const char* ptr, - int saved_delta) { - UPB_ASSERT(ptr - d->end == d->limit); - _upb_Decoder_CheckLimit(d); - d->limit += saved_delta; - d->limit_ptr = d->end + UPB_MIN(0, d->limit); - _upb_Decoder_CheckLimit(d); -} - #endif /* UPB_WIRE_DECODE_INTERNAL_H_ */ diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index bb3c2d13d427..66da27b3ad29 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -135,6 +135,6 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "b747edb830b0fab524e0063fb2e156c390405dfa", - sha256 = "99f69a3b8a583961e9db8d16d3a654f4bac5f546077e07dfa26c561de5215005", + commit = "ea1996f40d258c469ddef691de85b7c780db1999", + sha256 = "1c06a558012fef70b916e755e606e0143d9a02ee33aaf1ed784a093e726b0341", ) diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 62a5ab0e254b..69e63f4cc37e 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -147,6 +147,12 @@ #if defined(__GNUC__) || defined(__clang__) #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#elif defined(_MSC_VER) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __assume(0); \ + } while (0) #else #define UPB_UNREACHABLE() do { assert(0); } while(0) #endif @@ -5174,6 +5180,11 @@ upb_UnknownToMessage_Status upb_MiniTable_PromoteUnknownToMessageArray( if (ret.status == kUpb_UnknownToMessage_Ok) { upb_MessageValue value; value.msg_val = ret.message; + // Allocate array on demand before append. + if (!repeated_messages) { + upb_MiniTable_ResizeArray(msg, field, 0, arena); + repeated_messages = upb_MiniTable_GetMutableArray(msg, field); + } if (!upb_Array_Append(repeated_messages, value, arena)) { return kUpb_UnknownToMessage_OutOfMemory; } @@ -5316,20 +5327,6 @@ const upb_Message_Extension* _upb_Message_Getext( return NULL; } -void _upb_Message_Clearext(upb_Message* msg, - const upb_MiniTableExtension* ext_l) { - upb_Message_Internal* in = upb_Message_Getinternal(msg); - if (!in->internal) return; - const upb_Message_Extension* base = - UPB_PTR_AT(in->internal, in->internal->ext_begin, void); - upb_Message_Extension* ext = - (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); - if (ext) { - *ext = *base; - in->internal->ext_begin += sizeof(upb_Message_Extension); - } -} - upb_Message_Extension* _upb_Message_GetOrCreateExtension( upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* arena) { upb_Message_Extension* ext = @@ -6057,6 +6054,21 @@ static void upb_MtDecoder_ParseMap(upb_MtDecoder* d, const char* data, } upb_MtDecoder_ParseMessage(d, data, len); + if (UPB_UNLIKELY(d->table->field_count != 2)) { + upb_MtDecoder_ErrorFormat(d, "%hu fields in map", d->table->field_count); + UPB_UNREACHABLE(); + } + if (UPB_UNLIKELY(d->table->fields[0].number != 1)) { + upb_MtDecoder_ErrorFormat(d, "field %d in map key", + d->table->fields[0].number); + UPB_UNREACHABLE(); + } + if (UPB_UNLIKELY(d->table->fields[1].number != 2)) { + upb_MtDecoder_ErrorFormat(d, "field %d in map val", + d->table->fields[1].number); + UPB_UNREACHABLE(); + } + upb_MtDecoder_AssignHasbits(d->table); // Map entries have a pre-determined layout, regardless of types. @@ -7745,7 +7757,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]); const int32_t end = google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]); - const int32_t max = kUpb_MaxFieldNumber + 1; // A full validation would also check that each range is disjoint, and that // none of the fields overlap with the extension ranges, but we are just @@ -7753,7 +7764,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New( // Note: Not a typo! Unlike extension ranges and message reserved ranges, // the end value of an enum reserved range is *inclusive*! - if (start < 1 || end < start || end > max) { + if (end < start) { _upb_DefBuilder_Errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n", (int)start, (int)end, upb_EnumDef_FullName(e)); } @@ -9148,7 +9159,7 @@ void _upb_FileDef_Create(upb_DefBuilder* ctx, bool upb_Message_HasFieldByDef(const upb_Message* msg, const upb_FieldDef* f) { UPB_ASSERT(upb_FieldDef_HasPresence(f)); - return _upb_MiniTable_HasField(msg, upb_FieldDef_MiniTable(f)); + return upb_Message_HasField(msg, upb_FieldDef_MiniTable(f)); } const upb_FieldDef* upb_Message_WhichOneof(const upb_Message* msg, @@ -9170,7 +9181,7 @@ upb_MessageValue upb_Message_GetFieldByDef(const upb_Message* msg, const upb_FieldDef* f) { upb_MessageValue default_val = upb_FieldDef_Default(f); upb_MessageValue ret; - _upb_MiniTable_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret); + _upb_Message_GetField(msg, upb_FieldDef_MiniTable(f), &default_val, &ret); return ret; } @@ -9215,11 +9226,11 @@ upb_MutableMessageValue upb_Message_Mutable(upb_Message* msg, bool upb_Message_SetFieldByDef(upb_Message* msg, const upb_FieldDef* f, upb_MessageValue val, upb_Arena* a) { - return _upb_MiniTable_SetField(msg, upb_FieldDef_MiniTable(f), &val, a); + return _upb_Message_SetField(msg, upb_FieldDef_MiniTable(f), &val, a); } void upb_Message_ClearFieldByDef(upb_Message* msg, const upb_FieldDef* f) { - _upb_MiniTable_ClearField(msg, upb_FieldDef_MiniTable(f)); + upb_Message_ClearField(msg, upb_FieldDef_MiniTable(f)); } void upb_Message_ClearByDef(upb_Message* msg, const upb_MessageDef* m) { @@ -10454,6 +10465,7 @@ const char* _upb_FastDecoder_ErrorJmp(upb_Decoder* d, int status) { UPB_LONGJMP(d->err, status); return NULL; } + static void _upb_Decoder_VerifyUtf8(upb_Decoder* d, const char* buf, int len) { if (!_upb_Decoder_VerifyUtf8Inline(buf, len)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); @@ -10529,7 +10541,8 @@ static const char* upb_Decoder_DecodeSize(upb_Decoder* d, const char* ptr, uint32_t* size) { uint64_t size64; ptr = _upb_Decoder_DecodeVarint(d, ptr, &size64); - if (size64 >= INT32_MAX || ptr - d->end + (int)size64 > d->limit) { + if (size64 >= INT32_MAX || + !upb_EpsCopyInputStream_CheckSize(&d->input, ptr, (int)size64)) { _upb_Decoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); } *size = size64; @@ -10576,15 +10589,6 @@ static upb_Message* _upb_Decoder_NewSubMessage( return msg; } -UPB_NOINLINE -const char* _upb_Decoder_IsDoneFallback(upb_Decoder* d, const char* ptr, - int overrun) { - int status; - ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status); - if (ptr == NULL) _upb_Decoder_ErrorJmp(d, status); - return ptr; -} - static const char* _upb_Decoder_ReadString(upb_Decoder* d, const char* ptr, int size, upb_StringView* str) { if (d->options & kUpb_DecodeOption_AliasString) { @@ -10620,11 +10624,11 @@ UPB_FORCEINLINE static const char* _upb_Decoder_DecodeSubMessage( upb_Decoder* d, const char* ptr, upb_Message* submsg, const upb_MiniTableSub* subs, const upb_MiniTableField* field, int size) { - int saved_delta = _upb_Decoder_PushLimit(d, ptr, size); + int saved_delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, size); const upb_MiniTable* subl = subs[field->submsg_index].submsg; UPB_ASSERT(subl); ptr = _upb_Decoder_RecurseSubMessage(d, ptr, submsg, subl, DECODE_NOGROUP); - _upb_Decoder_PopLimit(d, ptr, saved_delta); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_delta); return ptr; } @@ -10771,7 +10775,7 @@ static const char* _upb_Decoder_DecodeVarintPacked( upb_Decoder* d, const char* ptr, upb_Array* arr, wireval* val, const upb_MiniTableField* field, int lg2) { int scale = 1 << lg2; - int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size); + int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size); char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size << lg2, void); while (!_upb_Decoder_IsDone(d, &ptr)) { wireval elem; @@ -10784,7 +10788,7 @@ static const char* _upb_Decoder_DecodeVarintPacked( memcpy(out, &elem, scale); out += scale; } - _upb_Decoder_PopLimit(d, ptr, saved_limit); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit); return ptr; } @@ -10794,7 +10798,7 @@ static const char* _upb_Decoder_DecodeEnumPacked( const upb_MiniTableSub* subs, const upb_MiniTableField* field, wireval* val) { const upb_MiniTableEnum* e = subs[field->submsg_index].subenum; - int saved_limit = _upb_Decoder_PushLimit(d, ptr, val->size); + int saved_limit = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, val->size); char* out = UPB_PTR_AT(_upb_array_ptr(arr), arr->size * 4, void); while (!_upb_Decoder_IsDone(d, &ptr)) { wireval elem; @@ -10810,7 +10814,7 @@ static const char* _upb_Decoder_DecodeEnumPacked( memcpy(out, &elem, 4); out += 4; } - _upb_Decoder_PopLimit(d, ptr, saved_limit); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, saved_limit); return ptr; } @@ -11558,7 +11562,7 @@ static const char* _upb_Decoder_DecodeMessage(upb_Decoder* d, const char* ptr, d->debug_tagstart = ptr; #endif - UPB_ASSERT(ptr < d->limit_ptr); + UPB_ASSERT(ptr < d->input.limit_ptr); ptr = _upb_Decoder_DecodeTag(d, ptr, &tag); field_number = tag >> 3; wire_type = tag & 7; @@ -11616,6 +11620,13 @@ static upb_DecodeStatus _upb_Decoder_DecodeTop(struct upb_Decoder* d, return kUpb_DecodeStatus_Ok; } +UPB_NOINLINE +const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, + const char* ptr, int overrun) { + return _upb_EpsCopyInputStream_IsDoneFallbackInline( + e, ptr, overrun, _upb_Decoder_BufferFlipCallback); +} + upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg, const upb_MiniTable* l, const upb_ExtensionRegistry* extreg, int options, @@ -11623,20 +11634,11 @@ upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg, upb_Decoder state; unsigned depth = (unsigned)options >> 16; - if (size <= 16) { - memset(&state.patch, 0, 32); - if (size) memcpy(&state.patch, buf, size); - buf = state.patch; - state.end = buf + size; - state.limit = 0; + if (upb_EpsCopyInputStream_Init(&state.input, &buf, size)) { options &= ~kUpb_DecodeOption_AliasString; // Can't alias patch buf. - } else { - state.end = buf + size - 16; - state.limit = 16; } state.extreg = extreg; - state.limit_ptr = state.end; state.unknown = NULL; state.depth = depth ? depth : 64; state.end_group = DECODE_NOGROUP; @@ -11701,28 +11703,27 @@ typedef enum { UPB_NOINLINE static const char* fastdecode_isdonefallback(UPB_PARSE_PARAMS) { int overrun = data; - int status; - ptr = _upb_Decoder_IsDoneFallbackInline(d, ptr, overrun, &status); - if (ptr == NULL) _upb_FastDecoder_ErrorJmp(d, status); + ptr = _upb_EpsCopyInputStream_IsDoneFallbackInline( + &d->input, ptr, overrun, _upb_Decoder_BufferFlipCallback); data = _upb_FastDecoder_LoadTag(ptr); UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); } UPB_FORCEINLINE static const char* fastdecode_dispatch(UPB_PARSE_PARAMS) { - if (UPB_UNLIKELY(ptr >= d->limit_ptr)) { - int overrun = ptr - d->end; - if (UPB_LIKELY(overrun == d->limit)) { - // Parse is finished. + int overrun; + switch (upb_EpsCopyInputStream_IsDoneStatus(&d->input, ptr, &overrun)) { + case kUpb_IsDoneStatus_Done: *(uint32_t*)msg |= hasbits; // Sync hasbits. const upb_MiniTable* l = decode_totablep(table); return UPB_UNLIKELY(l->required_count) ? _upb_Decoder_CheckRequired(d, ptr, msg, l) : ptr; - } else { + case kUpb_IsDoneStatus_NotDone: + break; + case kUpb_IsDoneStatus_NeedFallback: data = overrun; UPB_MUSTTAIL return fastdecode_isdonefallback(UPB_PARSE_ARGS); - } } // Read two bytes of tag data (for a one-byte tag, the high byte is junk). @@ -11760,37 +11761,17 @@ static const char* fastdecode_longsize(const char* ptr, int* size) { } UPB_FORCEINLINE -static bool fastdecode_boundscheck(const char* ptr, size_t len, - const char* end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end + 16; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - -UPB_FORCEINLINE -static bool fastdecode_boundscheck2(const char* ptr, size_t len, - const char* end) { - // This is one extra branch compared to the more normal: - // return (size_t)(end - ptr) < size; - // However it is one less computation if we are just about to use "ptr + len": - // https://godbolt.org/z/35YGPz - // In microbenchmarks this shows an overall 4% improvement. - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - -typedef const char* fastdecode_delimfunc(upb_Decoder* d, const char* ptr, - void* ctx); - -UPB_FORCEINLINE -static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr, - fastdecode_delimfunc* func, void* ctx) { +static const char* fastdecode_delimited( + upb_Decoder* d, const char* ptr, + upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { ptr++; + + // Sign-extend so varint greater than one byte becomes negative, causing + // fast delimited parse to fail. int len = (int8_t)ptr[-1]; - if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) { + + if (!upb_EpsCopyInputStream_TryParseDelimitedFast(&d->input, &ptr, len, func, + ctx)) { // Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer. // If it exceeds the buffer limit, limit/limit_ptr will change during // sub-message parsing, so we need to preserve delta, not limit. @@ -11802,25 +11783,13 @@ static const char* fastdecode_delimited(upb_Decoder* d, const char* ptr, return NULL; } } - if (ptr - d->end + (int)len > d->limit) { + if (!upb_EpsCopyInputStream_CheckSize(&d->input, ptr, len)) { // Corrupt wire format: invalid limit. return NULL; } - int delta = _upb_Decoder_PushLimit(d, ptr, len); - ptr = func(d, ptr, ctx); - _upb_Decoder_PopLimit(d, ptr, delta); - } else { - // Fast case: Sub-message is <128 bytes and fits in the current buffer. - // This means we can preserve limit/limit_ptr verbatim. - const char* saved_limit_ptr = d->limit_ptr; - int saved_limit = d->limit; - d->limit_ptr = ptr + len; - d->limit = d->limit_ptr - d->end; - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); - ptr = func(d, ptr, ctx); - d->limit_ptr = saved_limit_ptr; - d->limit = saved_limit; - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + int delta = upb_EpsCopyInputStream_PushLimit(&d->input, ptr, len); + ptr = func(&d->input, ptr, ctx); + upb_EpsCopyInputStream_PopLimit(&d->input, ptr, delta); } return ptr; } @@ -12061,8 +12030,9 @@ typedef struct { } fastdecode_varintdata; UPB_FORCEINLINE -static const char* fastdecode_topackedvarint(upb_Decoder* d, const char* ptr, - void* ctx) { +static const char* fastdecode_topackedvarint(upb_EpsCopyInputStream* e, + const char* ptr, void* ctx) { + upb_Decoder* d = (upb_Decoder*)e; fastdecode_varintdata* data = ctx; void* dst = data->dst; uint64_t val; @@ -12210,7 +12180,8 @@ TAGBYTES(p) ptr = fastdecode_longsize(ptr, &size); \ } \ \ - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr) || \ + if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \ + &d->input, ptr, size) || \ (size % valbytes) != 0)) { \ _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \ } \ @@ -12302,7 +12273,8 @@ static const char* fastdecode_verifyutf8(upb_Decoder* d, const char* ptr, ptr = fastdecode_longsize(ptr, &size); \ } \ \ - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr))) { \ + if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \ + &d->input, ptr, size))) { \ dst->size = 0; \ _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); \ } \ @@ -12355,91 +12327,92 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, UPB_POISON_MEMORY_REGION(data + size, copy - size); } -#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \ - card, validate_utf8) \ - upb_StringView* dst; \ - fastdecode_arr farr; \ - int64_t size; \ - size_t arena_has; \ - size_t common_has; \ - char* buf; \ - \ - UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \ - UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \ - \ - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \ - sizeof(upb_StringView), card); \ - \ - again: \ - if (card == CARD_r) { \ - dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \ - } \ - \ - size = (uint8_t)ptr[tagbytes]; \ - ptr += tagbytes + 1; \ - dst->size = size; \ - \ - buf = d->arena.head.ptr; \ - arena_has = _upb_ArenaHas(&d->arena); \ - common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); \ - \ - if (UPB_LIKELY(size <= 15 - tagbytes)) { \ - if (arena_has < 16) goto longstr; \ - d->arena.head.ptr += 16; \ - memcpy(buf, ptr - tagbytes - 1, 16); \ - dst->data = buf + tagbytes + 1; \ - } else if (UPB_LIKELY(size <= 32)) { \ - if (UPB_UNLIKELY(common_has < 32)) goto longstr; \ - fastdecode_docopy(d, ptr, size, 32, buf, dst); \ - } else if (UPB_LIKELY(size <= 64)) { \ - if (UPB_UNLIKELY(common_has < 64)) goto longstr; \ - fastdecode_docopy(d, ptr, size, 64, buf, dst); \ - } else if (UPB_LIKELY(size < 128)) { \ - if (UPB_UNLIKELY(common_has < 128)) goto longstr; \ - fastdecode_docopy(d, ptr, size, 128, buf, dst); \ - } else { \ - goto longstr; \ - } \ - \ - ptr += size; \ - \ - if (card == CARD_r) { \ - if (validate_utf8 && \ - !_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \ - _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \ - } \ - fastdecode_nextret ret = fastdecode_nextrepeated( \ - d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \ - switch (ret.next) { \ - case FD_NEXT_SAMEFIELD: \ - dst = ret.dst; \ - goto again; \ - case FD_NEXT_OTHERFIELD: \ - data = ret.tag; \ - UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \ - case FD_NEXT_ATLIMIT: \ - return ptr; \ - } \ - } \ - \ - if (card != CARD_r && validate_utf8) { \ - data = (uint64_t)dst; \ - UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \ - } \ - \ - UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \ - \ - longstr: \ - if (card == CARD_r) { \ - fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \ - } \ - ptr--; \ - if (validate_utf8) { \ - UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \ - hasbits, (uint64_t)dst); \ - } else { \ - UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \ - hasbits, (uint64_t)dst); \ +#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \ + card, validate_utf8) \ + upb_StringView* dst; \ + fastdecode_arr farr; \ + int64_t size; \ + size_t arena_has; \ + size_t common_has; \ + char* buf; \ + \ + UPB_ASSERT((d->options & kUpb_DecodeOption_AliasString) == 0); \ + UPB_ASSERT(fastdecode_checktag(data, tagbytes)); \ + \ + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, \ + sizeof(upb_StringView), card); \ + \ + again: \ + if (card == CARD_r) { \ + dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_StringView)); \ + } \ + \ + size = (uint8_t)ptr[tagbytes]; \ + ptr += tagbytes + 1; \ + dst->size = size; \ + \ + buf = d->arena.head.ptr; \ + arena_has = _upb_ArenaHas(&d->arena); \ + common_has = UPB_MIN(arena_has, \ + upb_EpsCopyInputStream_BytesAvailable(&d->input, ptr)); \ + \ + if (UPB_LIKELY(size <= 15 - tagbytes)) { \ + if (arena_has < 16) goto longstr; \ + d->arena.head.ptr += 16; \ + memcpy(buf, ptr - tagbytes - 1, 16); \ + dst->data = buf + tagbytes + 1; \ + } else if (UPB_LIKELY(size <= 32)) { \ + if (UPB_UNLIKELY(common_has < 32)) goto longstr; \ + fastdecode_docopy(d, ptr, size, 32, buf, dst); \ + } else if (UPB_LIKELY(size <= 64)) { \ + if (UPB_UNLIKELY(common_has < 64)) goto longstr; \ + fastdecode_docopy(d, ptr, size, 64, buf, dst); \ + } else if (UPB_LIKELY(size < 128)) { \ + if (UPB_UNLIKELY(common_has < 128)) goto longstr; \ + fastdecode_docopy(d, ptr, size, 128, buf, dst); \ + } else { \ + goto longstr; \ + } \ + \ + ptr += size; \ + \ + if (card == CARD_r) { \ + if (validate_utf8 && \ + !_upb_Decoder_VerifyUtf8Inline(dst->data, dst->size)) { \ + _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_BadUtf8); \ + } \ + fastdecode_nextret ret = fastdecode_nextrepeated( \ + d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_StringView)); \ + switch (ret.next) { \ + case FD_NEXT_SAMEFIELD: \ + dst = ret.dst; \ + goto again; \ + case FD_NEXT_OTHERFIELD: \ + data = ret.tag; \ + UPB_MUSTTAIL return _upb_FastDecoder_TagDispatch(UPB_PARSE_ARGS); \ + case FD_NEXT_ATLIMIT: \ + return ptr; \ + } \ + } \ + \ + if (card != CARD_r && validate_utf8) { \ + data = (uint64_t)dst; \ + UPB_MUSTTAIL return fastdecode_verifyutf8(UPB_PARSE_ARGS); \ + } \ + \ + UPB_MUSTTAIL return fastdecode_dispatch(UPB_PARSE_ARGS); \ + \ + longstr: \ + if (card == CARD_r) { \ + fastdecode_commitarr(dst + 1, &farr, sizeof(upb_StringView)); \ + } \ + ptr--; \ + if (validate_utf8) { \ + UPB_MUSTTAIL return fastdecode_longstring_utf8(d, ptr, msg, table, \ + hasbits, (uint64_t)dst); \ + } else { \ + UPB_MUSTTAIL return fastdecode_longstring_noutf8(d, ptr, msg, table, \ + hasbits, (uint64_t)dst); \ } #define FASTDECODE_STRING(d, ptr, msg, table, hasbits, data, tagbytes, card, \ @@ -12469,7 +12442,8 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, dst->data = ptr; \ dst->size = size; \ \ - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { \ + if (UPB_UNLIKELY(!upb_EpsCopyInputStream_CheckDataSizeAvailable( \ + &d->input, ptr, size))) { \ ptr--; \ if (validate_utf8) { \ return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, \ @@ -12582,8 +12556,9 @@ typedef struct { } fastdecode_submsgdata; UPB_FORCEINLINE -static const char* fastdecode_tosubmsg(upb_Decoder* d, const char* ptr, - void* ctx) { +static const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e, + const char* ptr, void* ctx) { + upb_Decoder* d = (upb_Decoder*)e; fastdecode_submsgdata* submsg = ctx; ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->table, 0, 0); UPB_ASSUME(ptr != NULL); diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index ca9b2d517784..a05f7cdd962a 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -148,6 +148,12 @@ #if defined(__GNUC__) || defined(__clang__) #define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0) +#elif defined(_MSC_VER) +#define UPB_UNREACHABLE() \ + do { \ + assert(0); \ + __assume(0); \ + } while (0) #else #define UPB_UNREACHABLE() do { assert(0); } while(0) #endif @@ -1653,7 +1659,8 @@ extern "C" { #endif // Creates a new message with the given mini_table on the given arena. -upb_Message* upb_Message_New(const upb_MiniTable* mini_table, upb_Arena* arena); +UPB_API upb_Message* upb_Message_New(const upb_MiniTable* mini_table, + upb_Arena* arena); // Adds unknown data (serialized protobuf data) to the given message. // The data is copied into the message instance. @@ -1895,8 +1902,6 @@ const upb_Message_Extension* _upb_Message_Getexts(const upb_Message* msg, const upb_Message_Extension* _upb_Message_Getext( const upb_Message* msg, const upb_MiniTableExtension* ext); -void _upb_Message_Clearext(upb_Message* msg, const upb_MiniTableExtension* ext); - #ifdef __cplusplus } /* extern "C" */ #endif @@ -1952,7 +1957,7 @@ typedef struct upb_ExtensionRegistry upb_ExtensionRegistry; // Creates a upb_ExtensionRegistry in the given arena. // The arena must outlive any use of the extreg. -upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); +UPB_API upb_ExtensionRegistry* upb_ExtensionRegistry_New(upb_Arena* arena); // Adds the given extension info for the array |e| of size |count| into the // registry. If there are any errors, the entire array is backed out. @@ -2326,8 +2331,8 @@ UPB_INLINE const void* _upb_MiniTableField_GetConstPtr( return (char*)msg + field->offset; } -UPB_INLINE void _upb_MiniTable_SetPresence(upb_Message* msg, - const upb_MiniTableField* field) { +UPB_INLINE void _upb_Message_SetPresence(upb_Message* msg, + const upb_MiniTableField* field) { if (field->presence > 0) { _upb_sethas_field(msg, field); } else if (_upb_MiniTableField_InOneOf(field)) { @@ -2335,9 +2340,6 @@ UPB_INLINE void _upb_MiniTable_SetPresence(upb_Message* msg, } } -UPB_INLINE bool upb_MiniTable_HasField(const upb_Message* msg, - const upb_MiniTableField* field); - UPB_INLINE bool _upb_MiniTable_ValueIsNonZero(const void* default_val, const upb_MiniTableField* field) { char zero[16] = {0}; @@ -2386,31 +2388,52 @@ UPB_INLINE void _upb_MiniTable_CopyFieldData(void* to, const void* from, // bool FooMessage_set_bool_field(const upb_Message* msg, bool val) { // const upb_MiniTableField field = {1, 0, 0, /* etc... */}; // // All value in "field" are compile-time known. -// _upb_MiniTable_SetNonExtensionField(msg, &field, &value); +// _upb_Message_SetNonExtensionField(msg, &field, &value); // } // // // Via UPB_ASSUME(). -// UPB_INLINE void upb_MiniTable_SetBool(upb_Message* msg, -// const upb_MiniTableField* field, -// bool value) { +// UPB_INLINE bool upb_Message_SetBool(upb_Message* msg, +// const upb_MiniTableField* field, +// bool value, upb_Arena* a) { // UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool); // UPB_ASSUME(!upb_IsRepeatedOrMap(field)); // UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); -// _upb_MiniTable_SetNonExtensionField(msg, field, &value); +// _upb_Message_SetField(msg, field, &value, a); // } // // As a result, we can use these universal getters/setters for *all* message // accessors: generated code, MiniTable accessors, and reflection. The only // exception is the binary encoder/decoder, which need to be a bit more clever // about how the read/write the message data, for efficiency. +// +// These functions work on both extensions and non-extensions. If the field +// of a setter is known to be a non-extension, the arena may be NULL and the +// returned bool value may be ignored since it will always succeed. -static UPB_FORCEINLINE void _upb_MiniTable_GetNonExtensionField( +UPB_INLINE bool _upb_Message_HasExtensionField( + const upb_Message* msg, const upb_MiniTableExtension* ext) { + UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); + return _upb_Message_Getext(msg, ext) != NULL; +} + +UPB_INLINE bool _upb_Message_HasNonExtensionField( + const upb_Message* msg, const upb_MiniTableField* field) { + UPB_ASSERT(upb_MiniTableField_HasPresence(field)); + UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); + if (_upb_MiniTableField_InOneOf(field)) { + return _upb_getoneofcase_field(msg, field) == field->number; + } else { + return _upb_hasbit_field(msg, field); + } +} + +static UPB_FORCEINLINE void _upb_Message_GetNonExtensionField( const upb_Message* msg, const upb_MiniTableField* field, const void* default_val, void* val) { UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); if ((_upb_MiniTableField_InOneOf(field) || _upb_MiniTable_ValueIsNonZero(default_val, field)) && - !upb_MiniTable_HasField(msg, field)) { + !_upb_Message_HasNonExtensionField(msg, field)) { _upb_MiniTable_CopyFieldData(val, default_val, field); return; } @@ -2418,7 +2441,7 @@ static UPB_FORCEINLINE void _upb_MiniTable_GetNonExtensionField( field); } -UPB_INLINE void _upb_MiniTable_GetExtensionField( +UPB_INLINE void _upb_Message_GetExtensionField( const upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* default_val, void* val) { UPB_ASSUME(upb_MiniTableField_IsExtension(&mt_ext->field)); @@ -2430,28 +2453,29 @@ UPB_INLINE void _upb_MiniTable_GetExtensionField( } } -UPB_INLINE void _upb_MiniTable_GetField(const upb_Message* msg, - const upb_MiniTableField* field, - const void* default_val, void* val) { +UPB_INLINE void _upb_Message_GetField(const upb_Message* msg, + const upb_MiniTableField* field, + const void* default_val, void* val) { if (upb_MiniTableField_IsExtension(field)) { - _upb_MiniTable_GetExtensionField(msg, (upb_MiniTableExtension*)field, - default_val, val); + _upb_Message_GetExtensionField(msg, (upb_MiniTableExtension*)field, + default_val, val); } else { - _upb_MiniTable_GetNonExtensionField(msg, field, default_val, val); + _upb_Message_GetNonExtensionField(msg, field, default_val, val); } } -UPB_INLINE void _upb_MiniTable_SetNonExtensionField( +UPB_INLINE void _upb_Message_SetNonExtensionField( upb_Message* msg, const upb_MiniTableField* field, const void* val) { UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); - _upb_MiniTable_SetPresence(msg, field); + _upb_Message_SetPresence(msg, field); _upb_MiniTable_CopyFieldData(_upb_MiniTableField_GetPtr(msg, field), val, field); } -UPB_INLINE bool _upb_MiniTable_SetExtensionField( +UPB_INLINE bool _upb_Message_SetExtensionField( upb_Message* msg, const upb_MiniTableExtension* mt_ext, const void* val, upb_Arena* a) { + UPB_ASSERT(a); upb_Message_Extension* ext = _upb_Message_GetOrCreateExtension(msg, mt_ext, a); if (!ext) return false; @@ -2459,51 +2483,33 @@ UPB_INLINE bool _upb_MiniTable_SetExtensionField( return true; } -UPB_INLINE bool _upb_MiniTable_SetField(upb_Message* msg, - const upb_MiniTableField* field, - const void* val, upb_Arena* a) { +UPB_INLINE bool _upb_Message_SetField(upb_Message* msg, + const upb_MiniTableField* field, + const void* val, upb_Arena* a) { if (upb_MiniTableField_IsExtension(field)) { - return _upb_MiniTable_SetExtensionField( - msg, (const upb_MiniTableExtension*)field, val, a); + const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; + return _upb_Message_SetExtensionField(msg, ext, val, a); } else { - _upb_MiniTable_SetNonExtensionField(msg, field, val); + _upb_Message_SetNonExtensionField(msg, field, val); return true; } } -UPB_INLINE bool _upb_MiniTable_HasExtensionField( - const upb_Message* msg, const upb_MiniTableExtension* ext) { - UPB_ASSERT(upb_MiniTableField_HasPresence(&ext->field)); - return _upb_Message_Getext(msg, ext) != NULL; -} - -UPB_INLINE bool _upb_MiniTable_HasNonExtensionField( - const upb_Message* msg, const upb_MiniTableField* field) { - UPB_ASSERT(upb_MiniTableField_HasPresence(field)); - UPB_ASSUME(!upb_MiniTableField_IsExtension(field)); - if (_upb_MiniTableField_InOneOf(field)) { - return _upb_getoneofcase_field(msg, field) == field->number; - } else { - return _upb_hasbit_field(msg, field); - } -} - -UPB_INLINE bool _upb_MiniTable_HasField(const upb_Message* msg, - const upb_MiniTableField* field) { - if (upb_MiniTableField_IsExtension(field)) { - return _upb_MiniTable_HasExtensionField( - msg, (const upb_MiniTableExtension*)field); - } else { - return _upb_MiniTable_HasNonExtensionField(msg, field); +UPB_INLINE void _upb_Message_ClearExtensionField( + upb_Message* msg, const upb_MiniTableExtension* ext_l) { + upb_Message_Internal* in = upb_Message_Getinternal(msg); + if (!in->internal) return; + const upb_Message_Extension* base = + UPB_PTR_AT(in->internal, in->internal->ext_begin, upb_Message_Extension); + upb_Message_Extension* ext = + (upb_Message_Extension*)_upb_Message_Getext(msg, ext_l); + if (ext) { + *ext = *base; + in->internal->ext_begin += sizeof(upb_Message_Extension); } } -UPB_INLINE void _upb_MiniTable_ClearExtensionField( - upb_Message* msg, const upb_MiniTableExtension* ext) { - _upb_Message_Clearext(msg, ext); -} - -UPB_INLINE void _upb_MiniTable_ClearNonExtensionField( +UPB_INLINE void _upb_Message_ClearNonExtensionField( upb_Message* msg, const upb_MiniTableField* field) { if (field->presence > 0) { _upb_clearhas_field(msg, field); @@ -2517,50 +2523,51 @@ UPB_INLINE void _upb_MiniTable_ClearNonExtensionField( field); } -UPB_INLINE void _upb_MiniTable_ClearField(upb_Message* msg, - const upb_MiniTableField* field) { +// EVERYTHING ABOVE THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// + +UPB_API_INLINE void upb_Message_ClearField(upb_Message* msg, + const upb_MiniTableField* field) { if (upb_MiniTableField_IsExtension(field)) { - _upb_Message_Clearext(msg, (const upb_MiniTableExtension*)field); + const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; + _upb_Message_ClearExtensionField(msg, ext); } else { - _upb_MiniTable_ClearNonExtensionField(msg, field); + _upb_Message_ClearNonExtensionField(msg, field); } } -// EVERYTHING ABOVE THIS LINE IS INTERNAL - DO NOT USE ///////////////////////// - -UPB_API_INLINE void upb_MiniTable_ClearField(upb_Message* msg, - const upb_MiniTableField* field) { - _upb_MiniTable_ClearNonExtensionField(msg, field); -} - -UPB_API_INLINE bool upb_MiniTable_HasField(const upb_Message* msg, - const upb_MiniTableField* field) { - return _upb_MiniTable_HasNonExtensionField(msg, field); +UPB_API_INLINE bool upb_Message_HasField(const upb_Message* msg, + const upb_MiniTableField* field) { + if (upb_MiniTableField_IsExtension(field)) { + const upb_MiniTableExtension* ext = (const upb_MiniTableExtension*)field; + return _upb_Message_HasExtensionField(msg, ext); + } else { + return _upb_Message_HasNonExtensionField(msg, field); + } } -UPB_API_INLINE bool upb_MiniTable_GetBool(const upb_Message* msg, - const upb_MiniTableField* field, - bool default_val) { +UPB_API_INLINE bool upb_Message_GetBool(const upb_Message* msg, + const upb_MiniTableField* field, + bool default_val) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); bool ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetBool(upb_Message* msg, - const upb_MiniTableField* field, - bool value) { +UPB_API_INLINE bool upb_Message_SetBool(upb_Message* msg, + const upb_MiniTableField* field, + bool value, upb_Arena* a) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Bool); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_1Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE int32_t upb_MiniTable_GetInt32(const upb_Message* msg, - const upb_MiniTableField* field, - int32_t default_val) { +UPB_API_INLINE int32_t upb_Message_GetInt32(const upb_Message* msg, + const upb_MiniTableField* field, + int32_t default_val) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Int32 || field->descriptortype == kUpb_FieldType_SInt32 || field->descriptortype == kUpb_FieldType_SFixed32 || @@ -2568,41 +2575,41 @@ UPB_API_INLINE int32_t upb_MiniTable_GetInt32(const upb_Message* msg, UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); int32_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetInt32(upb_Message* msg, - const upb_MiniTableField* field, - int32_t value) { +UPB_API_INLINE bool upb_Message_SetInt32(upb_Message* msg, + const upb_MiniTableField* field, + int32_t value, upb_Arena* a) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_Int32 || field->descriptortype == kUpb_FieldType_SInt32 || field->descriptortype == kUpb_FieldType_SFixed32); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE uint32_t upb_MiniTable_GetUInt32(const upb_Message* msg, - const upb_MiniTableField* field, - uint32_t default_val) { +UPB_API_INLINE uint32_t upb_Message_GetUInt32(const upb_Message* msg, + const upb_MiniTableField* field, + uint32_t default_val) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_UInt32 || field->descriptortype == kUpb_FieldType_Fixed32); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); uint32_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetUInt32(upb_Message* msg, - const upb_MiniTableField* field, - uint32_t value) { +UPB_API_INLINE bool upb_Message_SetUInt32(upb_Message* msg, + const upb_MiniTableField* field, + uint32_t value, upb_Arena* a) { UPB_ASSUME(field->descriptortype == kUpb_FieldType_UInt32 || field->descriptortype == kUpb_FieldType_Fixed32); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } UPB_API_INLINE void upb_MiniTable_SetEnumProto2( @@ -2613,115 +2620,115 @@ UPB_API_INLINE void upb_MiniTable_SetEnumProto2( UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); UPB_ASSERT(upb_MiniTableEnum_CheckValue( upb_MiniTable_GetSubEnumTable(msg_mini_table, field), value)); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + _upb_Message_SetNonExtensionField(msg, field, &value); } -UPB_API_INLINE int64_t upb_MiniTable_GetInt64(const upb_Message* msg, - const upb_MiniTableField* field, - uint64_t default_val) { +UPB_API_INLINE int64_t upb_Message_GetInt64(const upb_Message* msg, + const upb_MiniTableField* field, + uint64_t default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Int64 || field->descriptortype == kUpb_FieldType_SInt64 || field->descriptortype == kUpb_FieldType_SFixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); int64_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetInt64(upb_Message* msg, - const upb_MiniTableField* field, - int64_t value) { +UPB_API_INLINE bool upb_Message_SetInt64(upb_Message* msg, + const upb_MiniTableField* field, + int64_t value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Int64 || field->descriptortype == kUpb_FieldType_SInt64 || field->descriptortype == kUpb_FieldType_SFixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE uint64_t upb_MiniTable_GetUInt64(const upb_Message* msg, - const upb_MiniTableField* field, - uint64_t default_val) { +UPB_API_INLINE uint64_t upb_Message_GetUInt64(const upb_Message* msg, + const upb_MiniTableField* field, + uint64_t default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_UInt64 || field->descriptortype == kUpb_FieldType_Fixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); uint64_t ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetUInt64(upb_Message* msg, - const upb_MiniTableField* field, - uint64_t value) { +UPB_API_INLINE bool upb_Message_SetUInt64(upb_Message* msg, + const upb_MiniTableField* field, + uint64_t value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_UInt64 || field->descriptortype == kUpb_FieldType_Fixed64); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE float upb_MiniTable_GetFloat(const upb_Message* msg, - const upb_MiniTableField* field, - float default_val) { +UPB_API_INLINE float upb_Message_GetFloat(const upb_Message* msg, + const upb_MiniTableField* field, + float default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Float); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); float ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetFloat(upb_Message* msg, - const upb_MiniTableField* field, - float value) { +UPB_API_INLINE bool upb_Message_SetFloat(upb_Message* msg, + const upb_MiniTableField* field, + float value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Float); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_4Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } -UPB_API_INLINE double upb_MiniTable_GetDouble(const upb_Message* msg, - const upb_MiniTableField* field, - double default_val) { +UPB_API_INLINE double upb_Message_GetDouble(const upb_Message* msg, + const upb_MiniTableField* field, + double default_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Double); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); double ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetField(msg, field, &default_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetDouble(upb_Message* msg, - const upb_MiniTableField* field, - double value) { +UPB_API_INLINE bool upb_Message_SetDouble(upb_Message* msg, + const upb_MiniTableField* field, + double value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Double); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_8Byte); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } UPB_API_INLINE upb_StringView -upb_MiniTable_GetString(const upb_Message* msg, const upb_MiniTableField* field, - upb_StringView def_val) { +upb_Message_GetString(const upb_Message* msg, const upb_MiniTableField* field, + upb_StringView def_val) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Bytes || field->descriptortype == kUpb_FieldType_String); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); upb_StringView ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &def_val, &ret); + _upb_Message_GetField(msg, field, &def_val, &ret); return ret; } -UPB_API_INLINE void upb_MiniTable_SetString(upb_Message* msg, - const upb_MiniTableField* field, - upb_StringView value) { +UPB_API_INLINE bool upb_Message_SetString(upb_Message* msg, + const upb_MiniTableField* field, + upb_StringView value, upb_Arena* a) { UPB_ASSERT(field->descriptortype == kUpb_FieldType_Bytes || field->descriptortype == kUpb_FieldType_String); UPB_ASSUME(!upb_IsRepeatedOrMap(field)); UPB_ASSUME(_upb_MiniTableField_GetRep(field) == kUpb_FieldRep_StringView); - _upb_MiniTable_SetNonExtensionField(msg, field, &value); + return _upb_Message_SetField(msg, field, &value, a); } UPB_API_INLINE const upb_Message* upb_MiniTable_GetMessage( @@ -2733,7 +2740,7 @@ UPB_API_INLINE const upb_Message* upb_MiniTable_GetMessage( UPB_ASSUME(_upb_MiniTableField_GetRep(field) == UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); upb_Message* ret; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); return ret; } @@ -2747,7 +2754,7 @@ UPB_API_INLINE void upb_MiniTable_SetMessage(upb_Message* msg, UPB_ASSUME(_upb_MiniTableField_GetRep(field) == UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte)); UPB_ASSERT(mini_table->subs[field->submsg_index].submsg); - _upb_MiniTable_SetNonExtensionField(msg, field, &sub_message); + _upb_Message_SetNonExtensionField(msg, field, &sub_message); } UPB_API_INLINE upb_Message* upb_MiniTable_GetMutableMessage( @@ -2762,7 +2769,7 @@ UPB_API_INLINE upb_Message* upb_MiniTable_GetMutableMessage( 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_MiniTable_SetPresence(msg, field); + _upb_Message_SetPresence(msg, field); } return sub_message; } @@ -2771,7 +2778,7 @@ UPB_API_INLINE const upb_Array* upb_MiniTable_GetArray( const upb_Message* msg, const upb_MiniTableField* field) { const upb_Array* ret; const upb_Array* default_val = NULL; - _upb_MiniTable_GetNonExtensionField(msg, field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, field, &default_val, &ret); return ret; } @@ -2783,6 +2790,12 @@ UPB_API_INLINE upb_Array* upb_MiniTable_GetMutableArray( void* upb_MiniTable_ResizeArray(upb_Message* msg, const upb_MiniTableField* field, size_t len, upb_Arena* arena); + +UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum( + const upb_MiniTableField* field) { + return field->descriptortype == kUpb_FieldType_Enum; +} + typedef enum { kUpb_GetExtension_Ok, kUpb_GetExtension_NotPresent, @@ -2923,10 +2936,10 @@ typedef enum { kUpb_DecodeStatus_MissingRequired = 5, } upb_DecodeStatus; -upb_DecodeStatus upb_Decode(const char* buf, size_t size, upb_Message* msg, - const upb_MiniTable* l, - const upb_ExtensionRegistry* extreg, int options, - upb_Arena* arena); +UPB_API upb_DecodeStatus upb_Decode(const char* buf, size_t size, + upb_Message* msg, const upb_MiniTable* l, + const upb_ExtensionRegistry* extreg, + int options, upb_Arena* arena); #ifdef __cplusplus } /* extern "C" */ @@ -3286,7 +3299,7 @@ UPB_INLINE char* google_protobuf_FileDescriptorSet_serialize_ex(const google_pro } UPB_INLINE void google_protobuf_FileDescriptorSet_clear_file(google_protobuf_FileDescriptorSet* msg) { const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FileDescriptorProto* const* google_protobuf_FileDescriptorSet_file(const google_protobuf_FileDescriptorSet* msg, size_t* len) { return (const google_protobuf_FileDescriptorProto* const*)_upb_array_accessor(msg, 0, len); @@ -3347,37 +3360,37 @@ UPB_INLINE char* google_protobuf_FileDescriptorProto_serialize_ex(const google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_name(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_name(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_name(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_package(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_package(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_package(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_dependency(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(4, 40), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_FileDescriptorProto_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(4, 40), len); @@ -3389,7 +3402,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_dependency(const google_ } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_message_type(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(8, 48), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_FileDescriptorProto_message_type(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(8, 48), len); @@ -3401,7 +3414,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_message_type(const googl } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_enum_type(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(12, 56), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_FileDescriptorProto_enum_type(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(12, 56), len); @@ -3413,7 +3426,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_enum_type(const google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_service(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(16, 64), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(16, 64), len); @@ -3425,7 +3438,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_pro } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_extension(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(20, 72), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 72), len); @@ -3437,37 +3450,37 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_options(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_FileOptions* default_val = NULL; const google_protobuf_FileOptions* ret; const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_source_code_info(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const google_protobuf_SourceCodeInfo* default_val = NULL; const google_protobuf_SourceCodeInfo* ret; const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_public_dependency(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(32, 96), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(32, 96), len); @@ -3479,7 +3492,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_public_dependency(const } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_weak_dependency(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {11, UPB_SIZE(36, 104), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(36, 104), len); @@ -3491,41 +3504,41 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_weak_dependency(const go } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_syntax(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_clear_edition(google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileDescriptorProto_edition(const google_protobuf_FileDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_edition(const google_protobuf_FileDescriptorProto* msg) { const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileDescriptorProto_set_package(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(48, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE upb_StringView* google_protobuf_FileDescriptorProto_mutable_dependency(google_protobuf_FileDescriptorProto* msg, size_t* len) { return (upb_StringView*)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 40), len); } @@ -3585,7 +3598,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { const upb_MiniTableField field = {8, UPB_SIZE(24, 80), 3, 4, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_FileOptions* sub = (struct google_protobuf_FileOptions*)google_protobuf_FileDescriptorProto_options(msg); if (sub == NULL) { @@ -3596,7 +3609,7 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_ } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { const upb_MiniTableField field = {9, UPB_SIZE(28, 88), 4, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_SourceCodeInfo* sub = (struct google_protobuf_SourceCodeInfo*)google_protobuf_FileDescriptorProto_source_code_info(msg); if (sub == NULL) { @@ -3625,10 +3638,10 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {12, UPB_SIZE(56, 112), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileDescriptorProto_set_edition(google_protobuf_FileDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {13, UPB_SIZE(64, 128), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.DescriptorProto */ @@ -3667,22 +3680,22 @@ UPB_INLINE char* google_protobuf_DescriptorProto_serialize_ex(const google_proto } UPB_INLINE void google_protobuf_DescriptorProto_clear_name(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_DescriptorProto_name(const google_protobuf_DescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_has_name(const google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_clear_field(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_field(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(4, 24), len); @@ -3694,7 +3707,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_field(const google_protobuf_ } UPB_INLINE void google_protobuf_DescriptorProto_clear_nested_type(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto* const* google_protobuf_DescriptorProto_nested_type(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(8, 32), len); @@ -3706,7 +3719,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_nested_type(const google_pro } UPB_INLINE void google_protobuf_DescriptorProto_clear_enum_type(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto* const* google_protobuf_DescriptorProto_enum_type(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(12, 40), len); @@ -3718,7 +3731,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_enum_type(const google_proto } UPB_INLINE void google_protobuf_DescriptorProto_clear_extension_range(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, 3, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto_ExtensionRange* const* google_protobuf_DescriptorProto_extension_range(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto_ExtensionRange* const*)_upb_array_accessor(msg, UPB_SIZE(16, 48), len); @@ -3730,7 +3743,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_extension_range(const google } UPB_INLINE void google_protobuf_DescriptorProto_clear_extension(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(20, 56), 0, 4, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_DescriptorProto_extension(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(20, 56), len); @@ -3742,22 +3755,22 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_extension(const google_proto } UPB_INLINE void google_protobuf_DescriptorProto_clear_options(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_MessageOptions* google_protobuf_DescriptorProto_options(const google_protobuf_DescriptorProto* msg) { const google_protobuf_MessageOptions* default_val = NULL; const google_protobuf_MessageOptions* ret; const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_has_options(const google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_clear_oneof_decl(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(28, 72), 0, 6, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_OneofDescriptorProto* const* google_protobuf_DescriptorProto_oneof_decl(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_OneofDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(28, 72), len); @@ -3769,7 +3782,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_oneof_decl(const google_prot } UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_range(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(32, 80), 0, 7, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_DescriptorProto_ReservedRange* const* google_protobuf_DescriptorProto_reserved_range(const google_protobuf_DescriptorProto* msg, size_t* len) { return (const google_protobuf_DescriptorProto_ReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(32, 80), len); @@ -3781,7 +3794,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_range(const google_ } UPB_INLINE void google_protobuf_DescriptorProto_clear_reserved_name(google_protobuf_DescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(36, 88), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_DescriptorProto_reserved_name(const google_protobuf_DescriptorProto* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(36, 88), len); @@ -3794,7 +3807,7 @@ UPB_INLINE bool google_protobuf_DescriptorProto_has_reserved_name(const google_p UPB_INLINE void google_protobuf_DescriptorProto_set_name(google_protobuf_DescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(40, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_mutable_field(google_protobuf_DescriptorProto* msg, size_t* len) { return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 24), len); } @@ -3857,7 +3870,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_Descript } UPB_INLINE void google_protobuf_DescriptorProto_set_options(google_protobuf_DescriptorProto *msg, google_protobuf_MessageOptions* value) { const upb_MiniTableField field = {7, UPB_SIZE(24, 64), 2, 5, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_MessageOptions* google_protobuf_DescriptorProto_mutable_options(google_protobuf_DescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_MessageOptions* sub = (struct google_protobuf_MessageOptions*)google_protobuf_DescriptorProto_options(msg); if (sub == NULL) { @@ -3937,59 +3950,59 @@ UPB_INLINE char* google_protobuf_DescriptorProto_ExtensionRange_serialize_ex(con } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_start(google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_start(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_end(google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ExtensionRange_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_end(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_clear_options(google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const google_protobuf_ExtensionRangeOptions* default_val = NULL; const google_protobuf_ExtensionRangeOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ExtensionRange_has_options(const google_protobuf_DescriptorProto_ExtensionRange* msg) { const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_start(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_end(google_protobuf_DescriptorProto_ExtensionRange *msg, int32_t value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_DescriptorProto_ExtensionRange_set_options(google_protobuf_DescriptorProto_ExtensionRange *msg, google_protobuf_ExtensionRangeOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_DescriptorProto_ExtensionRange_mutable_options(google_protobuf_DescriptorProto_ExtensionRange* msg, upb_Arena* arena) { struct google_protobuf_ExtensionRangeOptions* sub = (struct google_protobuf_ExtensionRangeOptions*)google_protobuf_DescriptorProto_ExtensionRange_options(msg); if (sub == NULL) { @@ -4036,41 +4049,41 @@ UPB_INLINE char* google_protobuf_DescriptorProto_ReservedRange_serialize_ex(cons } UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_start(google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_start(const google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_clear_end(google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_DescriptorProto_ReservedRange_end(const google_protobuf_DescriptorProto_ReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_DescriptorProto_ReservedRange_has_end(const google_protobuf_DescriptorProto_ReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_start(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_protobuf_DescriptorProto_ReservedRange *msg, int32_t value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.ExtensionRangeOptions */ @@ -4109,7 +4122,7 @@ UPB_INLINE char* google_protobuf_ExtensionRangeOptions_serialize_ex(const google } UPB_INLINE void google_protobuf_ExtensionRangeOptions_clear_uninterpreted_option(google_protobuf_ExtensionRangeOptions* msg) { const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ExtensionRangeOptions_uninterpreted_option(const google_protobuf_ExtensionRangeOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 0, len); @@ -4170,194 +4183,194 @@ UPB_INLINE char* google_protobuf_FieldDescriptorProto_serialize_ex(const google_ } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_name(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_extendee(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_number(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_label(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = 1; int32_t ret; const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = 1; int32_t ret; const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_type_name(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_default_value(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_options(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto* msg) { const google_protobuf_FieldOptions* default_val = NULL; const google_protobuf_FieldOptions* ret; const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_oneof_index(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_json_name(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_clear_proto3_optional(google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto* msg) { const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(28, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(36, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {3, 4, 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {4, 8, 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {5, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {6, UPB_SIZE(44, 56), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {7, UPB_SIZE(52, 72), 7, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { const upb_MiniTableField field = {8, UPB_SIZE(16, 88), 8, 2, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_FieldOptions* sub = (struct google_protobuf_FieldOptions*)google_protobuf_FieldDescriptorProto_options(msg); if (sub == NULL) { @@ -4368,13 +4381,13 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_Fi } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {9, UPB_SIZE(20, 16), 9, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {10, UPB_SIZE(60, 96), 10, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { const upb_MiniTableField field = {17, UPB_SIZE(24, 20), 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.OneofDescriptorProto */ @@ -4413,41 +4426,41 @@ UPB_INLINE char* google_protobuf_OneofDescriptorProto_serialize_ex(const google_ } UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_name(google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_OneofDescriptorProto_name(const google_protobuf_OneofDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_name(const google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_OneofDescriptorProto_clear_options(google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_options(const google_protobuf_OneofDescriptorProto* msg) { const google_protobuf_OneofOptions* default_val = NULL; const google_protobuf_OneofOptions* ret; const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_OneofDescriptorProto_has_options(const google_protobuf_OneofDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_OneofDescriptorProto_set_name(google_protobuf_OneofDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, 8, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_OneofDescriptorProto_set_options(google_protobuf_OneofDescriptorProto *msg, google_protobuf_OneofOptions* value) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorProto_mutable_options(google_protobuf_OneofDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_OneofOptions* sub = (struct google_protobuf_OneofOptions*)google_protobuf_OneofDescriptorProto_options(msg); if (sub == NULL) { @@ -4494,22 +4507,22 @@ UPB_INLINE char* google_protobuf_EnumDescriptorProto_serialize_ex(const google_p } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_name(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_EnumDescriptorProto_name(const google_protobuf_EnumDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_name(const google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_value(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumValueDescriptorProto* const* google_protobuf_EnumDescriptorProto_value(const google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumValueDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(4, 24), len); @@ -4521,22 +4534,22 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_value(const google_proto } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_options(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_options(const google_protobuf_EnumDescriptorProto* msg) { const google_protobuf_EnumOptions* default_val = NULL; const google_protobuf_EnumOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_options(const google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_range(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 40), 0, 2, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumDescriptorProto_EnumReservedRange* const* google_protobuf_EnumDescriptorProto_reserved_range(const google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (const google_protobuf_EnumDescriptorProto_EnumReservedRange* const*)_upb_array_accessor(msg, UPB_SIZE(12, 40), len); @@ -4548,7 +4561,7 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_range(const goo } UPB_INLINE void google_protobuf_EnumDescriptorProto_clear_reserved_name(google_protobuf_EnumDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 48), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_EnumDescriptorProto_reserved_name(const google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(16, 48), len); @@ -4561,7 +4574,7 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_has_reserved_name(const goog UPB_INLINE void google_protobuf_EnumDescriptorProto_set_name(google_protobuf_EnumDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(20, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_mutable_value(google_protobuf_EnumDescriptorProto* msg, size_t* len) { return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 24), len); } @@ -4576,7 +4589,7 @@ UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_Enum } UPB_INLINE void google_protobuf_EnumDescriptorProto_set_options(google_protobuf_EnumDescriptorProto *msg, google_protobuf_EnumOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_EnumOptions* google_protobuf_EnumDescriptorProto_mutable_options(google_protobuf_EnumDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_EnumOptions* sub = (struct google_protobuf_EnumOptions*)google_protobuf_EnumDescriptorProto_options(msg); if (sub == NULL) { @@ -4644,41 +4657,41 @@ UPB_INLINE char* google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize } UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_start(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_start(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_clear_end(google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_EnumDescriptorProto_EnumReservedRange_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumDescriptorProto_EnumReservedRange_has_end(const google_protobuf_EnumDescriptorProto_EnumReservedRange* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_start(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, int32_t value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.EnumValueDescriptorProto */ @@ -4717,59 +4730,59 @@ UPB_INLINE char* google_protobuf_EnumValueDescriptorProto_serialize_ex(const goo } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_name(google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_number(google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_clear_options(google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto* msg) { const google_protobuf_EnumValueOptions* default_val = NULL; const google_protobuf_EnumValueOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { const upb_MiniTableField field = {2, 4, 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_mutable_options(google_protobuf_EnumValueDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_EnumValueOptions* sub = (struct google_protobuf_EnumValueOptions*)google_protobuf_EnumValueDescriptorProto_options(msg); if (sub == NULL) { @@ -4816,22 +4829,22 @@ UPB_INLINE char* google_protobuf_ServiceDescriptorProto_serialize_ex(const googl } UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_name(google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_ServiceDescriptorProto_name(const google_protobuf_ServiceDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_name(const google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_method(google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 24), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_MethodDescriptorProto* const* google_protobuf_ServiceDescriptorProto_method(const google_protobuf_ServiceDescriptorProto* msg, size_t* len) { return (const google_protobuf_MethodDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(4, 24), len); @@ -4843,23 +4856,23 @@ UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_method(const google_p } UPB_INLINE void google_protobuf_ServiceDescriptorProto_clear_options(google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_options(const google_protobuf_ServiceDescriptorProto* msg) { const google_protobuf_ServiceOptions* default_val = NULL; const google_protobuf_ServiceOptions* ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ServiceDescriptorProto_has_options(const google_protobuf_ServiceDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_name(google_protobuf_ServiceDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_mutable_method(google_protobuf_ServiceDescriptorProto* msg, size_t* len) { return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 24), len); } @@ -4874,7 +4887,7 @@ UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_Service } UPB_INLINE void google_protobuf_ServiceDescriptorProto_set_options(google_protobuf_ServiceDescriptorProto *msg, google_protobuf_ServiceOptions* value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 32), 2, 1, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescriptorProto_mutable_options(google_protobuf_ServiceDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_ServiceOptions* sub = (struct google_protobuf_ServiceOptions*)google_protobuf_ServiceDescriptorProto_options(msg); if (sub == NULL) { @@ -4921,107 +4934,107 @@ UPB_INLINE char* google_protobuf_MethodDescriptorProto_serialize_ex(const google } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_name(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_input_type(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_output_type(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_options(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto* msg) { const google_protobuf_MethodOptions* default_val = NULL; const google_protobuf_MethodOptions* ret; const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_client_streaming(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_clear_server_streaming(google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto* msg) { const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(12, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_StringView value) { const upb_MiniTableField field = {3, UPB_SIZE(28, 40), 3, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { const upb_MiniTableField field = {4, UPB_SIZE(4, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto* msg, upb_Arena* arena) { struct google_protobuf_MethodOptions* sub = (struct google_protobuf_MethodOptions*)google_protobuf_MethodDescriptorProto_options(msg); if (sub == NULL) { @@ -5032,10 +5045,10 @@ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_M } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { const upb_MiniTableField field = {5, UPB_SIZE(8, 1), 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { const upb_MiniTableField field = {6, UPB_SIZE(9, 2), 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.FileOptions */ @@ -5074,307 +5087,307 @@ UPB_INLINE char* google_protobuf_FileOptions_serialize_ex(const google_protobuf_ } UPB_INLINE void google_protobuf_FileOptions_clear_java_package(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_outer_classname(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_optimize_for(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions* msg) { int32_t default_val = 1; int32_t ret; const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_multiple_files(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_go_package(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_py_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_generate_equals_and_hash(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_deprecated(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_java_string_check_utf8(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_cc_enable_arenas(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions* msg) { bool default_val = true; bool ret; const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_objc_class_prefix(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_csharp_namespace(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_swift_prefix(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_class_prefix(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_namespace(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_generic_services(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_php_metadata_namespace(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_ruby_package(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_FileOptions_ruby_package(const google_protobuf_FileOptions* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FileOptions_has_ruby_package(const google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FileOptions_clear_uninterpreted_option(google_protobuf_FileOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(20, 184), 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 184), len); @@ -5387,64 +5400,64 @@ UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const googl UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {1, 24, 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {8, UPB_SIZE(32, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { const upb_MiniTableField field = {9, 4, 3, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {10, 8, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {11, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {16, 9, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {17, 10, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {18, 11, 8, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {20, 12, 9, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {23, 13, 10, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {27, 14, 11, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {31, 15, 12, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {36, UPB_SIZE(48, 72), 13, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {37, UPB_SIZE(56, 88), 14, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {39, UPB_SIZE(64, 104), 15, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {40, UPB_SIZE(72, 120), 16, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {41, UPB_SIZE(80, 136), 17, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { const upb_MiniTableField field = {42, 16, 18, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {44, UPB_SIZE(88, 152), 19, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FileOptions_set_ruby_package(google_protobuf_FileOptions *msg, upb_StringView value) { const upb_MiniTableField field = {45, UPB_SIZE(96, 168), 20, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mutable_uninterpreted_option(google_protobuf_FileOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 184), len); } @@ -5495,67 +5508,67 @@ UPB_INLINE char* google_protobuf_MessageOptions_serialize_ex(const google_protob } UPB_INLINE void google_protobuf_MessageOptions_clear_message_set_wire_format(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_message_set_wire_format(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_message_set_wire_format(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_no_standard_descriptor_accessor(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_no_standard_descriptor_accessor(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_deprecated(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_map_entry(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MessageOptions_map_entry(const google_protobuf_MessageOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MessageOptions_uninterpreted_option(const google_protobuf_MessageOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 8, len); @@ -5568,16 +5581,16 @@ UPB_INLINE bool google_protobuf_MessageOptions_has_uninterpreted_option(const go UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MessageOptions_set_no_standard_descriptor_accessor(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MessageOptions_set_deprecated(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, 8, len); } @@ -5628,112 +5641,112 @@ UPB_INLINE char* google_protobuf_FieldOptions_serialize_ex(const google_protobuf } UPB_INLINE void google_protobuf_FieldOptions_clear_ctype(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_packed(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_deprecated(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_lazy(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_jstype(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_weak(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_FieldOptions_clear_unverified_lazy(google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_FieldOptions_unverified_lazy(const google_protobuf_FieldOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_FieldOptions_has_unverified_lazy(const google_protobuf_FieldOptions* msg) { const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + 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)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FieldOptions_uninterpreted_option(const google_protobuf_FieldOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(20, 24), len); @@ -5746,25 +5759,25 @@ UPB_INLINE bool google_protobuf_FieldOptions_has_uninterpreted_option(const goog UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOptions *msg, int32_t value) { const upb_MiniTableField field = {1, 4, 1, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {2, 8, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {3, 9, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {5, 10, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { const upb_MiniTableField field = {6, 12, 5, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {10, 16, 6, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_FieldOptions_set_unverified_lazy(google_protobuf_FieldOptions *msg, bool value) { const upb_MiniTableField field = {15, 17, 7, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mutable_uninterpreted_option(google_protobuf_FieldOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len); } @@ -5815,7 +5828,7 @@ UPB_INLINE char* google_protobuf_OneofOptions_serialize_ex(const google_protobuf } UPB_INLINE void google_protobuf_OneofOptions_clear_uninterpreted_option(google_protobuf_OneofOptions* msg) { const upb_MiniTableField field = {999, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_OneofOptions_uninterpreted_option(const google_protobuf_OneofOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 0, len); @@ -5876,37 +5889,37 @@ UPB_INLINE char* google_protobuf_EnumOptions_serialize_ex(const google_protobuf_ } UPB_INLINE void google_protobuf_EnumOptions_clear_allow_alias(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_EnumOptions_allow_alias(const google_protobuf_EnumOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumOptions_has_allow_alias(const google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_EnumOptions_deprecated(const google_protobuf_EnumOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumOptions_uninterpreted_option(const google_protobuf_EnumOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -5919,10 +5932,10 @@ UPB_INLINE bool google_protobuf_EnumOptions_has_uninterpreted_option(const googl UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_EnumOptions *msg, bool value) { const upb_MiniTableField field = {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } @@ -5973,22 +5986,22 @@ UPB_INLINE char* google_protobuf_EnumValueOptions_serialize_ex(const google_prot } UPB_INLINE void google_protobuf_EnumValueOptions_clear_deprecated(google_protobuf_EnumValueOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_EnumValueOptions_deprecated(const google_protobuf_EnumValueOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_EnumValueOptions_has_deprecated(const google_protobuf_EnumValueOptions* msg) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_EnumValueOptions_clear_uninterpreted_option(google_protobuf_EnumValueOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_EnumValueOptions_uninterpreted_option(const google_protobuf_EnumValueOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6001,7 +6014,7 @@ UPB_INLINE bool google_protobuf_EnumValueOptions_has_uninterpreted_option(const UPB_INLINE void google_protobuf_EnumValueOptions_set_deprecated(google_protobuf_EnumValueOptions *msg, bool value) { const upb_MiniTableField field = {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_mutable_uninterpreted_option(google_protobuf_EnumValueOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } @@ -6052,22 +6065,22 @@ UPB_INLINE char* google_protobuf_ServiceOptions_serialize_ex(const google_protob } UPB_INLINE void google_protobuf_ServiceOptions_clear_deprecated(google_protobuf_ServiceOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_ServiceOptions_deprecated(const google_protobuf_ServiceOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_ServiceOptions_has_deprecated(const google_protobuf_ServiceOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_ServiceOptions_clear_uninterpreted_option(google_protobuf_ServiceOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_ServiceOptions_uninterpreted_option(const google_protobuf_ServiceOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6080,7 +6093,7 @@ UPB_INLINE bool google_protobuf_ServiceOptions_has_uninterpreted_option(const go UPB_INLINE void google_protobuf_ServiceOptions_set_deprecated(google_protobuf_ServiceOptions *msg, bool value) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_mutable_uninterpreted_option(google_protobuf_ServiceOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } @@ -6131,37 +6144,37 @@ UPB_INLINE char* google_protobuf_MethodOptions_serialize_ex(const google_protobu } UPB_INLINE void google_protobuf_MethodOptions_clear_deprecated(google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodOptions_clear_idempotency_level(google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_MethodOptions_clear_uninterpreted_option(google_protobuf_MethodOptions* msg) { const upb_MiniTableField field = {999, 8, 0, 1, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions* msg, size_t* len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, 8, len); @@ -6174,10 +6187,10 @@ UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const goo UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { const upb_MiniTableField field = {33, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) { const upb_MiniTableField field = {34, 4, 2, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, 8, len); } @@ -6228,7 +6241,7 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_serialize_ex(const google_p } UPB_INLINE void google_protobuf_UninterpretedOption_clear_name(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {2, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption* msg, size_t* len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6240,93 +6253,93 @@ UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protob } UPB_INLINE void google_protobuf_UninterpretedOption_clear_identifier_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_positive_int_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption* msg) { uint64_t default_val = (uint64_t)0ull; uint64_t ret; const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_negative_int_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption* msg) { int64_t default_val = (int64_t)0ll; int64_t ret; const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_double_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption* msg) { double default_val = 0; double ret; const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_string_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_clear_aggregate_value(google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_aggregate_value(const google_protobuf_UninterpretedOption* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_has_aggregate_value(const google_protobuf_UninterpretedOption* msg) { const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_mutable_name(google_protobuf_UninterpretedOption* msg, size_t* len) { @@ -6343,22 +6356,22 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 16), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { const upb_MiniTableField field = {4, UPB_SIZE(16, 32), 2, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { const upb_MiniTableField field = {5, UPB_SIZE(24, 40), 3, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { const upb_MiniTableField field = {6, UPB_SIZE(32, 48), 4, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { const upb_MiniTableField field = {7, UPB_SIZE(40, 56), 5, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_protobuf_UninterpretedOption *msg, upb_StringView value) { const upb_MiniTableField field = {8, UPB_SIZE(48, 72), 6, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.UninterpretedOption.NamePart */ @@ -6397,41 +6410,41 @@ UPB_INLINE char* google_protobuf_UninterpretedOption_NamePart_serialize_ex(const } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_name_part(google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_clear_is_extension(google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) { bool default_val = false; bool ret; const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart* msg) { const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_StringView value) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { const upb_MiniTableField field = {2, 1, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } /* google.protobuf.SourceCodeInfo */ @@ -6470,7 +6483,7 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_serialize_ex(const google_protob } UPB_INLINE void google_protobuf_SourceCodeInfo_clear_location(google_protobuf_SourceCodeInfo* msg) { const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_SourceCodeInfo_Location* const* google_protobuf_SourceCodeInfo_location(const google_protobuf_SourceCodeInfo* msg, size_t* len) { return (const google_protobuf_SourceCodeInfo_Location* const*)_upb_array_accessor(msg, 0, len); @@ -6531,7 +6544,7 @@ UPB_INLINE char* google_protobuf_SourceCodeInfo_Location_serialize_ex(const goog } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_path(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 8), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_path(const google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); @@ -6543,7 +6556,7 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_path(const google_pr } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_span(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {2, UPB_SIZE(8, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_SourceCodeInfo_Location_span(const google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); @@ -6555,37 +6568,37 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_span(const google_pr } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_comments(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_leading_comments(const google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_trailing_comments(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_SourceCodeInfo_Location_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_has_trailing_comments(const google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_clear_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg) { const upb_MiniTableField field = {6, UPB_SIZE(12, 56), 0, kUpb_NoSub, 12, kUpb_FieldMode_Array | kUpb_LabelFlags_IsAlternate | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView const* google_protobuf_SourceCodeInfo_Location_leading_detached_comments(const google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (upb_StringView const*)_upb_array_accessor(msg, UPB_SIZE(12, 56), len); @@ -6616,10 +6629,10 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { const upb_MiniTableField field = {3, UPB_SIZE(16, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_trailing_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_StringView value) { const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 2, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE upb_StringView* google_protobuf_SourceCodeInfo_Location_mutable_leading_detached_comments(google_protobuf_SourceCodeInfo_Location* msg, size_t* len) { return (upb_StringView*)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 56), len); } @@ -6667,7 +6680,7 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_serialize_ex(const google_pro } UPB_INLINE void google_protobuf_GeneratedCodeInfo_clear_annotation(google_protobuf_GeneratedCodeInfo* msg) { const upb_MiniTableField field = {1, 0, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE const google_protobuf_GeneratedCodeInfo_Annotation* const* google_protobuf_GeneratedCodeInfo_annotation(const google_protobuf_GeneratedCodeInfo* msg, size_t* len) { return (const google_protobuf_GeneratedCodeInfo_Annotation* const*)_upb_array_accessor(msg, 0, len); @@ -6728,7 +6741,7 @@ UPB_INLINE char* google_protobuf_GeneratedCodeInfo_Annotation_serialize_ex(const } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_path(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {1, UPB_SIZE(4, 16), 0, kUpb_NoSub, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(4, 16), len); @@ -6740,63 +6753,63 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_path(const goog } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_source_file(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE upb_StringView google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { upb_StringView default_val = upb_StringView_FromString(""); upb_StringView ret; const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_begin(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_end(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { int32_t default_val = (int32_t)0; int32_t ret; const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_clear_semantic(google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_ClearNonExtensionField(msg, &field); + _upb_Message_ClearNonExtensionField(msg, &field); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { int32_t default_val = 0; int32_t ret; const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_GetNonExtensionField(msg, &field, &default_val, &ret); + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); return ret; } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_semantic(const google_protobuf_GeneratedCodeInfo_Annotation* msg) { const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - return _upb_MiniTable_HasNonExtensionField(msg, &field); + return _upb_Message_HasNonExtensionField(msg, &field); } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation* msg, size_t* len) { @@ -6810,16 +6823,16 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_StringView value) { const upb_MiniTableField field = {2, UPB_SIZE(20, 24), 1, kUpb_NoSub, 12, kUpb_FieldMode_Scalar | kUpb_LabelFlags_IsAlternate | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { const upb_MiniTableField field = {3, UPB_SIZE(8, 4), 2, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { const upb_MiniTableField field = {4, UPB_SIZE(12, 8), 3, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_semantic(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { const upb_MiniTableField field = {5, UPB_SIZE(16, 12), 4, 0, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}; - _upb_MiniTable_SetNonExtensionField(msg, &field, &value); + _upb_Message_SetNonExtensionField(msg, &field, &value); } extern const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout; @@ -7683,32 +7696,6 @@ bool upb_Message_Next(const upb_Message* msg, const upb_MessageDef* m, bool upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m, int maxdepth); -// DEPRECATED FUNCTIONS -// PHP and Ruby need these until we can version-bump them to the current upb. - -UPB_INLINE void upb_Message_Clear(upb_Message* msg, const upb_MessageDef* m) { - return upb_Message_ClearByDef(msg, m); -} - -UPB_INLINE void upb_Message_ClearField(upb_Message* msg, - const upb_FieldDef* f) { - return upb_Message_ClearFieldByDef(msg, f); -} - -UPB_INLINE bool upb_Message_Has(const upb_Message* msg, const upb_FieldDef* f) { - return upb_Message_HasFieldByDef(msg, f); -} - -UPB_INLINE upb_MessageValue upb_Message_Get(const upb_Message* msg, - const upb_FieldDef* f) { - return upb_Message_GetFieldByDef(msg, f); -} - -UPB_INLINE bool upb_Message_Set(upb_Message* msg, const upb_FieldDef* f, - upb_MessageValue val, upb_Arena* a) { - return upb_Message_SetFieldByDef(msg, f, val, a); -} - #ifdef __cplusplus } /* extern "C" */ #endif @@ -8741,6 +8728,263 @@ enum { #ifndef UPB_WIRE_DECODE_INTERNAL_H_ #define UPB_WIRE_DECODE_INTERNAL_H_ + +#ifndef UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ +#define UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ + +#include + +// Must be last. + +// The maximum number of bytes a single protobuf field can take up in the +// wire format. We only want to do one bounds check per field, so the input +// stream guarantees that after upb_EpsCopyInputStream_IsDone() is called, +// the decoder can read this many bytes without performing another bounds +// check. The stream will copy into a patch buffer as necessary to guarantee +// this invariant. +#define kUpb_EpsCopyInputStream_SlopBytes 16 + +typedef struct { + const char* end; // Can read up to SlopBytes bytes beyond this. + const char* limit_ptr; // For bounds checks, = end + UPB_MIN(limit, 0) + int limit; // Submessage limit relative to end + char patch[kUpb_EpsCopyInputStream_SlopBytes * 2]; +} upb_EpsCopyInputStream; + +typedef const char* upb_EpsCopyInputStream_BufferFlipCallback( + upb_EpsCopyInputStream* e, const char* old_end, const char* new_start); + +typedef const char* upb_EpsCopyInputStream_IsDoneFallbackFunc( + upb_EpsCopyInputStream* e, const char* ptr, int overrun); + +// Initializes a upb_EpsCopyInputStream using the contents of the buffer +// [*ptr, size]. Updates `*ptr` as necessary to guarantee that at least +// kUpb_EpsCopyInputStream_SlopBytes, and returns true if the pointer has been +// updated. +UPB_INLINE bool upb_EpsCopyInputStream_Init(upb_EpsCopyInputStream* e, + const char** ptr, size_t size) { + bool ret; + if (size <= kUpb_EpsCopyInputStream_SlopBytes) { + memset(&e->patch, 0, 32); + if (size) memcpy(&e->patch, *ptr, size); + *ptr = e->patch; + e->end = *ptr + size; + e->limit = 0; + ret = true; + } else { + e->end = *ptr + size - kUpb_EpsCopyInputStream_SlopBytes; + e->limit = kUpb_EpsCopyInputStream_SlopBytes; + ret = false; + } + e->limit_ptr = e->end; + return ret; +} + +typedef enum { + // The current stream position is at a limit. + kUpb_IsDoneStatus_Done, + + // The current stream position is not at a limit. + kUpb_IsDoneStatus_NotDone, + + // The current stream position is not at a limit, and the stream needs to + // be flipped to a new buffer before more data can be read. + kUpb_IsDoneStatus_NeedFallback, +} upb_IsDoneStatus; + +// Returns the status of the current stream position. This is a low-level +// function, it is simpler to call upb_EpsCopyInputStream_IsDone() if possible. +UPB_INLINE upb_IsDoneStatus upb_EpsCopyInputStream_IsDoneStatus( + upb_EpsCopyInputStream* e, const char* ptr, int* overrun) { + *overrun = ptr - e->end; + if (UPB_LIKELY(ptr < e->limit_ptr)) { + return kUpb_IsDoneStatus_NotDone; + } else if (UPB_LIKELY(*overrun == e->limit)) { + return kUpb_IsDoneStatus_Done; + } else { + return kUpb_IsDoneStatus_NeedFallback; + } +} + +// Returns true if the stream has hit a limit, either the current delimited +// limit or the overall end-of-stream. As a side effect, this function may flip +// the pointer to a new buffer if there are less than +// kUpb_EpsCopyInputStream_SlopBytes of data to be read in the current buffer. +// +// Postcondition: if the function returns false, there are at least +// kUpb_EpsCopyInputStream_SlopBytes of data available to read at *ptr. +UPB_INLINE bool upb_EpsCopyInputStream_IsDone( + upb_EpsCopyInputStream* e, const char** ptr, + upb_EpsCopyInputStream_IsDoneFallbackFunc* func) { + int overrun; + switch (upb_EpsCopyInputStream_IsDoneStatus(e, *ptr, &overrun)) { + case kUpb_IsDoneStatus_Done: + return true; + case kUpb_IsDoneStatus_NotDone: + return false; + case kUpb_IsDoneStatus_NeedFallback: + *ptr = func(e, *ptr, overrun); + return *ptr == NULL; + } +} + +// Returns the total number of bytes that are safe to read from the current +// buffer without reading uninitialized or unallocated memory. +// +// Note that this check does not respect any semantic limits on the stream, +// either limits from PushLimit() or the overall stream end, so some of these +// bytes may have unpredictable, nonsense values in them. The guarantee is only +// that the bytes are valid to read from the perspective of the C language +// (ie. you can read without triggering UBSAN or ASAN). +UPB_INLINE size_t upb_EpsCopyInputStream_BytesAvailable( + upb_EpsCopyInputStream* e, const char* ptr) { + return (e->end - ptr) + kUpb_EpsCopyInputStream_SlopBytes; +} + +// Returns true if the given delimited field size is valid (it does not extend +// beyond any previously-pushed limits). `ptr` should point to the beginning +// of the field data, after the delimited size. +// +// Note that this does *not* guarantee that all of the data for this field is in +// the current buffer. +UPB_INLINE bool upb_EpsCopyInputStream_CheckSize( + const upb_EpsCopyInputStream* e, const char* ptr, int size) { + UPB_ASSERT(size >= 0); + return ptr - e->end + size <= e->limit; +} + +UPB_INLINE bool _upb_EpsCopyInputStream_CheckSizeAvailable( + upb_EpsCopyInputStream* e, const char* ptr, int size, bool submessage) { + // This is one extra branch compared to the more normal: + // return (size_t)(end - ptr) < size; + // However it is one less computation if we are just about to use "ptr + len": + // https://godbolt.org/z/35YGPz + // In microbenchmarks this shows a small improvement. + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)e->limit_ptr; + uintptr_t res = uptr + (size_t)size; + if (!submessage) uend += kUpb_EpsCopyInputStream_SlopBytes; + // NOTE: this check depends on having a linear address space. This is not + // technically guaranteed by uintptr_t. + bool ret = res >= uptr && res <= uend; + if (size < 0) UPB_ASSERT(!ret); + return ret; +} + +// Returns true if the given delimited field size is valid (it does not extend +// beyond any previously-pushed limited) *and* all of the data for this field is +// available to be read in the current buffer. +// +// If the size is negative, this function will always return false. This +// property can be useful in some cases. +UPB_INLINE bool upb_EpsCopyInputStream_CheckDataSizeAvailable( + upb_EpsCopyInputStream* e, const char* ptr, int size) { + return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, false); +} + +// Returns true if the given sub-message size is valid (it does not extend +// beyond any previously-pushed limited) *and* all of the data for this +// sub-message is available to be parsed in the current buffer. +// +// This implies that all fields from the sub-message can be parsed from the +// current buffer while maintaining the invariant that we always have at least +// kUpb_EpsCopyInputStream_SlopBytes of data available past the beginning of +// any individual field start. +// +// If the size is negative, this function will always return false. This +// property can be useful in some cases. +UPB_INLINE bool upb_EpsCopyInputStream_CheckSubMessageSizeAvailable( + upb_EpsCopyInputStream* e, const char* ptr, int size) { + return _upb_EpsCopyInputStream_CheckSizeAvailable(e, ptr, size, true); +} + +UPB_INLINE void _upb_EpsCopyInputStream_CheckLimit(upb_EpsCopyInputStream* e) { + UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); +} + +// Pushes a limit onto the stack of limits for the current stream. The limit +// will extend for `size` bytes beyond the position in `ptr`. Future calls to +// upb_EpsCopyInputStream_IsDone() will return `true` when the stream position +// reaches this limit. +// +// Returns a delta that the caller must store and supply to PopLimit() below. +UPB_INLINE int upb_EpsCopyInputStream_PushLimit(upb_EpsCopyInputStream* e, + const char* ptr, int size) { + int limit = size + (int)(ptr - e->end); + int delta = e->limit - limit; + _upb_EpsCopyInputStream_CheckLimit(e); + e->limit = limit; + e->limit_ptr = e->end + UPB_MIN(0, limit); + _upb_EpsCopyInputStream_CheckLimit(e); + return delta; +} + +// Pops the last limit that was pushed on this stream. This may only be called +// once IsDone() returns true. The user must pass the delta that was returned +// from PushLimit(). +UPB_INLINE void upb_EpsCopyInputStream_PopLimit(upb_EpsCopyInputStream* e, + const char* ptr, + int saved_delta) { + UPB_ASSERT(ptr - e->end == e->limit); + _upb_EpsCopyInputStream_CheckLimit(e); + e->limit += saved_delta; + e->limit_ptr = e->end + UPB_MIN(0, e->limit); + _upb_EpsCopyInputStream_CheckLimit(e); +} + +UPB_INLINE const char* _upb_EpsCopyInputStream_IsDoneFallbackInline( + upb_EpsCopyInputStream* e, const char* ptr, int overrun, + upb_EpsCopyInputStream_BufferFlipCallback* callback) { + if (overrun < e->limit) { + // Need to copy remaining data into patch buffer. + UPB_ASSERT(overrun < kUpb_EpsCopyInputStream_SlopBytes); + const char* old_end = ptr; + const char* new_start = &e->patch[0] + overrun; + memset(e->patch + kUpb_EpsCopyInputStream_SlopBytes, 0, + kUpb_EpsCopyInputStream_SlopBytes); + memcpy(e->patch, e->end, kUpb_EpsCopyInputStream_SlopBytes); + ptr = new_start; + e->end = &e->patch[kUpb_EpsCopyInputStream_SlopBytes]; + e->limit -= kUpb_EpsCopyInputStream_SlopBytes; + e->limit_ptr = e->end + e->limit; + UPB_ASSERT(ptr < e->limit_ptr); + return callback(e, old_end, new_start); + } else { + return callback(e, NULL, NULL); + } +} + +typedef const char* upb_EpsCopyInputStream_ParseDelimitedFunc( + upb_EpsCopyInputStream* e, const char* ptr, void* ctx); + +// Tries to perform a fast-path handling of the given delimited message data. +// If the sub-message beginning at `*ptr` and extending for `len` is short and +// fits within this buffer, calls `func` with `ctx` as a parameter, where the +// pushing and popping of limits is handled automatically and with lower cost +// than the normal PushLimit()/PopLimit() sequence. +static UPB_FORCEINLINE bool upb_EpsCopyInputStream_TryParseDelimitedFast( + upb_EpsCopyInputStream* e, const char** ptr, int len, + upb_EpsCopyInputStream_ParseDelimitedFunc* func, void* ctx) { + if (!upb_EpsCopyInputStream_CheckSubMessageSizeAvailable(e, *ptr, len)) { + return false; + } + + // Fast case: Sub-message is <128 bytes and fits in the current buffer. + // This means we can preserve limit/limit_ptr verbatim. + const char* saved_limit_ptr = e->limit_ptr; + int saved_limit = e->limit; + e->limit_ptr = *ptr + len; + e->limit = e->limit_ptr - e->end; + UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); + *ptr = func(e, *ptr, ctx); + e->limit_ptr = saved_limit_ptr; + e->limit = saved_limit; + UPB_ASSERT(e->limit_ptr == e->end + UPB_MIN(0, e->limit)); + return true; +} + + +#endif // UPB_WIRE_EPS_COPY_INPUT_STREAM_H_ #include "utf8_range.h" // Must be last. @@ -8748,18 +8992,14 @@ enum { #define DECODE_NOGROUP (uint32_t) - 1 typedef struct upb_Decoder { - const char* end; /* Can read up to 16 bytes slop beyond this. */ - const char* limit_ptr; /* = end + UPB_MIN(limit, 0) */ - upb_Message* unknown_msg; /* Used for preserving unknown data. */ - const char* unknown; /* Start of unknown data, preserve at buffer flip. */ - const upb_ExtensionRegistry* - extreg; /* For looking up extensions during the parse. */ - int limit; /* Submessage limit relative to end. */ - int depth; /* Tracks recursion depth to bound stack usage. */ - uint32_t end_group; /* field number of END_GROUP tag, else DECODE_NOGROUP */ + upb_EpsCopyInputStream input; + const upb_ExtensionRegistry* extreg; + const char* unknown; // Start of unknown data, preserve at buffer flip + upb_Message* unknown_msg; // Pointer to preserve data to + int depth; // Tracks recursion depth to bound stack usage. + uint32_t end_group; // field number of END_GROUP tag, else DECODE_NOGROUP. uint16_t options; bool missing_required; - char patch[32]; upb_Arena arena; jmp_buf err; @@ -8818,49 +9058,29 @@ UPB_INLINE const upb_MiniTable* decode_totablep(intptr_t table) { return (const upb_MiniTable*)(table >> 8); } -UPB_INLINE -const char* _upb_Decoder_IsDoneFallbackInline(upb_Decoder* d, const char* ptr, - int overrun, int* status) { - if (overrun < d->limit) { - /* Need to copy remaining data into patch buffer. */ - UPB_ASSERT(overrun < 16); - if (d->unknown) { - if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, ptr - d->unknown, - &d->arena)) { - *status = kUpb_DecodeStatus_OutOfMemory; - return NULL; - } - d->unknown = &d->patch[0] + overrun; - } - memset(d->patch + 16, 0, 16); - memcpy(d->patch, d->end, 16); - ptr = &d->patch[0] + overrun; - d->end = &d->patch[16]; - d->limit -= 16; - d->limit_ptr = d->end + d->limit; - d->options &= ~kUpb_DecodeOption_AliasString; - UPB_ASSERT(ptr < d->limit_ptr); - return ptr; - } else { - *status = kUpb_DecodeStatus_Malformed; - return NULL; - } +const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, + const char* ptr, int overrun); + +UPB_INLINE bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { + return upb_EpsCopyInputStream_IsDone(&d->input, ptr, + &_upb_Decoder_IsDoneFallback); } -const char* _upb_Decoder_IsDoneFallback(upb_Decoder* d, const char* ptr, - int overrun); +UPB_INLINE const char* _upb_Decoder_BufferFlipCallback( + upb_EpsCopyInputStream* e, const char* old_end, const char* new_start) { + upb_Decoder* d = (upb_Decoder*)e; + if (!old_end) _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_Malformed); -UPB_INLINE -bool _upb_Decoder_IsDone(upb_Decoder* d, const char** ptr) { - int overrun = *ptr - d->end; - if (UPB_LIKELY(*ptr < d->limit_ptr)) { - return false; - } else if (UPB_LIKELY(overrun == d->limit)) { - return true; - } else { - *ptr = _upb_Decoder_IsDoneFallback(d, *ptr, overrun); - return false; + if (d->unknown) { + if (!_upb_Message_AddUnknown(d->unknown_msg, d->unknown, + old_end - d->unknown, &d->arena)) { + _upb_FastDecoder_ErrorJmp(d, kUpb_DecodeStatus_OutOfMemory); + } + d->unknown = new_start; } + + d->options &= ~kUpb_DecodeOption_AliasString; + return new_start; } #if UPB_FASTTABLE @@ -8886,30 +9106,6 @@ UPB_INLINE uint32_t _upb_FastDecoder_LoadTag(const char* ptr) { return tag; } -UPB_INLINE void _upb_Decoder_CheckLimit(upb_Decoder* d) { - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); -} - -UPB_INLINE int _upb_Decoder_PushLimit(upb_Decoder* d, const char* ptr, - int size) { - int limit = size + (int)(ptr - d->end); - int delta = d->limit - limit; - _upb_Decoder_CheckLimit(d); - d->limit = limit; - d->limit_ptr = d->end + UPB_MIN(0, limit); - _upb_Decoder_CheckLimit(d); - return delta; -} - -UPB_INLINE void _upb_Decoder_PopLimit(upb_Decoder* d, const char* ptr, - int saved_delta) { - UPB_ASSERT(ptr - d->end == d->limit); - _upb_Decoder_CheckLimit(d); - d->limit += saved_delta; - d->limit_ptr = d->end + UPB_MIN(0, d->limit); - _upb_Decoder_CheckLimit(d); -} - #endif /* UPB_WIRE_DECODE_INTERNAL_H_ */ From f6f6af5472a7d0c8b3c9cdd5ebb5add23e6bd9f3 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 12 Dec 2022 15:09:48 -0800 Subject: [PATCH 03/43] Internal change COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/11257 from Neakxs:apply-registration-for-protocel-extensions 8d04626e85c44ca8ba812c8ccb12585b92cb6d6d PiperOrigin-RevId: 494841129 --- docs/options.md | 5 + docs/third_party.md | 201 +++++++++--------- .../protobuf/pyext/proto2_api_test.proto | 40 ---- 3 files changed, 102 insertions(+), 144 deletions(-) delete mode 100644 python/google/protobuf/pyext/proto2_api_test.proto diff --git a/docs/options.md b/docs/options.md index 0dbd2def5b25..32cfd80e9478 100644 --- a/docs/options.md +++ b/docs/options.md @@ -451,3 +451,8 @@ with info about your project (name and website) so we can add an entry for you. * Website: http://connect.build/ * Extension: 1167-1176 + +1. protocel + + * Website: https://github.com/Neakxs/protocel + * Extension: 1177-1178 diff --git a/docs/third_party.md b/docs/third_party.md index d9ff970227a0..267d9c9be472 100644 --- a/docs/third_party.md +++ b/docs/third_party.md @@ -7,110 +7,103 @@ If you have a project that should be listed here, please ## Programming Languages -These are projects we know about implementing Protocol Buffers for other programming languages: -* Action Script: https://code.google.com/p/protobuf-actionscript3/ -* Action Script: https://code.google.com/p/protoc-gen-as3/ -* Action Script: https://github.com/matrix3d/JProtoc -* Action Script: https://github.com/zhongfq/protobuf-as3/ -* Ada: https://github.com/reznikmm/protobuf -* C: https://github.com/protobuf-c/protobuf-c -* C: https://koti.kapsi.fi/jpa/nanopb/ -* C: https://github.com/cloudwu/pbc/ -* C: https://github.com/haberman/upb/wiki -* C: https://github.com/squidfunk/protobluff -* C: https://github.com/eerimoq/pbtools -* C++: https://github.com/protocolbuffers/protobuf (Google-official implementation) -* C++: https://EmbeddedProto.com -* C/C++: http://spbc.sf.net/ -* C#: https://code.google.com/p/protobuf-csharp-port -* C#: https://silentorbit.com/protobuf/ -* C#/.NET/WCF/VB: https://code.google.com/p/protobuf-net/ -* Clojure: http://github.com/ninjudd/clojure-protobuf -* Clojure: https://github.com/clojusc/protobuf -* Clojure: https://protojure.readthedocs.io -* Common Lisp: http://github.com/brown/protobuf -* Common Lisp: http://github.com/qitab/cl-protobuf -* D: https://github.com/dcarp/protobuf-d -* D: https://github.com/msoucy/dproto -* D: https://github.com/opticron/ProtocolBuffer -* Dart: https://github.com/dart-lang/dart-protobuf (runtime) https://github.com/dart-lang/dart-protoc-plugin (code generator) -* Delphi: http://sourceforge.net/projects/protobuf-delphi/ -* Delphi: http://fundementals.sourceforge.net/dl.html -* Elixir: https://github.com/jeremyong/exprotoc -* Elixir: https://github.com/tony612/protobuf-elixir -* Elixir: https://github.com/ahamez/protox -* Elm: https://github.com/tiziano88/elm-protobuf -* Erlang: https://github.com/tomas-abrahamsson/gpb -* Erlang: http://piqi.org/ -* Erlang: https://github.com/basho/erlang_protobuffs (no longer maintained, use gpb instead) -* Hacklang/HHVM: https://github.com/y3llowcake/proto-hack -* GDScript: https://github.com/oniksan/godobuf (Godot v3 engine plugin) -* Go: https://github.com/golang/protobuf (Google-official implementation) -* Go: https://github.com/akunspy/gopbuf -* Go: https://github.com/gogo/protobuf -* GopherJS: https://github.com/johanbrandhorst/protobuf -* Haskell: https://hackage.haskell.org/package/hprotoc -* Haskell: https://github.com/google/proto-lens (Google-unofficial implementation) -* Haskell: https://github.com/awakesecurity/proto3-suite (code generator) https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer) -* Haxe: https://github.com/Atry/protoc-gen-haxe -* Java: https://github.com/protocolbuffers/protobuf (Google-official implementation) -* Java/Android: https://github.com/square/wire -* Java: https://github.com/HebiRobotics/QuickBuffers/ -* Java ME: https://code.google.com/p/protobuf-javame/ -* Java ME: http://swingme.sourceforge.net/encode.shtml -* Javascript: https://code.google.com/p/protobuf-js/ -* Javascript: http://github.com/sirikata/protojs -* Javascript: https://github.com/dcodeIO/ProtoBuf.js -* Javascript: https://code.google.com/p/protobuf-for-node/ -* Javascript: https://code.google.com/p/protostuff/ -* Javascript: https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h) -* Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port of the Google-official implementation) -* Javascript: https://github.com/ButterCam/sisyphus-js -* Julia: https://github.com/tanmaykm/ProtoBuf.jl -* Kotlin: https://github.com/marcoferrer/kroto-plus -* Kotlin: https://github.com/Kotlin/kotlinx.serialization -* Kotlin: https://github.com/ButterCam/sisyphus -* Kotlin: https://github.com/open-toast/protokt -* Kotlin Multiplatform: https://github.com/streem/pbandk -* Lua: https://code.google.com/p/protoc-gen-lua/ -* Lua: http://github.com/indygreg/lua-protobuf -* Lua: https://github.com/Neopallium/lua-pb -* Matlab: https://code.google.com/p/protobuf-matlab/ -* Mercury: https://code.google.com/p/protobuf-mercury/ -* Objective C: https://code.google.com/p/protobuf-objc/ -* Objective C: https://github.com/alexeyxo/protobuf-objc -* OCaml: http://piqi.org/ -* Perl: http://groups.google.com/group/protobuf-perl -* Perl: https://metacpan.org/pod/Google::ProtocolBuffers -* Perl: https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic -* Perl/XS: https://code.google.com/p/protobuf-perlxs/ -* PHP: https://code.google.com/p/pb4php/ -* PHP: https://github.com/allegro/php-protobuf/ -* PHP: https://github.com/chobie/php-protocolbuffers -* Prolog: http://www.swi-prolog.org/pldoc/package/protobufs.html -* Purescript: https://github.com/xc-jp/purescript-protobuf -* Python: https://github.com/protocolbuffers/protobuf (Google-official implementation) -* Python: https://github.com/eigenein/protobuf -* Python: https://github.com/danielgtaylor/python-betterproto -* R: http://cran.r-project.org/package=RProtoBuf -* Ruby: https://code.google.com/p/ruby-protobuf/ -* Ruby: http://github.com/mozy/ruby-protocol-buffers -* Ruby: https://github.com/bmizerany/beefcake/tree/master/lib/beefcake -* Ruby: https://github.com/localshred/protobuf -* Rust: https://github.com/tokio-rs/prost -* Rust: https://github.com/stepancheg/rust-protobuf/ -* Rust: https://github.com/tafia/quick-protobuf -* Scala: http://github.com/jeffplaisance/scala-protobuf -* Scala: https://code.google.com/p/protobuf-scala -* Scala: https://github.com/SandroGrzicic/ScalaBuff -* Scala: https://scalapb.github.io -* Solidity: https://github.com/celer-network/pb3-gen-sol -* Swift: https://github.com/alexeyxo/protobuf-swift -* Swift: https://github.com/apple/swift-protobuf/ -* Typescript: https://github.com/thesayyn/protoc-gen-ts -* Typescript: https://github.com/pbkit/pbkit -* Vala: https://launchpad.net/protobuf-vala -* Visual Basic: https://code.google.com/p/protobuf-net/ +These are projects we know about implementing Protocol Buffers for other +programming languages: * Action Script: +https://code.google.com/p/protobuf-actionscript3/ * Action Script: +https://code.google.com/p/protoc-gen-as3/ * Action Script: +https://github.com/matrix3d/JProtoc * Action Script: +https://github.com/zhongfq/protobuf-as3/ * Ada: +https://github.com/reznikmm/protobuf * C: +https://github.com/protobuf-c/protobuf-c * C: https://koti.kapsi.fi/jpa/nanopb/ +* C: https://github.com/cloudwu/pbc/ * C: https://github.com/haberman/upb/wiki * +C: https://github.com/squidfunk/protobluff * C: +https://github.com/eerimoq/pbtools * C++: +https://github.com/protocolbuffers/protobuf (Google-official implementation) * +C++: https://github.com/yksten/struct2x * C++: https://EmbeddedProto.com * +C/C++: http://spbc.sf.net/ * C#: https://code.google.com/p/protobuf-csharp-port +* C#: https://silentorbit.com/protobuf/ * C#/.NET/WCF/VB: +https://code.google.com/p/protobuf-net/ * Clojure: +http://github.com/ninjudd/clojure-protobuf * Clojure: +https://github.com/clojusc/protobuf * Clojure: https://protojure.readthedocs.io +* Common Lisp: http://github.com/brown/protobuf * Common Lisp: +http://github.com/qitab/cl-protobuf * D: https://github.com/dcarp/protobuf-d * +D: https://github.com/msoucy/dproto * D: +https://github.com/opticron/ProtocolBuffer * Dart: +https://github.com/dart-lang/dart-protobuf (runtime) +https://github.com/dart-lang/dart-protoc-plugin (code generator) * Delphi: +http://sourceforge.net/projects/protobuf-delphi/ * Delphi: +http://fundementals.sourceforge.net/dl.html * Elixir: +https://github.com/jeremyong/exprotoc * Elixir: +https://github.com/tony612/protobuf-elixir * Elixir: +https://github.com/ahamez/protox * Elm: +https://github.com/tiziano88/elm-protobuf * Erlang: +https://github.com/tomas-abrahamsson/gpb * Erlang: http://piqi.org/ * Erlang: +https://github.com/basho/erlang_protobuffs (no longer maintained, use gpb +instead) * Hacklang/HHVM: https://github.com/y3llowcake/proto-hack * GDScript: +https://github.com/oniksan/godobuf (Godot v3 engine plugin) * Go: +https://github.com/golang/protobuf (Google-official implementation) * Go: +https://github.com/akunspy/gopbuf * Go: https://github.com/gogo/protobuf * +GopherJS: https://github.com/johanbrandhorst/protobuf * Haskell: +https://hackage.haskell.org/package/hprotoc * Haskell: +https://github.com/google/proto-lens (Google-unofficial implementation) * +Haskell: https://github.com/awakesecurity/proto3-suite (code generator) +https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer) * +Haxe: https://github.com/Atry/protoc-gen-haxe * Java: +https://github.com/protocolbuffers/protobuf (Google-official implementation) * +Java/Android: https://github.com/square/wire * Java: +https://github.com/HebiRobotics/QuickBuffers/ * Java ME: +https://code.google.com/p/protobuf-javame/ * Java ME: +http://swingme.sourceforge.net/encode.shtml * Javascript: +https://code.google.com/p/protobuf-js/ * Javascript: +http://github.com/sirikata/protojs * Javascript: +https://github.com/dcodeIO/ProtoBuf.js * Javascript: +https://code.google.com/p/protobuf-for-node/ * Javascript: +https://code.google.com/p/protostuff/ * Javascript: +https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h) * +Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port +of the Google-official implementation) * Javascript: +https://github.com/ButterCam/sisyphus-js * Julia: +https://github.com/tanmaykm/ProtoBuf.jl * Kotlin: +https://github.com/marcoferrer/kroto-plus * Kotlin: +https://github.com/Kotlin/kotlinx.serialization * Kotlin: +https://github.com/ButterCam/sisyphus * Kotlin: +https://github.com/open-toast/protokt * Kotlin Multiplatform: +https://github.com/streem/pbandk * Lua: +https://code.google.com/p/protoc-gen-lua/ * Lua: +http://github.com/indygreg/lua-protobuf * Lua: +https://github.com/Neopallium/lua-pb * Matlab: +https://code.google.com/p/protobuf-matlab/ * Mercury: +https://code.google.com/p/protobuf-mercury/ * Objective C: +https://code.google.com/p/protobuf-objc/ * Objective C: +https://github.com/alexeyxo/protobuf-objc * OCaml: http://piqi.org/ * Perl: +http://groups.google.com/group/protobuf-perl * Perl: +https://metacpan.org/pod/Google::ProtocolBuffers * Perl: +https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic * Perl/XS: +https://code.google.com/p/protobuf-perlxs/ * PHP: +https://code.google.com/p/pb4php/ * PHP: +https://github.com/allegro/php-protobuf/ * PHP: +https://github.com/chobie/php-protocolbuffers * Prolog: +http://www.swi-prolog.org/pldoc/package/protobufs.html * Purescript: +https://github.com/xc-jp/purescript-protobuf * Python: +https://github.com/protocolbuffers/protobuf (Google-official implementation) * +Python: https://github.com/eigenein/protobuf * Python: +https://github.com/danielgtaylor/python-betterproto * R: +http://cran.r-project.org/package=RProtoBuf * Ruby: +https://code.google.com/p/ruby-protobuf/ * Ruby: +http://github.com/mozy/ruby-protocol-buffers * Ruby: +https://github.com/bmizerany/beefcake/tree/master/lib/beefcake * Ruby: +https://github.com/localshred/protobuf * Rust: https://github.com/tokio-rs/prost +* Rust: https://github.com/stepancheg/rust-protobuf/ * Rust: +https://github.com/tafia/quick-protobuf * Scala: +http://github.com/jeffplaisance/scala-protobuf * Scala: +https://code.google.com/p/protobuf-scala * Scala: +https://github.com/SandroGrzicic/ScalaBuff * Scala: https://scalapb.github.io * +Solidity: https://github.com/celer-network/pb3-gen-sol * Swift: +https://github.com/alexeyxo/protobuf-swift * Swift: +https://github.com/apple/swift-protobuf/ * Typescript: +https://github.com/thesayyn/protoc-gen-ts * Typescript: +https://github.com/pbkit/pbkit * Vala: https://launchpad.net/protobuf-vala * +Visual Basic: https://code.google.com/p/protobuf-net/ ## RPC Implementations diff --git a/python/google/protobuf/pyext/proto2_api_test.proto b/python/google/protobuf/pyext/proto2_api_test.proto deleted file mode 100644 index 1fd78e840200..000000000000 --- a/python/google/protobuf/pyext/proto2_api_test.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; - -package google.protobuf.python.internal; - -import "google/protobuf/internal/cpp/proto1_api_test.proto"; - -message TestNestedProto1APIMessage { - optional int32 a = 1; - optional TestMessage.NestedMessage b = 2; -} From 0ef2e548ad7bc60de77f7422f4d60b74c05472e8 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 12 Dec 2022 15:43:50 -0800 Subject: [PATCH 04/43] Internal Change PiperOrigin-RevId: 494849648 --- kokoro/release/collect_all_artifacts.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/kokoro/release/collect_all_artifacts.sh b/kokoro/release/collect_all_artifacts.sh index 20c6d8d78518..f6f237195fb0 100755 --- a/kokoro/release/collect_all_artifacts.sh +++ b/kokoro/release/collect_all_artifacts.sh @@ -6,6 +6,7 @@ set -ex cd $(dirname $0)/../.. # Initialize any submodules. +git config --global --add safe.directory ${KOKORO_GFILE_DIR}/github/protobuf git submodule update --init --recursive # The directory with all resulting artifacts From 3cdee9a70cc18c901a6f8ab557a56baa55ad8adc Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 12 Dec 2022 15:59:28 -0800 Subject: [PATCH 05/43] Internal changes PiperOrigin-RevId: 494853699 --- src/google/protobuf/arena.cc | 45 ++-- src/google/protobuf/arena.h | 4 +- src/google/protobuf/arena_align.h | 8 +- src/google/protobuf/arena_cleanup.h | 9 +- src/google/protobuf/arena_impl.h | 20 +- src/google/protobuf/arena_test_util.cc | 2 +- src/google/protobuf/arena_test_util.h | 6 +- src/google/protobuf/arena_unittest.cc | 4 +- src/google/protobuf/arenastring.cc | 6 +- src/google/protobuf/arenastring.h | 8 +- src/google/protobuf/arenastring_unittest.cc | 2 +- src/google/protobuf/arenaz_sampler_test.cc | 4 +- src/google/protobuf/descriptor.cc | 139 ++++++------ src/google/protobuf/descriptor.h | 13 +- src/google/protobuf/descriptor_database.cc | 64 +++--- src/google/protobuf/descriptor_database.h | 2 +- .../protobuf/descriptor_database_unittest.cc | 1 - src/google/protobuf/descriptor_unittest.cc | 19 +- src/google/protobuf/dynamic_message.cc | 4 +- src/google/protobuf/dynamic_message.h | 8 +- .../protobuf/dynamic_message_unittest.cc | 1 - src/google/protobuf/explicitly_constructed.h | 3 +- src/google/protobuf/extension_set.cc | 198 +++++++++--------- src/google/protobuf/extension_set.h | 12 +- src/google/protobuf/extension_set_heavy.cc | 32 +-- src/google/protobuf/extension_set_inl.h | 2 +- src/google/protobuf/extension_set_unittest.cc | 1 - .../protobuf/generated_message_bases.cc | 2 +- .../protobuf/generated_message_reflection.cc | 178 ++++++++-------- .../protobuf/generated_message_reflection.h | 18 +- .../generated_message_reflection_unittest.cc | 4 +- .../protobuf/generated_message_tctable_gen.cc | 24 +-- .../protobuf/generated_message_tctable_impl.h | 2 +- .../generated_message_tctable_lite.cc | 38 ++-- .../generated_message_tctable_lite_test.cc | 2 +- src/google/protobuf/generated_message_util.cc | 8 +- src/google/protobuf/inlined_string_field.h | 2 +- .../protobuf/inlined_string_field_unittest.cc | 2 +- src/google/protobuf/lazy_field_lite.cc | 9 +- src/google/protobuf/lite_unittest.cc | 2 +- src/google/protobuf/map.h | 44 ++-- src/google/protobuf/map_field.cc | 12 +- src/google/protobuf/map_field.h | 43 ++-- src/google/protobuf/map_field_inl.h | 4 +- src/google/protobuf/map_field_lite.h | 2 +- src/google/protobuf/map_field_test.cc | 2 +- src/google/protobuf/map_test.inc | 29 +-- src/google/protobuf/map_test_util_impl.h | 1 - src/google/protobuf/message.cc | 42 ++-- src/google/protobuf/message.h | 14 +- src/google/protobuf/message_lite.cc | 45 ++-- src/google/protobuf/message_lite.h | 10 +- src/google/protobuf/message_unittest.inc | 8 +- src/google/protobuf/no_field_presence_test.cc | 8 +- src/google/protobuf/parse_context.cc | 30 +-- src/google/protobuf/port_def.inc | 10 +- src/google/protobuf/proto3_arena_unittest.cc | 8 +- src/google/protobuf/reflection_internal.h | 6 +- src/google/protobuf/reflection_ops.cc | 18 +- .../protobuf/reflection_ops_unittest.cc | 1 - src/google/protobuf/reflection_tester.cc | 4 +- src/google/protobuf/repeated_field.cc | 1 + src/google/protobuf/repeated_field.h | 52 ++--- .../repeated_field_reflection_unittest.cc | 4 +- .../protobuf/repeated_field_unittest.cc | 8 +- src/google/protobuf/repeated_ptr_field.cc | 14 +- src/google/protobuf/repeated_ptr_field.h | 100 ++++----- src/google/protobuf/test_util.h | 2 +- src/google/protobuf/test_util.inc | 4 +- src/google/protobuf/test_util2.h | 4 +- src/google/protobuf/test_util_lite.cc | 1 - src/google/protobuf/text_format.cc | 61 +++--- src/google/protobuf/text_format_unittest.cc | 6 +- src/google/protobuf/unknown_field_set.cc | 4 +- src/google/protobuf/unknown_field_set.h | 4 +- .../protobuf/unknown_field_set_unittest.cc | 1 - src/google/protobuf/wire_format.cc | 27 +-- src/google/protobuf/wire_format.h | 2 +- src/google/protobuf/wire_format_lite.cc | 11 +- src/google/protobuf/wire_format_lite.h | 8 +- src/google/protobuf/wire_format_unittest.inc | 4 +- 81 files changed, 797 insertions(+), 770 deletions(-) diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index 8479f5dd0062..99f247fd823f 100644 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -93,8 +93,8 @@ static SerialArena::Memory AllocateMemory(const AllocationPolicy* policy_ptr, size = policy.start_block_size; } // Verify that min_bytes + kBlockHeaderSize won't overflow. - GOOGLE_CHECK_LE(min_bytes, - std::numeric_limits::max() - SerialArena::kBlockHeaderSize); + GOOGLE_ABSL_CHECK_LE(min_bytes, std::numeric_limits::max() - + SerialArena::kBlockHeaderSize); size = std::max(size, SerialArena::kBlockHeaderSize + min_bytes); void* mem; @@ -139,7 +139,7 @@ SerialArena::SerialArena(ArenaBlock* b, ThreadSafeArena& parent) head_{b}, space_allocated_{b->size}, parent_{parent} { - GOOGLE_DCHECK(!b->IsSentry()); + GOOGLE_ABSL_DCHECK(!b->IsSentry()); } // It is guaranteed that this is the first SerialArena. Use sentry block. @@ -168,7 +168,8 @@ void SerialArena::Init(ArenaBlock* b, size_t offset) { } SerialArena* SerialArena::New(Memory mem, ThreadSafeArena& parent) { - GOOGLE_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize, mem.size); + GOOGLE_ABSL_DCHECK_LE(kBlockHeaderSize + ThreadSafeArena::kSerialArenaSize, + mem.size); ThreadSafeArenaStats::RecordAllocateStats(parent.arena_stats_.MutableStats(), /*used=*/0, /*allocated=*/mem.size, /*wasted=*/0); @@ -277,7 +278,7 @@ void SerialArena::CleanupList() { do { char* limit = b->Limit(); char* it = reinterpret_cast(b->cleanup_nodes); - GOOGLE_DCHECK(!b->IsSentry() || it == limit); + GOOGLE_ABSL_DCHECK(!b->IsSentry() || it == limit); while (it < limit) { it += cleanup::DestroyNode(it); } @@ -350,7 +351,7 @@ class ThreadSafeArena::SerialArenaChunk { return Layout(capacity()).Slice(ptr()).first(safe_size()); } std::atomic& id(uint32_t i) { - GOOGLE_DCHECK_LT(i, capacity()); + GOOGLE_ABSL_DCHECK_LT(i, capacity()); return Layout(capacity()).Pointer(ptr())[i]; } @@ -362,11 +363,11 @@ class ThreadSafeArena::SerialArenaChunk { return Layout(capacity()).Slice(ptr()).first(safe_size()); } const std::atomic& arena(uint32_t i) const { - GOOGLE_DCHECK_LT(i, capacity()); + GOOGLE_ABSL_DCHECK_LT(i, capacity()); return Layout(capacity()).Pointer(ptr())[i]; } std::atomic& arena(uint32_t i) { - GOOGLE_DCHECK_LT(i, capacity()); + GOOGLE_ABSL_DCHECK_LT(i, capacity()); return Layout(capacity()).Pointer(ptr())[i]; } @@ -473,7 +474,7 @@ ThreadSafeArena::ThreadSafeArena(void* mem, size_t size, } ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size) { - GOOGLE_DCHECK_EQ(reinterpret_cast(buf) & 7, 0u); + GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast(buf) & 7, 0u); if (buf == nullptr || size <= kBlockHeaderSize) { return SentryArenaBlock(); } @@ -486,7 +487,7 @@ ArenaBlock* ThreadSafeArena::FirstBlock(void* buf, size_t size, const AllocationPolicy& policy) { if (policy.IsDefault()) return FirstBlock(buf, size); - GOOGLE_DCHECK_EQ(reinterpret_cast(buf) & 7, 0u); + GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast(buf) & 7, 0u); SerialArena::Memory mem; if (buf == nullptr || size < kBlockHeaderSize + kAllocPolicySize) { @@ -508,26 +509,26 @@ void ThreadSafeArena::InitializeWithPolicy(const AllocationPolicy& policy) { #ifndef NDEBUG const uint64_t old_alloc_policy = alloc_policy_.get_raw(); // If there was a policy (e.g., in Reset()), make sure flags were preserved. -#define GOOGLE_DCHECK_POLICY_FLAGS_() \ - if (old_alloc_policy > 3) \ - GOOGLE_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3) +#define GOOGLE_ABSL_DCHECK_POLICY_FLAGS_() \ + if (old_alloc_policy > 3) \ + GOOGLE_ABSL_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3) #else -#define GOOGLE_DCHECK_POLICY_FLAGS_() +#define GOOGLE_ABSL_DCHECK_POLICY_FLAGS_() #endif // NDEBUG // We ensured enough space so this cannot fail. void* p; if (!first_arena_.MaybeAllocateAligned(kAllocPolicySize, &p)) { - GOOGLE_LOG(FATAL) << "MaybeAllocateAligned cannot fail here."; + GOOGLE_ABSL_LOG(FATAL) << "MaybeAllocateAligned cannot fail here."; return; } new (p) AllocationPolicy{policy}; // Low bits store flags, so they mustn't be overwritten. - GOOGLE_DCHECK_EQ(0, reinterpret_cast(p) & 3); + GOOGLE_ABSL_DCHECK_EQ(0, reinterpret_cast(p) & 3); alloc_policy_.set_policy(reinterpret_cast(p)); - GOOGLE_DCHECK_POLICY_FLAGS_(); + GOOGLE_ABSL_DCHECK_POLICY_FLAGS_(); -#undef GOOGLE_DCHECK_POLICY_FLAGS_ +#undef GOOGLE_ABSL_DCHECK_POLICY_FLAGS_ } uint64_t ThreadSafeArena::GetNextLifeCycleId() { @@ -647,10 +648,10 @@ SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) { // necessary to Free and we should revisit this. (b/247560530) for (auto it = span.rbegin(); it != span.rend(); ++it) { SerialArena* serial = it->load(std::memory_order_relaxed); - GOOGLE_DCHECK_NE(serial, nullptr); + GOOGLE_ABSL_DCHECK_NE(serial, nullptr); // Always frees the first block of "serial" as it cannot be user-provided. SerialArena::Memory mem = serial->Free(deallocator); - GOOGLE_DCHECK_NE(mem.ptr, nullptr); + GOOGLE_ABSL_DCHECK_NE(mem.ptr, nullptr); deallocator(mem); } @@ -794,7 +795,7 @@ void ThreadSafeArena::CleanupList() { // and required not to break inter-object dependencies. (b/247560530) for (auto it = span.rbegin(); it != span.rend(); ++it) { SerialArena* serial = it->load(std::memory_order_relaxed); - GOOGLE_DCHECK_NE(serial, nullptr); + GOOGLE_ABSL_DCHECK_NE(serial, nullptr); serial->CleanupList(); } }); @@ -817,7 +818,7 @@ SerialArena* ThreadSafeArena::GetSerialArenaFallback(size_t n) { for (uint32_t i = 0; i < ids.size(); ++i) { if (ids[i].load(std::memory_order_relaxed) == id) { serial = chunk->arena(i).load(std::memory_order_relaxed); - GOOGLE_DCHECK_NE(serial, nullptr); + GOOGLE_ABSL_DCHECK_NE(serial, nullptr); break; } } diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index d17f63f756dc..29c5a106f528 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -316,7 +316,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { "CreateArray requires a trivially constructible type"); static_assert(std::is_trivially_destructible::value, "CreateArray requires a trivially destructible type"); - GOOGLE_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) + GOOGLE_ABSL_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) << "Requested size is too large to fit into size_t."; if (arena == nullptr) { return static_cast(::operator new[](num_elements * sizeof(T))); @@ -600,7 +600,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { // type has a trivial constructor. template PROTOBUF_NDEBUG_INLINE T* CreateInternalRawArray(size_t num_elements) { - GOOGLE_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) + GOOGLE_ABSL_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) << "Requested size is too large to fit into size_t."; // We count on compiler to realize that if sizeof(T) is a multiple of // 8 AlignUpTo can be elided. diff --git a/src/google/protobuf/arena_align.h b/src/google/protobuf/arena_align.h index 0603972e38bc..8881a93a7120 100644 --- a/src/google/protobuf/arena_align.h +++ b/src/google/protobuf/arena_align.h @@ -104,7 +104,7 @@ struct ArenaAlignDefault { // Address sanitizer enabled alignment check template static T* CheckAligned(T* ptr) { - GOOGLE_DCHECK(IsAligned(ptr)) << static_cast(ptr); + GOOGLE_ABSL_DCHECK(IsAligned(ptr)) << static_cast(ptr); return ptr; } }; @@ -138,15 +138,15 @@ struct ArenaAlign { // Address sanitizer enabled alignment check template T* CheckAligned(T* ptr) const { - GOOGLE_DCHECK(IsAligned(ptr)) << static_cast(ptr); + GOOGLE_ABSL_DCHECK(IsAligned(ptr)) << static_cast(ptr); return ptr; } }; inline ArenaAlign ArenaAlignAs(size_t align) { // align must be a non zero power of 2 >= 8 - GOOGLE_DCHECK_NE(align, 0); - GOOGLE_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align; + GOOGLE_ABSL_DCHECK_NE(align, 0); + GOOGLE_ABSL_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align; return ArenaAlign{align}; } diff --git a/src/google/protobuf/arena_cleanup.h b/src/google/protobuf/arena_cleanup.h index 40367667b520..d48661f3d37f 100644 --- a/src/google/protobuf/arena_cleanup.h +++ b/src/google/protobuf/arena_cleanup.h @@ -35,8 +35,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "absl/base/attributes.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" @@ -91,7 +92,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE void CreateNode(Tag tag, void* pos, void (*destructor)(void*)) { auto elem = reinterpret_cast(elem_raw); if (EnableSpecializedTags()) { - GOOGLE_DCHECK_EQ(elem & 3, 0ULL); // Must be aligned + GOOGLE_ABSL_DCHECK_EQ(elem & 3, 0ULL); // Must be aligned switch (tag) { case Tag::kString: { TaggedNode n = {elem | static_cast(Tag::kString)}; @@ -186,7 +187,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE Tag Type(void* raw) { case Tag::kCord: return Tag::kCord; default: - GOOGLE_LOG(FATAL) << "Corrupted cleanup tag: " << (elem & 0x7ULL); + GOOGLE_ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << (elem & 0x7ULL); return Tag::kDynamic; } } @@ -203,7 +204,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE size_t Size(Tag tag) { case Tag::kCord: return sizeof(TaggedNode); default: - GOOGLE_LOG(FATAL) << "Corrupted cleanup tag: " << static_cast(tag); + GOOGLE_ABSL_LOG(FATAL) << "Corrupted cleanup tag: " << static_cast(tag); return sizeof(DynamicNode); } } diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/arena_impl.h index a75f233a0f06..043f21f67fdf 100644 --- a/src/google/protobuf/arena_impl.h +++ b/src/google/protobuf/arena_impl.h @@ -41,8 +41,8 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "absl/base/attributes.h" +#include "google/protobuf/stubs/logging.h" #include "absl/numeric/bits.h" #include "absl/synchronization/mutex.h" #include "google/protobuf/arena_allocation_policy.h" @@ -92,11 +92,11 @@ struct ArenaBlock { ArenaBlock(ArenaBlock* next, size_t size) : next(next), cleanup_nodes(nullptr), size(size) { - GOOGLE_DCHECK_GT(size, sizeof(ArenaBlock)); + GOOGLE_ABSL_DCHECK_GT(size, sizeof(ArenaBlock)); } char* Pointer(size_t n) { - GOOGLE_DCHECK_LE(n, size); + GOOGLE_ABSL_DCHECK_LE(n, size); return reinterpret_cast(this) + n; } char* Limit() { return Pointer(size & static_cast(-8)); } @@ -172,8 +172,8 @@ class PROTOBUF_EXPORT SerialArena { // from it. template void* AllocateAligned(size_t n) { - GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. - GOOGLE_DCHECK_GE(limit_, ptr()); + GOOGLE_ABSL_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); if (alloc_client == AllocationClient::kArray) { if (void* res = TryAllocateFromCachedBlock(n)) { @@ -248,8 +248,8 @@ class PROTOBUF_EXPORT SerialArena { public: // Allocate space if the current region provides enough space. bool MaybeAllocateAligned(size_t n, void** out) { - GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. - GOOGLE_DCHECK_GE(limit_, ptr()); + GOOGLE_ABSL_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; *out = AllocateFromExisting(n); return true; @@ -260,7 +260,7 @@ class PROTOBUF_EXPORT SerialArena { // and the memory returned is uninitialized. template PROTOBUF_ALWAYS_INLINE void* MaybeAllocateWithCleanup() { - GOOGLE_DCHECK_GE(limit_, ptr()); + GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); static_assert(!std::is_trivially_destructible::value, "This function is only for non-trivial types."); @@ -302,7 +302,7 @@ class PROTOBUF_EXPORT SerialArena { PROTOBUF_UNPOISON_MEMORY_REGION(ptr(), n); void* ret = internal::AlignTo(ptr(), align); set_ptr(ptr() + n); - GOOGLE_DCHECK_GE(limit_, ptr()); + GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); AddCleanupFromExisting(ret, destructor); return ret; } @@ -314,7 +314,7 @@ class PROTOBUF_EXPORT SerialArena { PROTOBUF_UNPOISON_MEMORY_REGION(limit_ - n, n); limit_ -= n; - GOOGLE_DCHECK_GE(limit_, ptr()); + GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); cleanup::CreateNode(tag, limit_, elem, destructor); } diff --git a/src/google/protobuf/arena_test_util.cc b/src/google/protobuf/arena_test_util.cc index a3d11f56a347..40dc3500b512 100644 --- a/src/google/protobuf/arena_test_util.cc +++ b/src/google/protobuf/arena_test_util.cc @@ -33,7 +33,7 @@ #include "google/protobuf/stubs/logging.h" -#define EXPECT_EQ GOOGLE_CHECK_EQ +#define EXPECT_EQ GOOGLE_ABSL_CHECK_EQ namespace google { namespace protobuf { diff --git a/src/google/protobuf/arena_test_util.h b/src/google/protobuf/arena_test_util.h index d3399f66a3e8..e32ad4cc522e 100644 --- a/src/google/protobuf/arena_test_util.h +++ b/src/google/protobuf/arena_test_util.h @@ -70,7 +70,7 @@ void TestParseCorruptedString(const T& message) { } // This next line is a low bar. But getting through the test without crashing // due to use-after-free or other bugs is a big part of what we're checking. - GOOGLE_CHECK_GT(success_count, 0); + GOOGLE_ABSL_CHECK_GT(success_count, 0); } namespace internal { @@ -105,8 +105,8 @@ class ArenaHolder { explicit ArenaHolder(Arena* arena) : field_(Arena::CreateMessage(arena)), owned_by_arena_(arena != nullptr) { - GOOGLE_DCHECK(google::protobuf::Arena::is_arena_constructable::value); - GOOGLE_DCHECK(google::protobuf::Arena::is_destructor_skippable::value); + GOOGLE_ABSL_DCHECK(google::protobuf::Arena::is_arena_constructable::value); + GOOGLE_ABSL_DCHECK(google::protobuf::Arena::is_destructor_skippable::value); } ~ArenaHolder() { diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc index 19f957283f54..8b5bbbde50b2 100644 --- a/src/google/protobuf/arena_unittest.cc +++ b/src/google/protobuf/arena_unittest.cc @@ -39,9 +39,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/string_view.h" #include "absl/synchronization/barrier.h" #include "google/protobuf/arena_test_util.h" @@ -1467,7 +1467,7 @@ TEST(ArenaTest, Alignment) { Arena arena; for (int i = 0; i < 200; i++) { void* p = Arena::CreateArray(&arena, i); - GOOGLE_CHECK_EQ(reinterpret_cast(p) % 8, 0) << i << ": " << p; + GOOGLE_ABSL_CHECK_EQ(reinterpret_cast(p) % 8, 0) << i << ": " << p; } } diff --git a/src/google/protobuf/arenastring.cc b/src/google/protobuf/arenastring.cc index 3dd4d5f7047a..de7c22cf04a2 100644 --- a/src/google/protobuf/arenastring.cc +++ b/src/google/protobuf/arenastring.cc @@ -202,7 +202,7 @@ std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) { if (tagged_ptr_.IsMutable()) { return tagged_ptr_.Get(); } else { - GOOGLE_DCHECK(IsDefault()); + GOOGLE_ABSL_DCHECK(IsDefault()); // Allocate empty. The contents are not relevant. return NewString(arena); } @@ -211,7 +211,7 @@ std::string* ArenaStringPtr::MutableNoCopy(Arena* arena) { template std::string* ArenaStringPtr::MutableSlow(::google::protobuf::Arena* arena, const Lazy&... lazy_default) { - GOOGLE_DCHECK(IsDefault()); + GOOGLE_ABSL_DCHECK(IsDefault()); // For empty defaults, this ends up calling the default constructor which is // more efficient than a copy construction from @@ -285,7 +285,7 @@ const char* EpsCopyInputStream::ReadArenaString(const char* ptr, ArenaStringPtr* s, Arena* arena) { ScopedCheckPtrInvariants check(&s->tagged_ptr_); - GOOGLE_DCHECK(arena != nullptr); + GOOGLE_ABSL_DCHECK(arena != nullptr); int size = ReadSize(&ptr); if (!ptr) return nullptr; diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h index d32b5ca2a000..38783aa4d84e 100644 --- a/src/google/protobuf/arenastring.h +++ b/src/google/protobuf/arenastring.h @@ -197,11 +197,11 @@ class TaggedStringPtr { private: static inline void assert_aligned(const void* p) { - GOOGLE_DCHECK_EQ(reinterpret_cast(p) & kMask, 0UL); + GOOGLE_ABSL_DCHECK_EQ(reinterpret_cast(p) & kMask, 0UL); } inline std::string* TagAs(Type type, std::string* p) { - GOOGLE_DCHECK(p != nullptr); + GOOGLE_ABSL_DCHECK(p != nullptr); assert_aligned(p); ptr_ = reinterpret_cast(reinterpret_cast(p) | type); return p; @@ -478,8 +478,8 @@ inline void ArenaStringPtr::ClearNonDefaultToEmpty() { } inline std::string* ArenaStringPtr::UnsafeMutablePointer() { - GOOGLE_DCHECK(tagged_ptr_.IsMutable()); - GOOGLE_DCHECK(tagged_ptr_.Get() != nullptr); + GOOGLE_ABSL_DCHECK(tagged_ptr_.IsMutable()); + GOOGLE_ABSL_DCHECK(tagged_ptr_.Get() != nullptr); return tagged_ptr_.Get(); } diff --git a/src/google/protobuf/arenastring_unittest.cc b/src/google/protobuf/arenastring_unittest.cc index 51a5d763a044..2809920056f1 100644 --- a/src/google/protobuf/arenastring_unittest.cc +++ b/src/google/protobuf/arenastring_unittest.cc @@ -37,10 +37,10 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/generated_message_util.h" #include "google/protobuf/message_lite.h" #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/string_view.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" diff --git a/src/google/protobuf/arenaz_sampler_test.cc b/src/google/protobuf/arenaz_sampler_test.cc index 98ff0427bf8c..0152d5f71798 100644 --- a/src/google/protobuf/arenaz_sampler_test.cc +++ b/src/google/protobuf/arenaz_sampler_test.cc @@ -445,7 +445,7 @@ class ThreadSafeArenazSamplerTestThread : public Thread { protobuf_test_messages::proto2::TestAllTypesProto2> message = google::protobuf::MakeArenaSafeUnique< protobuf_test_messages::proto2::TestAllTypesProto2>(arena_); - GOOGLE_CHECK(message != nullptr); + GOOGLE_ABSL_CHECK(message != nullptr); // Signal that a message on the arena has been created. This should create // a SerialArena for this thread. if (barrier_->Block()) { @@ -508,7 +508,7 @@ class SampleFirstArenaThread : public Thread { protobuf_test_messages::proto2::TestAllTypesProto2> message = google::protobuf::MakeArenaSafeUnique< protobuf_test_messages::proto2::TestAllTypesProto2>(&arena); - GOOGLE_CHECK(message != nullptr); + GOOGLE_ABSL_CHECK(message != nullptr); arena_created_.Notify(); samples_counted_.WaitForNotification(); } diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 399012f0ea91..542895714909 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -48,13 +48,14 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "absl/base/call_once.h" #include "absl/base/casts.h" #include "absl/base/dynamic_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/hash/hash.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" @@ -361,7 +362,7 @@ class FlatAllocatorImpl { template void PlanArray(int array_size) { // We can't call PlanArray after FinalizePlanning has been called. - GOOGLE_CHECK(!has_allocated()); + GOOGLE_ABSL_CHECK(!has_allocated()); if (std::is_trivially_destructible::value) { // Trivial types are aligned to 8 bytes. static_assert(alignof(U) <= 8, ""); @@ -382,13 +383,13 @@ class FlatAllocatorImpl { using TypeToUse = typename std::conditional::type; // We can only allocate after FinalizePlanning has been called. - GOOGLE_CHECK(has_allocated()); + GOOGLE_ABSL_CHECK(has_allocated()); TypeToUse*& data = pointers_.template Get(); int& used = used_.template Get(); U* res = reinterpret_cast(data + used); used += trivial ? RoundUpTo<8>(array_size * sizeof(U)) : array_size; - GOOGLE_CHECK_LE(used, total_.template Get()); + GOOGLE_ABSL_CHECK_LE(used, total_.template Get()); return res; } @@ -407,7 +408,7 @@ class FlatAllocatorImpl { // and the other 3 indices are specified in the result. void PlanFieldNames(const std::string& name, const std::string* opt_json_name) { - GOOGLE_CHECK(!has_allocated()); + GOOGLE_ABSL_CHECK(!has_allocated()); // Fast path for snake_case names, which follow the style guide. if (opt_json_name == nullptr) { @@ -448,7 +449,7 @@ class FlatAllocatorImpl { FieldNamesResult AllocateFieldNames(const std::string& name, const std::string& scope, const std::string* opt_json_name) { - GOOGLE_CHECK(has_allocated()); + GOOGLE_ABSL_CHECK(has_allocated()); std::string full_name = scope.empty() ? name : absl::StrCat(scope, ".", name); @@ -504,11 +505,11 @@ class FlatAllocatorImpl { template void FinalizePlanning(Alloc& alloc) { - GOOGLE_CHECK(!has_allocated()); + GOOGLE_ABSL_CHECK(!has_allocated()); pointers_ = alloc->CreateFlatAlloc(total_)->Pointers(); - GOOGLE_CHECK(has_allocated()); + GOOGLE_ABSL_CHECK(has_allocated()); } void ExpectConsumed() const { @@ -544,7 +545,7 @@ class FlatAllocatorImpl { template bool ExpectConsumed() const { - GOOGLE_CHECK_EQ(total_.template Get(), used_.template Get()); + GOOGLE_ABSL_CHECK_EQ(total_.template Get(), used_.template Get()); return true; } @@ -693,7 +694,7 @@ class Symbol { return absl::string_view(sub_package_file_descriptor()->file->package()) .substr(0, sub_package_file_descriptor()->name_size); default: - GOOGLE_CHECK(false); + GOOGLE_ABSL_CHECK(false); } return ""; } @@ -726,7 +727,7 @@ class Symbol { case METHOD: return {method_descriptor()->service(), method_descriptor()->name()}; default: - GOOGLE_CHECK(false); + GOOGLE_ABSL_CHECK(false); } return {}; } @@ -814,7 +815,7 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) { case SYNTAX_UNKNOWN: return "unknown"; } - GOOGLE_LOG(FATAL) << "can't reach here."; + GOOGLE_ABSL_LOG(FATAL) << "can't reach here."; return nullptr; } @@ -1393,7 +1394,7 @@ DescriptorPool::Tables::Tables() { }); } -DescriptorPool::Tables::~Tables() { GOOGLE_DCHECK(checkpoints_.empty()); } +DescriptorPool::Tables::~Tables() { GOOGLE_ABSL_DCHECK(checkpoints_.empty()); } FileDescriptorTables::FileDescriptorTables() {} @@ -1413,7 +1414,7 @@ void DescriptorPool::Tables::AddCheckpoint() { } void DescriptorPool::Tables::ClearLastCheckpoint() { - GOOGLE_DCHECK(!checkpoints_.empty()); + GOOGLE_ABSL_DCHECK(!checkpoints_.empty()); checkpoints_.pop_back(); if (checkpoints_.empty()) { // All checkpoints have been cleared: we can now commit all of the pending @@ -1425,7 +1426,7 @@ void DescriptorPool::Tables::ClearLastCheckpoint() { } void DescriptorPool::Tables::RollbackToLastCheckpoint() { - GOOGLE_DCHECK(!checkpoints_.empty()); + GOOGLE_ABSL_DCHECK(!checkpoints_.empty()); const CheckPoint& checkpoint = checkpoints_.back(); for (size_t i = checkpoint.pending_symbols_before_checkpoint; @@ -1679,7 +1680,7 @@ inline void DescriptorPool::Tables::FindAllExtensions( bool DescriptorPool::Tables::AddSymbol(const std::string& full_name, Symbol symbol) { - GOOGLE_DCHECK_EQ(full_name, symbol.full_name()); + GOOGLE_ABSL_DCHECK_EQ(full_name, symbol.full_name()); if (symbols_by_name_.insert(symbol).second) { symbols_after_checkpoint_.push_back(symbol); return true; @@ -1691,8 +1692,8 @@ bool DescriptorPool::Tables::AddSymbol(const std::string& full_name, bool FileDescriptorTables::AddAliasUnderParent(const void* parent, const std::string& name, Symbol symbol) { - GOOGLE_DCHECK_EQ(name, symbol.parent_name_key().second); - GOOGLE_DCHECK_EQ(parent, symbol.parent_name_key().first); + GOOGLE_ABSL_DCHECK_EQ(name, symbol.parent_name_key().second); + GOOGLE_ABSL_DCHECK_EQ(parent, symbol.parent_name_key().first); return symbols_by_parent_.insert(symbol).second; } @@ -1926,7 +1927,7 @@ void DescriptorPool::InternalAddGeneratedFile( // Therefore, when we parse one, we have to be very careful to avoid using // any descriptor-based operations, since this might cause infinite recursion // or deadlock. - GOOGLE_CHECK(GeneratedDatabase()->Add(encoded_file_descriptor, size)); + GOOGLE_ABSL_CHECK(GeneratedDatabase()->Add(encoded_file_descriptor, size)); } @@ -2230,13 +2231,13 @@ const EnumValueDescriptor* Descriptor::FindEnumValueByName( const FieldDescriptor* Descriptor::map_key() const { if (!options().map_entry()) return nullptr; - GOOGLE_DCHECK_EQ(field_count(), 2); + GOOGLE_ABSL_DCHECK_EQ(field_count(), 2); return field(0); } const FieldDescriptor* Descriptor::map_value() const { if (!options().map_entry()) return nullptr; - GOOGLE_DCHECK_EQ(field_count(), 2); + GOOGLE_ABSL_DCHECK_EQ(field_count(), 2); return field(1); } @@ -2473,7 +2474,7 @@ bool FieldDescriptor::is_map_message_type() const { std::string FieldDescriptor::DefaultValueAsString( bool quote_string_type) const { - GOOGLE_CHECK(has_default_value()) << "No default value"; + GOOGLE_ABSL_CHECK(has_default_value()) << "No default value"; switch (cpp_type()) { case CPPTYPE_INT32: return absl::StrCat(default_value_int32_t()); @@ -2502,10 +2503,10 @@ std::string FieldDescriptor::DefaultValueAsString( case CPPTYPE_ENUM: return default_value_enum()->name(); case CPPTYPE_MESSAGE: - GOOGLE_LOG(DFATAL) << "Messages can't have default values!"; + GOOGLE_ABSL_LOG(DFATAL) << "Messages can't have default values!"; break; } - GOOGLE_LOG(FATAL) << "Can't get here: failed to get default value as string"; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here: failed to get default value as string"; return ""; } @@ -2559,7 +2560,7 @@ void FileDescriptor::CopyHeadingTo(FileDescriptorProto* proto) const { void FileDescriptor::CopyJsonNameTo(FileDescriptorProto* proto) const { if (message_type_count() != proto->message_type_size() || extension_count() != proto->extension_size()) { - GOOGLE_LOG(ERROR) << "Cannot copy json_name to a proto of a different size."; + GOOGLE_ABSL_LOG(ERROR) << "Cannot copy json_name to a proto of a different size."; return; } for (int i = 0; i < message_type_count(); i++) { @@ -2616,7 +2617,7 @@ void Descriptor::CopyJsonNameTo(DescriptorProto* proto) const { if (field_count() != proto->field_size() || nested_type_count() != proto->nested_type_size() || extension_count() != proto->extension_size()) { - GOOGLE_LOG(ERROR) << "Cannot copy json_name to a proto of a different size."; + GOOGLE_ABSL_LOG(ERROR) << "Cannot copy json_name to a proto of a different size."; return; } for (int i = 0; i < field_count(); i++) { @@ -2838,8 +2839,8 @@ bool RetrieveOptions(int depth, const Message& options, return RetrieveOptionsAssumingRightPool(depth, *dynamic_options, option_entries); } else { - GOOGLE_LOG(ERROR) << "Found invalid proto option data for: " - << options.GetDescriptor()->full_name(); + GOOGLE_ABSL_LOG(ERROR) << "Found invalid proto option data for: " + << options.GetDescriptor()->full_name(); return RetrieveOptionsAssumingRightPool(depth, options, option_entries); } } @@ -3461,7 +3462,7 @@ void MethodDescriptor::DebugString( bool FileDescriptor::GetSourceLocation(const std::vector& path, SourceLocation* out_location) const { - GOOGLE_CHECK(out_location != nullptr); + GOOGLE_ABSL_CHECK(out_location != nullptr); if (source_code_info_) { if (const SourceCodeInfo_Location* loc = tables_->GetSourceLocation(path, source_code_info_)) { @@ -4108,11 +4109,11 @@ class DescriptorBuilder { const FileDescriptor* DescriptorPool::BuildFile( const FileDescriptorProto& proto) { - GOOGLE_CHECK(fallback_database_ == nullptr) + GOOGLE_ABSL_CHECK(fallback_database_ == nullptr) << "Cannot call BuildFile on a DescriptorPool that uses a " "DescriptorDatabase. You must instead find a way to get your file " "into the underlying database."; - GOOGLE_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_CHECK. + GOOGLE_ABSL_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_ABSL_CHECK. tables_->known_bad_symbols_.clear(); tables_->known_bad_files_.clear(); return DescriptorBuilder::New(this, tables_.get(), nullptr)->BuildFile(proto); @@ -4120,11 +4121,11 @@ const FileDescriptor* DescriptorPool::BuildFile( const FileDescriptor* DescriptorPool::BuildFileCollectingErrors( const FileDescriptorProto& proto, ErrorCollector* error_collector) { - GOOGLE_CHECK(fallback_database_ == nullptr) + GOOGLE_ABSL_CHECK(fallback_database_ == nullptr) << "Cannot call BuildFile on a DescriptorPool that uses a " "DescriptorDatabase. You must instead find a way to get your file " "into the underlying database."; - GOOGLE_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_CHECK. + GOOGLE_ABSL_CHECK(mutex_ == nullptr); // Implied by the above GOOGLE_ABSL_CHECK. tables_->known_bad_symbols_.clear(); tables_->known_bad_files_.clear(); return DescriptorBuilder::New(this, tables_.get(), error_collector) @@ -4164,10 +4165,10 @@ PROTOBUF_NOINLINE void DescriptorBuilder::AddError( const std::string& error) { if (error_collector_ == nullptr) { if (!had_errors_) { - GOOGLE_LOG(ERROR) << "Invalid proto descriptor for file \"" << filename_ - << "\":"; + GOOGLE_ABSL_LOG(ERROR) << "Invalid proto descriptor for file \"" << filename_ + << "\":"; } - GOOGLE_LOG(ERROR) << " " << element_name << ": " << error; + GOOGLE_ABSL_LOG(ERROR) << " " << element_name << ": " << error; } else { error_collector_->AddError(filename_, element_name, &descriptor, location, error); @@ -4218,7 +4219,7 @@ PROTOBUF_NOINLINE void DescriptorBuilder::AddWarning( DescriptorPool::ErrorCollector::ErrorLocation location, const std::string& error) { if (error_collector_ == nullptr) { - GOOGLE_LOG(WARNING) << filename_ << " " << element_name << ": " << error; + GOOGLE_ABSL_LOG(WARNING) << filename_ << " " << element_name << ": " << error; } else { error_collector_->AddWarning(filename_, element_name, &descriptor, location, error); @@ -4596,10 +4597,10 @@ bool DescriptorBuilder::AddSymbol(const std::string& full_name, // This is only possible if there was already an error adding something of // the same name. if (!had_errors_) { - GOOGLE_LOG(DFATAL) << "\"" << full_name - << "\" not previously defined in " - "symbols_by_name_, but was defined in " - "symbols_by_parent_; this shouldn't be possible."; + GOOGLE_ABSL_LOG(DFATAL) << "\"" << full_name + << "\" not previously defined in " + "symbols_by_name_, but was defined in " + "symbols_by_parent_; this shouldn't be possible."; } return false; } @@ -4842,7 +4843,7 @@ PROTOBUF_NOINLINE static bool ExistingFileMatchesProto( // necessary memory allocations that BuildXXX functions below will do on the // Tables object. // They *must* be kept in sync. If we miss some PlanArray call we won't have -// enough memory and will GOOGLE_CHECK-fail. +// enough memory and will GOOGLE_ABSL_CHECK-fail. static void PlanAllocationSize( const RepeatedPtrField& values, internal::FlatAllocator& alloc) { @@ -6273,8 +6274,8 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message, // Verify that they are contiguous. // This is assumed by OneofDescriptor::field(i). // But only if there are no errors. - GOOGLE_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_, - message->field(i)); + GOOGLE_ABSL_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_, + message->field(i)); } ++out_oneof_decl.field_count_; } @@ -7250,7 +7251,7 @@ void DescriptorBuilder::ValidateJSType(FieldDescriptor* field, DescriptorBuilder::OptionInterpreter::OptionInterpreter( DescriptorBuilder* builder) : builder_(builder) { - GOOGLE_CHECK(builder_); + GOOGLE_ABSL_CHECK(builder_); } DescriptorBuilder::OptionInterpreter::~OptionInterpreter() {} @@ -7269,7 +7270,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions( // and clear them, since we're about to interpret them. const FieldDescriptor* uninterpreted_options_field = options->GetDescriptor()->FindFieldByName("uninterpreted_option"); - GOOGLE_CHECK(uninterpreted_options_field != nullptr) + GOOGLE_ABSL_CHECK(uninterpreted_options_field != nullptr) << "No field named \"uninterpreted_option\" in the Options proto."; options->GetReflection()->ClearField(options, uninterpreted_options_field); @@ -7280,7 +7281,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretOptions( const FieldDescriptor* original_uninterpreted_options_field = original_options->GetDescriptor()->FindFieldByName( "uninterpreted_option"); - GOOGLE_CHECK(original_uninterpreted_options_field != nullptr) + GOOGLE_ABSL_CHECK(original_uninterpreted_options_field != nullptr) << "No field named \"uninterpreted_option\" in the Options proto."; const int num_uninterpreted_options = @@ -7373,7 +7374,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // generated pool's mutex, so we can search it the straightforward way. options_descriptor = options->GetDescriptor(); } - GOOGLE_CHECK(options_descriptor); + GOOGLE_ABSL_CHECK(options_descriptor); // We iterate over the name parts to drill into the submessages until we find // the leaf field for the option. As we drill down we remember the current @@ -7508,7 +7509,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( case FieldDescriptor::TYPE_MESSAGE: { std::string* outstr = parent_unknown_fields->AddLengthDelimited((*iter)->number()); - GOOGLE_CHECK(unknown_fields->SerializeToString(outstr)) + GOOGLE_ABSL_CHECK(unknown_fields->SerializeToString(outstr)) << "Unexpected failure while serializing option submessage " << debug_msg_name << "\"."; break; @@ -7521,8 +7522,8 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( } default: - GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " - << (*iter)->type(); + GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " + << (*iter)->type(); return false; } unknown_fields.reset(parent_unknown_fields.release()); @@ -7640,7 +7641,7 @@ void DescriptorBuilder::OptionInterpreter::AddWithoutInterpreting( const UninterpretedOption& uninterpreted_option, Message* options) { const FieldDescriptor* field = options->GetDescriptor()->FindFieldByName("uninterpreted_option"); - GOOGLE_CHECK(field != nullptr); + GOOGLE_ABSL_CHECK(field != nullptr); options->GetReflection() ->AddMessage(options, field) @@ -7700,7 +7701,7 @@ bool DescriptorBuilder::OptionInterpreter::ExamineIfOptionIsSet( break; default: - GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " << type; + GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_MESSAGE: " << type; return false; } } @@ -8023,7 +8024,7 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption( const Descriptor* type = option_field->message_type(); std::unique_ptr dynamic(dynamic_factory_.GetPrototype(type)->New()); - GOOGLE_CHECK(dynamic.get() != nullptr) + GOOGLE_ABSL_CHECK(dynamic.get() != nullptr) << "Could not create an instance of " << option_field->DebugString(); AggregateErrorCollector collector; @@ -8043,7 +8044,7 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption( if (option_field->type() == FieldDescriptor::TYPE_MESSAGE) { unknown_fields->AddLengthDelimited(option_field->number(), serial); } else { - GOOGLE_CHECK_EQ(option_field->type(), FieldDescriptor::TYPE_GROUP); + GOOGLE_ABSL_CHECK_EQ(option_field->type(), FieldDescriptor::TYPE_GROUP); UnknownFieldSet* group = unknown_fields->AddGroup(option_field->number()); group->ParseFromString(serial); } @@ -8070,7 +8071,7 @@ void DescriptorBuilder::OptionInterpreter::SetInt32( break; default: - GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT32: " << type; + GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT32: " << type; break; } } @@ -8093,7 +8094,7 @@ void DescriptorBuilder::OptionInterpreter::SetInt64( break; default: - GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT64: " << type; + GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_INT64: " << type; break; } } @@ -8111,7 +8112,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt32( break; default: - GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT32: " << type; + GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT32: " << type; break; } } @@ -8129,7 +8130,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt64( break; default: - GOOGLE_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT64: " << type; + GOOGLE_ABSL_LOG(FATAL) << "Invalid wire type for CPPTYPE_UINT64: " << type; break; } } @@ -8171,7 +8172,7 @@ Symbol DescriptorPool::CrossLinkOnDemandHelper(absl::string_view name, // be looked up when the accessor for the type was called. Set type_, // enum_type_, message_type_, and default_value_enum_ appropriately. void FieldDescriptor::InternalTypeOnceInit() const { - GOOGLE_CHECK(file()->finished_building_ == true); + GOOGLE_ABSL_CHECK(file()->finished_building_ == true); const EnumDescriptor* enum_type = nullptr; const char* lazy_type_name = reinterpret_cast(type_once_ + 1); const char* lazy_default_value_enum_name = @@ -8206,7 +8207,7 @@ void FieldDescriptor::InternalTypeOnceInit() const { if (!default_value_enum_) { // We use the first defined value as the default // if a default is not explicitly defined. - GOOGLE_CHECK(enum_type->value_count()); + GOOGLE_ABSL_CHECK(enum_type->value_count()); default_value_enum_ = enum_type->value(0); } } @@ -8252,7 +8253,7 @@ const std::string& FieldDescriptor::PrintableNameForExtension() const { } void FileDescriptor::InternalDependenciesOnceInit() const { - GOOGLE_CHECK(finished_building_ == true); + GOOGLE_ABSL_CHECK(finished_building_ == true); const char* names_ptr = reinterpret_cast(dependencies_once_ + 1); for (int i = 0; i < dependency_count(); i++) { const char* name = names_ptr; @@ -8287,18 +8288,18 @@ const Descriptor* MethodDescriptor::output_type() const { namespace internal { void LazyDescriptor::Set(const Descriptor* descriptor) { - GOOGLE_CHECK(!once_); + GOOGLE_ABSL_CHECK(!once_); descriptor_ = descriptor; } void LazyDescriptor::SetLazy(absl::string_view name, const FileDescriptor* file) { // verify Init() has been called and Set hasn't been called yet. - GOOGLE_CHECK(!descriptor_); - GOOGLE_CHECK(!once_); - GOOGLE_CHECK(file && file->pool_); - GOOGLE_CHECK(file->pool_->lazily_build_dependencies_); - GOOGLE_CHECK(!file->finished_building_); + GOOGLE_ABSL_CHECK(!descriptor_); + GOOGLE_ABSL_CHECK(!once_); + GOOGLE_ABSL_CHECK(file && file->pool_); + GOOGLE_ABSL_CHECK(file->pool_->lazily_build_dependencies_); + GOOGLE_ABSL_CHECK(!file->finished_building_); once_ = ::new (file->pool_->tables_->AllocateBytes(static_cast( sizeof(absl::once_flag) + name.size() + 1))) absl::once_flag{}; char* lazy_name = reinterpret_cast(once_ + 1); @@ -8310,7 +8311,7 @@ void LazyDescriptor::Once(const ServiceDescriptor* service) { if (once_) { absl::call_once(*once_, [&] { auto* file = service->file(); - GOOGLE_CHECK(file->finished_building_); + GOOGLE_ABSL_CHECK(file->finished_building_); const char* lazy_name = reinterpret_cast(once_ + 1); descriptor_ = file->pool_->CrossLinkOnDemandHelper(lazy_name, false).descriptor(); diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index 5a8b5f3661b3..a8062418ed32 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -64,9 +64,10 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/port.h" #include "absl/base/call_once.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" #include "google/protobuf/port.h" @@ -1799,7 +1800,7 @@ class PROTOBUF_EXPORT DescriptorPool { // this pool will be slower, since they will have to obtain locks too. // - An ErrorCollector may optionally be given to collect validation errors // in files loaded from the database. If not given, errors will be printed - // to GOOGLE_LOG(ERROR). Remember that files are built on-demand, so this + // to GOOGLE_ABSL_LOG(ERROR). Remember that files are built on-demand, so this // ErrorCollector may be called from any thread that calls one of the // Find*By*() methods. // - The DescriptorDatabase must not be mutated during the lifetime of @@ -1926,7 +1927,7 @@ class PROTOBUF_EXPORT DescriptorPool { // this DescriptorPool. All dependencies of the file must already be in // the pool. Returns the resulting FileDescriptor, or nullptr if there were // problems with the input (e.g. the message was invalid, or dependencies - // were missing). Details about the errors are written to GOOGLE_LOG(ERROR). + // were missing). Details about the errors are written to GOOGLE_ABSL_LOG(ERROR). const FileDescriptor* BuildFile(const FileDescriptorProto& proto); // Same as BuildFile() except errors are sent to the given ErrorCollector. @@ -2325,12 +2326,12 @@ inline const OneofDescriptor* FieldDescriptor::containing_oneof() const { } inline int FieldDescriptor::index_in_oneof() const { - GOOGLE_DCHECK(is_oneof_); + GOOGLE_ABSL_DCHECK(is_oneof_); return static_cast(this - scope_.containing_oneof->field(0)); } inline const Descriptor* FieldDescriptor::extension_scope() const { - GOOGLE_CHECK(is_extension_); + GOOGLE_ABSL_CHECK(is_extension_); return scope_.extension_scope; } @@ -2514,7 +2515,7 @@ struct FieldRangeImpl { value_type operator*() { return descriptor->field(idx); } friend bool operator==(const Iterator& a, const Iterator& b) { - GOOGLE_DCHECK(a.descriptor == b.descriptor); + GOOGLE_ABSL_DCHECK(a.descriptor == b.descriptor); return a.idx == b.idx; } friend bool operator!=(const Iterator& a, const Iterator& b) { diff --git a/src/google/protobuf/descriptor_database.cc b/src/google/protobuf/descriptor_database.cc index 5e0d6c33b435..ae37a83af0c4 100644 --- a/src/google/protobuf/descriptor_database.cc +++ b/src/google/protobuf/descriptor_database.cc @@ -51,7 +51,7 @@ namespace { void RecordMessageNames(const DescriptorProto& desc_proto, const std::string& prefix, std::set* output) { - GOOGLE_CHECK(desc_proto.has_name()); + GOOGLE_ABSL_CHECK(desc_proto.has_name()); std::string full_name = prefix.empty() ? desc_proto.name() : absl::StrCat(prefix, ".", desc_proto.name()); @@ -81,7 +81,7 @@ bool ForAllFileProtos(DescriptorDatabase* db, Fn callback, for (const auto& f : file_names) { file_proto.Clear(); if (!db->FindFileByName(f, &file_proto)) { - GOOGLE_LOG(ERROR) << "File not found in database (unexpected): " << f; + GOOGLE_ABSL_LOG(ERROR) << "File not found in database (unexpected): " << f; return false; } callback(file_proto, &set); @@ -120,7 +120,7 @@ template bool SimpleDescriptorDatabase::DescriptorIndex::AddFile( const FileDescriptorProto& file, Value value) { if (!by_name_.insert({file.name(), value}).second) { - GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name(); + GOOGLE_ABSL_LOG(ERROR) << "File already exists in database: " << file.name(); return false; } @@ -204,7 +204,7 @@ bool SimpleDescriptorDatabase::DescriptorIndex::AddSymbol( // relies on the fact that '.' sorts before all other characters that are // valid in symbol names). if (!ValidateSymbolName(name)) { - GOOGLE_LOG(ERROR) << "Invalid symbol name: " << name; + GOOGLE_ABSL_LOG(ERROR) << "Invalid symbol name: " << name; return false; } @@ -220,10 +220,10 @@ bool SimpleDescriptorDatabase::DescriptorIndex::AddSymbol( } if (IsSubSymbol(iter->first, name)) { - GOOGLE_LOG(ERROR) << "Symbol name \"" << name - << "\" conflicts with the existing " - "symbol \"" - << iter->first << "\"."; + GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << name + << "\" conflicts with the existing " + "symbol \"" + << iter->first << "\"."; return false; } @@ -235,10 +235,10 @@ bool SimpleDescriptorDatabase::DescriptorIndex::AddSymbol( ++iter; if (iter != by_symbol_.end() && IsSubSymbol(name, iter->first)) { - GOOGLE_LOG(ERROR) << "Symbol name \"" << name - << "\" conflicts with the existing " - "symbol \"" - << iter->first << "\"."; + GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << name + << "\" conflicts with the existing " + "symbol \"" + << iter->first << "\"."; return false; } @@ -278,10 +278,11 @@ bool SimpleDescriptorDatabase::DescriptorIndex::AddExtension( {std::make_pair(field.extendee().substr(1), field.number()), value}) .second) { - GOOGLE_LOG(ERROR) << "Extension conflicts with extension already in database: " - "extend " - << field.extendee() << " { " << field.name() << " = " - << field.number() << " } from:" << filename; + GOOGLE_ABSL_LOG(ERROR) + << "Extension conflicts with extension already in database: " + "extend " + << field.extendee() << " { " << field.name() << " = " + << field.number() << " } from:" << filename; return false; } } else { @@ -567,8 +568,8 @@ bool EncodedDescriptorDatabase::Add(const void* encoded_file_descriptor, if (file.ParseFromArray(encoded_file_descriptor, size)) { return index_->AddFile(file, std::make_pair(encoded_file_descriptor, size)); } else { - GOOGLE_LOG(ERROR) << "Invalid file descriptor data passed to " - "EncodedDescriptorDatabase::Add()."; + GOOGLE_ABSL_LOG(ERROR) << "Invalid file descriptor data passed to " + "EncodedDescriptorDatabase::Add()."; return false; } } @@ -639,7 +640,7 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddFile(const FileProto& file, all_values_.push_back({value.first, value.second, {}}); if (!ValidateSymbolName(file.package())) { - GOOGLE_LOG(ERROR) << "Invalid package name: " << file.package(); + GOOGLE_ABSL_LOG(ERROR) << "Invalid package name: " << file.package(); return false; } all_values_.back().encoded_package = EncodeString(file.package()); @@ -650,7 +651,7 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddFile(const FileProto& file, .second || std::binary_search(by_name_flat_.begin(), by_name_flat_.end(), file.name(), by_name_.key_comp())) { - GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name(); + GOOGLE_ABSL_LOG(ERROR) << "File already exists in database: " << file.name(); return false; } @@ -677,9 +678,9 @@ static bool CheckForMutualSubsymbols(absl::string_view symbol_name, Iter* iter, Iter2 end, const Index& index) { if (*iter != end) { if (IsSubSymbol((*iter)->AsString(index), symbol_name)) { - GOOGLE_LOG(ERROR) << "Symbol name \"" << symbol_name - << "\" conflicts with the existing symbol \"" - << (*iter)->AsString(index) << "\"."; + GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << symbol_name + << "\" conflicts with the existing symbol \"" + << (*iter)->AsString(index) << "\"."; return false; } @@ -691,9 +692,9 @@ static bool CheckForMutualSubsymbols(absl::string_view symbol_name, Iter* iter, ++*iter; if (*iter != end && IsSubSymbol(symbol_name, (*iter)->AsString(index))) { - GOOGLE_LOG(ERROR) << "Symbol name \"" << symbol_name - << "\" conflicts with the existing symbol \"" - << (*iter)->AsString(index) << "\"."; + GOOGLE_ABSL_LOG(ERROR) << "Symbol name \"" << symbol_name + << "\" conflicts with the existing symbol \"" + << (*iter)->AsString(index) << "\"."; return false; } } @@ -712,7 +713,7 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddSymbol( // relies on the fact that '.' sorts before all other characters that are // valid in symbol names). if (!ValidateSymbolName(symbol)) { - GOOGLE_LOG(ERROR) << "Invalid symbol name: " << entry_as_string; + GOOGLE_ABSL_LOG(ERROR) << "Invalid symbol name: " << entry_as_string; return false; } @@ -765,10 +766,11 @@ bool EncodedDescriptorDatabase::DescriptorIndex::AddExtension( by_extension_flat_.begin(), by_extension_flat_.end(), std::make_pair(field.extendee().substr(1), field.number()), by_extension_.key_comp())) { - GOOGLE_LOG(ERROR) << "Extension conflicts with extension already in database: " - "extend " - << field.extendee() << " { " << field.name() << " = " - << field.number() << " } from:" << filename; + GOOGLE_ABSL_LOG(ERROR) + << "Extension conflicts with extension already in database: " + "extend " + << field.extendee() << " { " << field.name() << " = " + << field.number() << " } from:" << filename; return false; } } else { diff --git a/src/google/protobuf/descriptor_database.h b/src/google/protobuf/descriptor_database.h index 942f975ae39c..591a5b77256f 100644 --- a/src/google/protobuf/descriptor_database.h +++ b/src/google/protobuf/descriptor_database.h @@ -171,7 +171,7 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { // Adds the FileDescriptorProto to the database, making a copy. The object // can be deleted after Add() returns. Returns false if the file conflicted // with a file already in the database, in which case an error will have - // been written to GOOGLE_LOG(ERROR). + // been written to GOOGLE_ABSL_LOG(ERROR). bool Add(const FileDescriptorProto& file); // Adds the FileDescriptorProto to the database and takes ownership of it. diff --git a/src/google/protobuf/descriptor_database_unittest.cc b/src/google/protobuf/descriptor_database_unittest.cc index 2abc6de846e8..7c14974dcbd9 100644 --- a/src/google/protobuf/descriptor_database_unittest.cc +++ b/src/google/protobuf/descriptor_database_unittest.cc @@ -39,7 +39,6 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/text_format.h" diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 33f7ec0218c2..3a0975bd4d25 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -46,7 +46,6 @@ #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_custom_options.pb.h" #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor_database.h" @@ -55,6 +54,8 @@ #include #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/unittest_lazy_dependencies.pb.h" #include "google/protobuf/unittest_lazy_dependencies_custom_option.pb.h" #include "google/protobuf/unittest_lazy_dependencies_enum.pb.h" @@ -2990,7 +2991,7 @@ class AllowUnknownDependenciesTest return pool_->FindFileByName(proto.name()); } } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } @@ -3215,7 +3216,7 @@ TEST_P(AllowUnknownDependenciesTest, const FileDescriptor* file = BuildFile(test_proto); ASSERT_TRUE(file != nullptr); - GOOGLE_LOG(INFO) << file->DebugString(); + GOOGLE_ABSL_LOG(INFO) << file->DebugString(); EXPECT_EQ(0, file->dependency_count()); ASSERT_EQ(1, file->message_type_count()); @@ -6067,7 +6068,7 @@ TEST_F(ValidationErrorTest, RollbackAfterError) { } TEST_F(ValidationErrorTest, ErrorsReportedToLogError) { - // Test that errors are reported to GOOGLE_LOG(ERROR) if no error collector is + // Test that errors are reported to GOOGLE_ABSL_LOG(ERROR) if no error collector is // provided. FileDescriptorProto file_proto; @@ -7402,11 +7403,11 @@ class ExponentialErrorDatabase : public DescriptorDatabase { absl::string_view end_with, int32_t* file_num) { if (!absl::ConsumePrefix(&name, begin_with)) return; if (!absl::ConsumeSuffix(&name, end_with)) return; - GOOGLE_CHECK(absl::SimpleAtoi(name, file_num)); + GOOGLE_ABSL_CHECK(absl::SimpleAtoi(name, file_num)); } bool PopulateFile(int file_num, FileDescriptorProto* output) { - GOOGLE_CHECK_GE(file_num, 0); + GOOGLE_ABSL_CHECK_GE(file_num, 0); output->Clear(); output->set_name(absl::Substitute("file$0.proto", file_num)); // file0.proto doesn't define Message0 @@ -7431,7 +7432,7 @@ TEST_F(DatabaseBackedPoolTest, DoesntReloadKnownBadFiles) { ExponentialErrorDatabase error_database; DescriptorPool pool(&error_database); - GOOGLE_LOG(INFO) << "A timeout in this test probably indicates a real bug."; + GOOGLE_ABSL_LOG(INFO) << "A timeout in this test probably indicates a real bug."; EXPECT_TRUE(pool.FindFileByName("file40.proto") == nullptr); EXPECT_TRUE(pool.FindMessageTypeByName("Message40") == nullptr); @@ -7476,8 +7477,8 @@ class AbortingErrorCollector : public DescriptorPool::ErrorCollector { void AddError(const std::string& filename, const std::string& element_name, const Message* message, ErrorLocation location, const std::string& error_message) override { - GOOGLE_LOG(FATAL) << "AddError() called unexpectedly: " << filename << " [" - << element_name << "]: " << error_message; + GOOGLE_ABSL_LOG(FATAL) << "AddError() called unexpectedly: " << filename << " [" + << element_name << "]: " << error_message; } }; diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index 777ec176029b..b9f61d4e722f 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc @@ -178,7 +178,7 @@ int FieldSpaceUsed(const FieldDescriptor* field) { } } - GOOGLE_LOG(DFATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(DFATAL) << "Can't get here."; return 0; } @@ -587,7 +587,7 @@ DynamicMessage::~DynamicMessage() { void DynamicMessage::CrossLinkPrototypes() { // This should only be called on the prototype message. - GOOGLE_CHECK(is_prototype()); + GOOGLE_ABSL_CHECK(is_prototype()); DynamicMessageFactory* factory = type_info_->factory; const Descriptor* descriptor = type_info_->type; diff --git a/src/google/protobuf/dynamic_message.h b/src/google/protobuf/dynamic_message.h index eb4a4b52112f..fc677b52be45 100644 --- a/src/google/protobuf/dynamic_message.h +++ b/src/google/protobuf/dynamic_message.h @@ -163,9 +163,9 @@ class PROTOBUF_EXPORT DynamicMapSorter { #ifndef NDEBUG for (size_t j = 1; j < static_cast(map_size); j++) { if (!comparator(result[j - 1], result[j])) { - GOOGLE_LOG(ERROR) << (comparator(result[j], result[j - 1]) - ? "internal error in map key sorting" - : "map keys are not unique"); + GOOGLE_ABSL_LOG(ERROR) << (comparator(result[j], result[j - 1]) + ? "internal error in map key sorting" + : "map keys are not unique"); } } #endif @@ -212,7 +212,7 @@ class PROTOBUF_EXPORT DynamicMapSorter { return first < second; } default: - GOOGLE_LOG(DFATAL) << "Invalid key for map field."; + GOOGLE_ABSL_LOG(DFATAL) << "Invalid key for map field."; return true; } } diff --git a/src/google/protobuf/dynamic_message_unittest.cc b/src/google/protobuf/dynamic_message_unittest.cc index b06e3add6a3c..7270425f6f91 100644 --- a/src/google/protobuf/dynamic_message_unittest.cc +++ b/src/google/protobuf/dynamic_message_unittest.cc @@ -44,7 +44,6 @@ #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/testing/googletest.h" diff --git a/src/google/protobuf/explicitly_constructed.h b/src/google/protobuf/explicitly_constructed.h index eb0265264665..2c8968598273 100644 --- a/src/google/protobuf/explicitly_constructed.h +++ b/src/google/protobuf/explicitly_constructed.h @@ -33,10 +33,9 @@ #include +#include #include -#include "google/protobuf/stubs/logging.h" - // clang-format off #include "google/protobuf/port_def.inc" // clang-format on diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index 6cd1248ddd68..42d0428f095d 100644 --- a/src/google/protobuf/extension_set.cc +++ b/src/google/protobuf/extension_set.cc @@ -59,7 +59,7 @@ namespace internal { namespace { inline WireFormatLite::FieldType real_type(FieldType type) { - GOOGLE_DCHECK(type > 0 && type <= WireFormatLite::MAX_FIELD_TYPE); + GOOGLE_ABSL_DCHECK(type > 0 && type <= WireFormatLite::MAX_FIELD_TYPE); return static_cast(type); } @@ -92,9 +92,9 @@ void Register(const ExtensionInfo& info) { static auto local_static_registry = OnShutdownDelete(new ExtensionRegistry); global_registry = local_static_registry; if (!local_static_registry->insert(info).second) { - GOOGLE_LOG(FATAL) << "Multiple extension registrations for type \"" - << info.message->GetTypeName() << "\", field number " - << info.number << "."; + GOOGLE_ABSL_LOG(FATAL) << "Multiple extension registrations for type \"" + << info.message->GetTypeName() << "\", field number " + << info.number << "."; } } @@ -130,9 +130,9 @@ void ExtensionSet::RegisterExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, bool is_packed, LazyEagerVerifyFnType verify_func) { - GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_ENUM); - GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_MESSAGE); - GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_GROUP); + GOOGLE_ABSL_CHECK_NE(type, WireFormatLite::TYPE_ENUM); + GOOGLE_ABSL_CHECK_NE(type, WireFormatLite::TYPE_MESSAGE); + GOOGLE_ABSL_CHECK_NE(type, WireFormatLite::TYPE_GROUP); ExtensionInfo info(extendee, number, type, is_repeated, is_packed, verify_func); Register(info); @@ -155,7 +155,7 @@ void ExtensionSet::RegisterEnumExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, bool is_packed, EnumValidityFunc* is_valid) { - GOOGLE_CHECK_EQ(type, WireFormatLite::TYPE_ENUM); + GOOGLE_ABSL_CHECK_EQ(type, WireFormatLite::TYPE_ENUM); ExtensionInfo info(extendee, number, type, is_repeated, is_packed, nullptr); info.enum_validity_check.func = CallNoArgValidityFunc; // See comment in CallNoArgValidityFunc() about why we use a c-style cast. @@ -168,8 +168,8 @@ void ExtensionSet::RegisterMessageExtension(const MessageLite* extendee, bool is_repeated, bool is_packed, const MessageLite* prototype, LazyEagerVerifyFnType verify_func) { - GOOGLE_CHECK(type == WireFormatLite::TYPE_MESSAGE || - type == WireFormatLite::TYPE_GROUP); + GOOGLE_ABSL_CHECK(type == WireFormatLite::TYPE_MESSAGE || + type == WireFormatLite::TYPE_GROUP); ExtensionInfo info(extendee, number, type, is_repeated, is_packed, verify_func); info.message_info = {prototype}; @@ -219,7 +219,7 @@ void ExtensionSet::DeleteFlatMap(const ExtensionSet::KeyValue* flat, bool ExtensionSet::Has(int number) const { const Extension* ext = FindOrNull(number); if (ext == nullptr) return false; - GOOGLE_DCHECK(!ext->is_repeated); + GOOGLE_ABSL_DCHECK(!ext->is_repeated); return !ext->is_cleared; } @@ -245,11 +245,13 @@ int ExtensionSet::ExtensionSize(int number) const { FieldType ExtensionSet::ExtensionType(int number) const { const Extension* ext = FindOrNull(number); if (ext == nullptr) { - GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (1). "; + GOOGLE_ABSL_LOG(DFATAL) + << "Don't lookup extension types if they aren't present (1). "; return 0; } if (ext->is_cleared) { - GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (2). "; + GOOGLE_ABSL_LOG(DFATAL) + << "Don't lookup extension types if they aren't present (2). "; } return ext->type; } @@ -269,9 +271,10 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; } // namespace -#define GOOGLE_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \ - GOOGLE_DCHECK_EQ((EXTENSION).is_repeated ? REPEATED_FIELD : OPTIONAL_FIELD, LABEL); \ - GOOGLE_DCHECK_EQ(cpp_type((EXTENSION).type), WireFormatLite::CPPTYPE_##CPPTYPE) +#define GOOGLE_ABSL_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \ + GOOGLE_ABSL_DCHECK_EQ((EXTENSION).is_repeated ? REPEATED_FIELD : OPTIONAL_FIELD, \ + LABEL); \ + GOOGLE_ABSL_DCHECK_EQ(cpp_type((EXTENSION).type), WireFormatLite::CPPTYPE_##CPPTYPE) // ------------------------------------------------------------------- // Primitives @@ -284,7 +287,7 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; if (extension == nullptr || extension->is_cleared) { \ return default_value; \ } else { \ - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ return extension->LOWERCASE##_value; \ } \ } \ @@ -295,7 +298,7 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; if (extension == nullptr || extension->is_cleared) { \ return default_value; \ } else { \ - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ return extension->LOWERCASE##_value; \ } \ } \ @@ -306,11 +309,11 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; Extension* extension; \ if (MaybeNewExtension(number, descriptor, &extension)) { \ extension->type = type; \ - GOOGLE_DCHECK_EQ(cpp_type(extension->type), \ - WireFormatLite::CPPTYPE_##UPPERCASE); \ + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), \ + WireFormatLite::CPPTYPE_##UPPERCASE); \ extension->is_repeated = false; \ } else { \ - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ } \ extension->is_cleared = false; \ extension->LOWERCASE##_value = value; \ @@ -319,24 +322,27 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; LOWERCASE ExtensionSet::GetRepeated##CAMELCASE(int number, int index) \ const { \ const Extension* extension = FindOrNull(number); \ - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; \ - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ + GOOGLE_ABSL_CHECK(extension != nullptr) \ + << "Index out-of-bounds (field is empty)."; \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ return extension->repeated_##LOWERCASE##_value->Get(index); \ } \ \ const LOWERCASE& ExtensionSet::GetRefRepeated##CAMELCASE(int number, \ int index) const { \ const Extension* extension = FindOrNull(number); \ - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; \ - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ + GOOGLE_ABSL_CHECK(extension != nullptr) \ + << "Index out-of-bounds (field is empty)."; \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ return extension->repeated_##LOWERCASE##_value->Get(index); \ } \ \ void ExtensionSet::SetRepeated##CAMELCASE(int number, int index, \ LOWERCASE value) { \ Extension* extension = FindOrNull(number); \ - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; \ - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ + GOOGLE_ABSL_CHECK(extension != nullptr) \ + << "Index out-of-bounds (field is empty)."; \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ extension->repeated_##LOWERCASE##_value->Set(index, value); \ } \ \ @@ -346,15 +352,15 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; Extension* extension; \ if (MaybeNewExtension(number, descriptor, &extension)) { \ extension->type = type; \ - GOOGLE_DCHECK_EQ(cpp_type(extension->type), \ - WireFormatLite::CPPTYPE_##UPPERCASE); \ + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), \ + WireFormatLite::CPPTYPE_##UPPERCASE); \ extension->is_repeated = true; \ extension->is_packed = packed; \ extension->repeated_##LOWERCASE##_value = \ Arena::CreateMessage>(arena_); \ } else { \ - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ - GOOGLE_DCHECK_EQ(extension->is_packed, packed); \ + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ + GOOGLE_ABSL_DCHECK_EQ(extension->is_packed, packed); \ } \ extension->repeated_##LOWERCASE##_value->Add(value); \ } @@ -443,10 +449,10 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, } // Compatible version using old call signature. Does not create extensions when -// the don't already exist; instead, just GOOGLE_CHECK-fails. +// the don't already exist; instead, just GOOGLE_ABSL_CHECK-fails. void* ExtensionSet::MutableRawRepeatedField(int number) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Extension not found."; + GOOGLE_ABSL_CHECK(extension != nullptr) << "Extension not found."; // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. return extension->repeated_int32_t_value; @@ -461,7 +467,7 @@ int ExtensionSet::GetEnum(int number, int default_value) const { // Not present. Return the default value. return default_value; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); return extension->enum_value; } } @@ -473,7 +479,7 @@ const int& ExtensionSet::GetRefEnum(int number, // Not present. Return the default value. return default_value; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); return extension->enum_value; } } @@ -483,10 +489,10 @@ void ExtensionSet::SetEnum(int number, FieldType type, int value, Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_ENUM); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_ENUM); extension->is_repeated = false; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); } extension->is_cleared = false; extension->enum_value = value; @@ -494,22 +500,22 @@ void ExtensionSet::SetEnum(int number, FieldType type, int value, int ExtensionSet::GetRepeatedEnum(int number, int index) const { const Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); return extension->repeated_enum_value->Get(index); } const int& ExtensionSet::GetRefRepeatedEnum(int number, int index) const { const Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); return extension->repeated_enum_value->Get(index); } void ExtensionSet::SetRepeatedEnum(int number, int index, int value) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); extension->repeated_enum_value->Set(index, value); } @@ -518,14 +524,14 @@ void ExtensionSet::AddEnum(int number, FieldType type, bool packed, int value, Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_ENUM); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_ENUM); extension->is_repeated = true; extension->is_packed = packed; extension->repeated_enum_value = Arena::CreateMessage>(arena_); } else { - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); - GOOGLE_DCHECK_EQ(extension->is_packed, packed); + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); + GOOGLE_ABSL_DCHECK_EQ(extension->is_packed, packed); } extension->repeated_enum_value->Add(value); } @@ -540,7 +546,7 @@ const std::string& ExtensionSet::GetString( // Not present. Return the default value. return default_value; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, STRING); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, STRING); return *extension->string_value; } } @@ -550,11 +556,11 @@ std::string* ExtensionSet::MutableString(int number, FieldType type, Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_STRING); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_STRING); extension->is_repeated = false; extension->string_value = Arena::Create(arena_); } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, STRING); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, STRING); } extension->is_cleared = false; return extension->string_value; @@ -563,15 +569,15 @@ std::string* ExtensionSet::MutableString(int number, FieldType type, const std::string& ExtensionSet::GetRepeatedString(int number, int index) const { const Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING); return extension->repeated_string_value->Get(index); } std::string* ExtensionSet::MutableRepeatedString(int number, int index) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING); return extension->repeated_string_value->Mutable(index); } @@ -580,13 +586,13 @@ std::string* ExtensionSet::AddString(int number, FieldType type, Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_STRING); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_STRING); extension->is_repeated = true; extension->is_packed = false; extension->repeated_string_value = Arena::CreateMessage>(arena_); } else { - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING); + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING); } return extension->repeated_string_value->Add(); } @@ -601,7 +607,7 @@ const MessageLite& ExtensionSet::GetMessage( // Not present. Return the default value. return default_value; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); if (extension->is_lazy) { return extension->lazymessage_value->GetMessage(default_value, arena_); } else { @@ -621,14 +627,14 @@ MessageLite* ExtensionSet::MutableMessage(int number, FieldType type, Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); extension->is_repeated = false; extension->is_lazy = false; extension->message_value = prototype.New(arena_); extension->is_cleared = false; return extension->message_value; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); extension->is_cleared = false; if (extension->is_lazy) { return extension->lazymessage_value->MutableMessage(prototype, arena_); @@ -650,13 +656,13 @@ void ExtensionSet::SetAllocatedMessage(int number, FieldType type, ClearExtension(number); return; } - GOOGLE_DCHECK(message->GetOwningArena() == nullptr || - message->GetOwningArena() == arena_); + GOOGLE_ABSL_DCHECK(message->GetOwningArena() == nullptr || + message->GetOwningArena() == arena_); Arena* message_arena = message->GetOwningArena(); Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); extension->is_repeated = false; extension->is_lazy = false; if (message_arena == arena_) { @@ -669,7 +675,7 @@ void ExtensionSet::SetAllocatedMessage(int number, FieldType type, extension->message_value->CheckTypeAndMergeFrom(*message); } } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); if (extension->is_lazy) { extension->lazymessage_value->SetAllocatedMessage(message, arena_); } else { @@ -700,12 +706,12 @@ void ExtensionSet::UnsafeArenaSetAllocatedMessage( Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); extension->is_repeated = false; extension->is_lazy = false; extension->message_value = message; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); if (extension->is_lazy) { extension->lazymessage_value->UnsafeArenaSetAllocatedMessage(message, arena_); @@ -726,7 +732,7 @@ MessageLite* ExtensionSet::ReleaseMessage(int number, // Not present. Return nullptr. return nullptr; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->ReleaseMessage(prototype, arena_); @@ -755,7 +761,7 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( // Not present. Return nullptr. return nullptr; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(prototype, @@ -778,15 +784,15 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( const MessageLite& ExtensionSet::GetRepeatedMessage(int number, int index) const { const Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE); return extension->repeated_message_value->Get(index); } MessageLite* ExtensionSet::MutableRepeatedMessage(int number, int index) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE); return extension->repeated_message_value->Mutable(index); } @@ -796,12 +802,12 @@ MessageLite* ExtensionSet::AddMessage(int number, FieldType type, Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { extension->type = type; - GOOGLE_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), WireFormatLite::CPPTYPE_MESSAGE); extension->is_repeated = true; extension->repeated_message_value = Arena::CreateMessage>(arena_); } else { - GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE); } // RepeatedPtrField does not know how to Add() since it cannot @@ -821,12 +827,12 @@ MessageLite* ExtensionSet::AddMessage(int number, FieldType type, // const Descriptor* message_type, // MessageFactory* factory) -#undef GOOGLE_DCHECK_TYPE +#undef GOOGLE_ABSL_DCHECK_TYPE void ExtensionSet::RemoveLast(int number) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK(extension->is_repeated); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK(extension->is_repeated); switch (cpp_type(extension->type)) { case WireFormatLite::CPPTYPE_INT32: @@ -864,24 +870,24 @@ void ExtensionSet::RemoveLast(int number) { MessageLite* ExtensionSet::ReleaseLast(int number) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK(extension->is_repeated); - GOOGLE_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK(extension->is_repeated); + GOOGLE_ABSL_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE); return extension->repeated_message_value->ReleaseLast(); } MessageLite* ExtensionSet::UnsafeArenaReleaseLast(int number) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK(extension->is_repeated); - GOOGLE_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK(extension->is_repeated); + GOOGLE_ABSL_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE); return extension->repeated_message_value->UnsafeArenaReleaseLast(); } void ExtensionSet::SwapElements(int number, int index1, int index2) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; - GOOGLE_DCHECK(extension->is_repeated); + GOOGLE_ABSL_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_ABSL_DCHECK(extension->is_repeated); switch (cpp_type(extension->type)) { case WireFormatLite::CPPTYPE_INT32: @@ -988,9 +994,9 @@ void ExtensionSet::InternalExtensionMergeFrom(const MessageLite* extendee, extension->is_packed = other_extension.is_packed; extension->is_repeated = true; } else { - GOOGLE_DCHECK_EQ(extension->type, other_extension.type); - GOOGLE_DCHECK_EQ(extension->is_packed, other_extension.is_packed); - GOOGLE_DCHECK(extension->is_repeated); + GOOGLE_ABSL_DCHECK_EQ(extension->type, other_extension.type); + GOOGLE_ABSL_DCHECK_EQ(extension->is_packed, other_extension.is_packed); + GOOGLE_ABSL_DCHECK(extension->is_repeated); } switch (cpp_type(other_extension.type)) { @@ -1084,9 +1090,9 @@ void ExtensionSet::InternalExtensionMergeFrom(const MessageLite* extendee, *other_extension.message_value); } } else { - GOOGLE_DCHECK_EQ(extension->type, other_extension.type); - GOOGLE_DCHECK_EQ(extension->is_packed, other_extension.is_packed); - GOOGLE_DCHECK(!extension->is_repeated); + GOOGLE_ABSL_DCHECK_EQ(extension->type, other_extension.type); + GOOGLE_ABSL_DCHECK_EQ(extension->is_packed, other_extension.is_packed); + GOOGLE_ABSL_DCHECK(!extension->is_repeated); if (other_extension.is_lazy) { if (extension->is_lazy) { extension->lazymessage_value->MergeFrom( @@ -1194,7 +1200,7 @@ void ExtensionSet::UnsafeShallowSwapExtension(ExtensionSet* other, int number) { if (this_ext == other_ext) return; - GOOGLE_DCHECK_EQ(GetArena(), other->GetArena()); + GOOGLE_ABSL_DCHECK_EQ(GetArena(), other->GetArena()); if (this_ext != nullptr && other_ext != nullptr) { std::swap(*this_ext, *other_ext); @@ -1390,7 +1396,7 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { case WireFormatLite::TYPE_BYTES: case WireFormatLite::TYPE_GROUP: case WireFormatLite::TYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + GOOGLE_ABSL_LOG(FATAL) << "Non-primitive types can't be packed."; break; } @@ -1491,7 +1497,7 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { } int ExtensionSet::Extension::GetSize() const { - GOOGLE_DCHECK(is_repeated); + GOOGLE_ABSL_DCHECK(is_repeated); switch (cpp_type(type)) { #define HANDLE_TYPE(UPPERCASE, LOWERCASE) \ case WireFormatLite::CPPTYPE_##UPPERCASE: \ @@ -1510,7 +1516,7 @@ int ExtensionSet::Extension::GetSize() const { #undef HANDLE_TYPE } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return 0; } @@ -1659,7 +1665,7 @@ void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { hint = new_map.large->insert(hint, {it->first, it->second}); } flat_size_ = static_cast(-1); - GOOGLE_DCHECK(is_large()); + GOOGLE_ABSL_DCHECK(is_large()); } else { new_map.flat = Arena::CreateArray(arena_, new_flat_capacity); std::copy(begin, end, new_map.flat); @@ -1749,7 +1755,7 @@ uint8_t* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( case WireFormatLite::TYPE_BYTES: case WireFormatLite::TYPE_GROUP: case WireFormatLite::TYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + GOOGLE_ABSL_LOG(FATAL) << "Non-primitive types can't be packed."; break; } } else { @@ -1877,7 +1883,7 @@ ExtensionSet::Extension::InternalSerializeMessageSetItemWithCachedSizesToArray( uint8_t* target, io::EpsCopyOutputStream* stream) const { if (type != WireFormatLite::TYPE_MESSAGE || is_repeated) { // Not a valid MessageSet extension, but serialize it the normal way. - GOOGLE_LOG(WARNING) << "Invalid message set extension."; + GOOGLE_ABSL_LOG(WARNING) << "Invalid message set extension."; return InternalSerializeFieldWithCachedSizesToArray(extendee, extension_set, number, target, stream); } diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index c0dcb8c16110..f5057bda9cca 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -321,7 +321,7 @@ class PROTOBUF_EXPORT ExtensionSet { // This is an overload of MutableRawRepeatedField to maintain compatibility // with old code using a previous API. This version of - // MutableRawRepeatedField() will GOOGLE_CHECK-fail on a missing extension. + // MutableRawRepeatedField() will GOOGLE_ABSL_CHECK-fail on a missing extension. // (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.) void* MutableRawRepeatedField(int number); @@ -790,8 +790,8 @@ class PROTOBUF_EXPORT ExtensionSet { return false; } - GOOGLE_DCHECK(extension->type > 0 && - extension->type <= WireFormatLite::MAX_FIELD_TYPE); + GOOGLE_ABSL_DCHECK(extension->type > 0 && + extension->type <= WireFormatLite::MAX_FIELD_TYPE); auto real_type = static_cast(extension->type); WireFormatLite::WireType expected_wire_type = @@ -1257,7 +1257,7 @@ class EnumTypeTraits { } static inline void Set(int number, FieldType field_type, ConstType value, ExtensionSet* set) { - GOOGLE_DCHECK(IsValid(value)); + GOOGLE_ABSL_DCHECK(IsValid(value)); set->SetEnum(number, field_type, value, nullptr); } template @@ -1289,12 +1289,12 @@ class RepeatedEnumTypeTraits { } static inline void Set(int number, int index, ConstType value, ExtensionSet* set) { - GOOGLE_DCHECK(IsValid(value)); + GOOGLE_ABSL_DCHECK(IsValid(value)); set->SetRepeatedEnum(number, index, value); } static inline void Add(int number, FieldType field_type, bool is_packed, ConstType value, ExtensionSet* set) { - GOOGLE_DCHECK(IsValid(value)); + GOOGLE_ABSL_DCHECK(IsValid(value)); set->AddEnum(number, field_type, is_packed, value, nullptr); } static inline const RepeatedField& GetRepeated( diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc index abf9e5fe763d..7503d7d20156 100644 --- a/src/google/protobuf/extension_set_heavy.cc +++ b/src/google/protobuf/extension_set_heavy.cc @@ -104,7 +104,7 @@ void ExtensionSet::AppendToList( } inline FieldDescriptor::Type real_type(FieldType type) { - GOOGLE_DCHECK(type > 0 && type <= FieldDescriptor::MAX_TYPE); + GOOGLE_ABSL_DCHECK(type > 0 && type <= FieldDescriptor::MAX_TYPE); return static_cast(type); } @@ -114,15 +114,15 @@ inline FieldDescriptor::CppType cpp_type(FieldType type) { } inline WireFormatLite::FieldType field_type(FieldType type) { - GOOGLE_DCHECK(type > 0 && type <= WireFormatLite::MAX_FIELD_TYPE); + GOOGLE_ABSL_DCHECK(type > 0 && type <= WireFormatLite::MAX_FIELD_TYPE); return static_cast(type); } -#define GOOGLE_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \ - GOOGLE_DCHECK_EQ((EXTENSION).is_repeated ? FieldDescriptor::LABEL_REPEATED \ - : FieldDescriptor::LABEL_OPTIONAL, \ - FieldDescriptor::LABEL_##LABEL); \ - GOOGLE_DCHECK_EQ(cpp_type((EXTENSION).type), FieldDescriptor::CPPTYPE_##CPPTYPE) +#define GOOGLE_ABSL_DCHECK_TYPE(EXTENSION, LABEL, CPPTYPE) \ + GOOGLE_ABSL_DCHECK_EQ((EXTENSION).is_repeated ? FieldDescriptor::LABEL_REPEATED \ + : FieldDescriptor::LABEL_OPTIONAL, \ + FieldDescriptor::LABEL_##LABEL); \ + GOOGLE_ABSL_DCHECK_EQ(cpp_type((EXTENSION).type), FieldDescriptor::CPPTYPE_##CPPTYPE) const MessageLite& ExtensionSet::GetMessage(int number, const Descriptor* message_type, @@ -132,7 +132,7 @@ const MessageLite& ExtensionSet::GetMessage(int number, // Not present. Return the default value. return *factory->GetPrototype(message_type); } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); if (extension->is_lazy) { return extension->lazymessage_value->GetMessage( *factory->GetPrototype(message_type), arena_); @@ -147,7 +147,7 @@ MessageLite* ExtensionSet::MutableMessage(const FieldDescriptor* descriptor, Extension* extension; if (MaybeNewExtension(descriptor->number(), descriptor, &extension)) { extension->type = descriptor->type(); - GOOGLE_DCHECK_EQ(cpp_type(extension->type), FieldDescriptor::CPPTYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), FieldDescriptor::CPPTYPE_MESSAGE); extension->is_repeated = false; extension->is_packed = false; const MessageLite* prototype = @@ -157,7 +157,7 @@ MessageLite* ExtensionSet::MutableMessage(const FieldDescriptor* descriptor, extension->is_cleared = false; return extension->message_value; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); extension->is_cleared = false; if (extension->is_lazy) { return extension->lazymessage_value->MutableMessage( @@ -175,7 +175,7 @@ MessageLite* ExtensionSet::ReleaseMessage(const FieldDescriptor* descriptor, // Not present. Return nullptr. return nullptr; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->ReleaseMessage( @@ -203,7 +203,7 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( // Not present. Return nullptr. return nullptr; } else { - GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->UnsafeArenaReleaseMessage( @@ -224,12 +224,12 @@ ExtensionSet::Extension* ExtensionSet::MaybeNewRepeatedExtension( Extension* extension; if (MaybeNewExtension(descriptor->number(), descriptor, &extension)) { extension->type = descriptor->type(); - GOOGLE_DCHECK_EQ(cpp_type(extension->type), FieldDescriptor::CPPTYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(cpp_type(extension->type), FieldDescriptor::CPPTYPE_MESSAGE); extension->is_repeated = true; extension->repeated_message_value = Arena::CreateMessage >(arena_); } else { - GOOGLE_DCHECK_TYPE(*extension, REPEATED, MESSAGE); + GOOGLE_ABSL_DCHECK_TYPE(*extension, REPEATED, MESSAGE); } return extension; } @@ -248,7 +248,7 @@ MessageLite* ExtensionSet::AddMessage(const FieldDescriptor* descriptor, const MessageLite* prototype; if (extension->repeated_message_value->empty()) { prototype = factory->GetPrototype(descriptor->message_type()); - GOOGLE_CHECK(prototype != nullptr); + GOOGLE_ABSL_CHECK(prototype != nullptr); } else { prototype = &extension->repeated_message_value->Get(0); } @@ -290,7 +290,7 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { if (extension->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { output->message_info.prototype = factory_->GetPrototype(extension->message_type()); - GOOGLE_CHECK(output->message_info.prototype != nullptr) + GOOGLE_ABSL_CHECK(output->message_info.prototype != nullptr) << "Extension factory's GetPrototype() returned nullptr; extension: " << extension->full_name(); } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { diff --git a/src/google/protobuf/extension_set_inl.h b/src/google/protobuf/extension_set_inl.h index 8256455407d9..29a944f52976 100644 --- a/src/google/protobuf/extension_set_inl.h +++ b/src/google/protobuf/extension_set_inl.h @@ -76,7 +76,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( case WireFormatLite::TYPE_BYTES: case WireFormatLite::TYPE_GROUP: case WireFormatLite::TYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Non-primitive types can't be packed."; + GOOGLE_ABSL_LOG(FATAL) << "Non-primitive types can't be packed."; break; } } else { diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc index 98f9ba80dc3f..5a351405f464 100644 --- a/src/google/protobuf/extension_set_unittest.cc +++ b/src/google/protobuf/extension_set_unittest.cc @@ -34,7 +34,6 @@ #include "google/protobuf/extension_set.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/arena.h" #include "google/protobuf/descriptor.h" diff --git a/src/google/protobuf/generated_message_bases.cc b/src/google/protobuf/generated_message_bases.cc index 2ccca160d173..c79c44553cf1 100644 --- a/src/google/protobuf/generated_message_bases.cc +++ b/src/google/protobuf/generated_message_bases.cc @@ -101,7 +101,7 @@ ::uint8_t* ZeroFieldsBase::_InternalSerialize( void ZeroFieldsBase::MergeImpl(Message& to_param, const Message& from_param) { auto* to = static_cast(&to_param); const auto* from = static_cast(&from_param); - GOOGLE_DCHECK_NE(from, to); + GOOGLE_ABSL_DCHECK_NE(from, to); to->_internal_metadata_.MergeFrom(from->_internal_metadata_); } diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index 392fe9f8b145..506815e23ba5 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -41,9 +41,10 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "absl/base/casts.h" #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/match.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" @@ -177,18 +178,18 @@ using internal::GetPointerAtOffset; void ReportReflectionUsageError(const Descriptor* descriptor, const FieldDescriptor* field, const char* method, const char* description) { - GOOGLE_LOG(FATAL) << "Protocol Buffer reflection usage error:\n" - " Method : google::protobuf::Reflection::" - << method - << "\n" - " Message type: " - << descriptor->full_name() - << "\n" - " Field : " - << field->full_name() - << "\n" - " Problem : " - << description; + GOOGLE_ABSL_LOG(FATAL) << "Protocol Buffer reflection usage error:\n" + " Method : google::protobuf::Reflection::" + << method + << "\n" + " Message type: " + << descriptor->full_name() + << "\n" + " Field : " + << field->full_name() + << "\n" + " Problem : " + << description; } const char* cpptype_names_[FieldDescriptor::MAX_CPPTYPE + 1] = { @@ -199,7 +200,7 @@ const char* cpptype_names_[FieldDescriptor::MAX_CPPTYPE + 1] = { static void ReportReflectionUsageTypeError( const Descriptor* descriptor, const FieldDescriptor* field, const char* method, FieldDescriptor::CppType expected_type) { - GOOGLE_LOG(FATAL) + GOOGLE_ABSL_LOG(FATAL) << "Protocol Buffer reflection usage error:\n" " Method : google::protobuf::Reflection::" << method @@ -221,27 +222,27 @@ static void ReportReflectionUsageTypeError( static void ReportReflectionUsageEnumTypeError( const Descriptor* descriptor, const FieldDescriptor* field, const char* method, const EnumValueDescriptor* value) { - GOOGLE_LOG(FATAL) << "Protocol Buffer reflection usage error:\n" - " Method : google::protobuf::Reflection::" - << method - << "\n" - " Message type: " - << descriptor->full_name() - << "\n" - " Field : " - << field->full_name() - << "\n" - " Problem : Enum value did not match field type:\n" - " Expected : " - << field->enum_type()->full_name() - << "\n" - " Actual : " - << value->full_name(); + GOOGLE_ABSL_LOG(FATAL) << "Protocol Buffer reflection usage error:\n" + " Method : google::protobuf::Reflection::" + << method + << "\n" + " Message type: " + << descriptor->full_name() + << "\n" + " Field : " + << field->full_name() + << "\n" + " Problem : Enum value did not match field type:\n" + " Expected : " + << field->enum_type()->full_name() + << "\n" + " Actual : " + << value->full_name(); } inline void CheckInvalidAccess(const internal::ReflectionSchema& schema, const FieldDescriptor* field) { - GOOGLE_CHECK(!schema.IsFieldStripped(field)) + GOOGLE_ABSL_CHECK(!schema.IsFieldStripped(field)) << "invalid access to a stripped field " << field->full_name(); } @@ -514,7 +515,7 @@ struct OneofFieldMover { } break; default: - GOOGLE_LOG(FATAL) << "unimplemented type: " << field->cpp_type(); + GOOGLE_ABSL_LOG(FATAL) << "unimplemented type: " << field->cpp_type(); } if (unsafe_shallow_swap) { // Not clearing oneof case after move may cause unwanted "ClearOneof" @@ -598,7 +599,7 @@ void SwapFieldHelper::SwapInlinedStrings(const Reflection* r, Message* lhs, auto* lhs_string = r->MutableRaw(lhs, field); auto* rhs_string = r->MutableRaw(rhs, field); uint32_t index = r->schema_.InlinedStringIndex(field); - GOOGLE_DCHECK_GT(index, 0); + GOOGLE_ABSL_DCHECK_GT(index, 0); uint32_t* lhs_array = r->MutableInlinedStringDonatedArray(lhs); uint32_t* rhs_array = r->MutableInlinedStringDonatedArray(rhs); uint32_t* lhs_state = &lhs_array[index / 32]; @@ -769,7 +770,7 @@ void SwapFieldHelper::SwapNonMessageNonStringField( SWAP_VALUES(ENUM, int); #undef SWAP_VALUES default: - GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); + GOOGLE_ABSL_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); } } @@ -805,7 +806,7 @@ void Reflection::SwapField(Message* message1, Message* message2, break; default: - GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); + GOOGLE_ABSL_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); } } else { switch (field->cpp_type()) { @@ -868,7 +869,7 @@ void Reflection::UnsafeShallowSwapField(Message* message1, Message* message2, break; default: - GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); + GOOGLE_ABSL_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); } } @@ -962,7 +963,7 @@ void Reflection::SwapOneofField(Message* lhs, Message* rhs, const FieldDescriptor* field; }; - GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); + GOOGLE_ABSL_DCHECK(!oneof_descriptor->is_synthetic()); uint32_t oneof_case_lhs = GetOneofCase(*lhs, oneof_descriptor); uint32_t oneof_case_rhs = GetOneofCase(*rhs, oneof_descriptor); @@ -1003,7 +1004,7 @@ void Reflection::Swap(Message* message1, Message* message2) const { if (message1 == message2) return; // TODO(kenton): Other Reflection methods should probably check this too. - GOOGLE_CHECK_EQ(message1->GetReflection(), this) + GOOGLE_ABSL_CHECK_EQ(message1->GetReflection(), this) << "First argument to Swap() (of type \"" << message1->GetDescriptor()->full_name() << "\") is not compatible with this reflection object (which is for type " @@ -1011,7 +1012,7 @@ void Reflection::Swap(Message* message1, Message* message2) const { << descriptor_->full_name() << "\"). Note that the exact same class is required; not just the same " "descriptor."; - GOOGLE_CHECK_EQ(message2->GetReflection(), this) + GOOGLE_ABSL_CHECK_EQ(message2->GetReflection(), this) << "Second argument to Swap() (of type \"" << message2->GetDescriptor()->full_name() << "\") is not compatible with this reflection object (which is for type " @@ -1058,7 +1059,7 @@ void Reflection::SwapFieldsImpl( if (message1 == message2) return; // TODO(kenton): Other Reflection methods should probably check this too. - GOOGLE_CHECK_EQ(message1->GetReflection(), this) + GOOGLE_ABSL_CHECK_EQ(message1->GetReflection(), this) << "First argument to SwapFields() (of type \"" << message1->GetDescriptor()->full_name() << "\") is not compatible with this reflection object (which is for type " @@ -1066,7 +1067,7 @@ void Reflection::SwapFieldsImpl( << descriptor_->full_name() << "\"). Note that the exact same class is required; not just the same " "descriptor."; - GOOGLE_CHECK_EQ(message2->GetReflection(), this) + GOOGLE_ABSL_CHECK_EQ(message2->GetReflection(), this) << "Second argument to SwapFields() (of type \"" << message2->GetDescriptor()->full_name() << "\") is not compatible with this reflection object (which is for type " @@ -1113,9 +1114,9 @@ void Reflection::SwapFieldsImpl( SwapBit(message1, message2, field); if (field->options().ctype() == FieldOptions::STRING && IsInlined(field)) { - GOOGLE_DCHECK(!unsafe_shallow_swap || - message1->GetArenaForAllocation() == - message2->GetArenaForAllocation()); + GOOGLE_ABSL_DCHECK(!unsafe_shallow_swap || + message1->GetArenaForAllocation() == + message2->GetArenaForAllocation()); SwapInlinedStringDonated(message1, message2, field); } } @@ -1133,8 +1134,8 @@ void Reflection::SwapFields( void Reflection::UnsafeShallowSwapFields( Message* message1, Message* message2, const std::vector& fields) const { - GOOGLE_DCHECK_EQ(message1->GetArenaForAllocation(), - message2->GetArenaForAllocation()); + GOOGLE_ABSL_DCHECK_EQ(message1->GetArenaForAllocation(), + message2->GetArenaForAllocation()); SwapFieldsImpl(message1, message2, fields); } @@ -1142,7 +1143,7 @@ void Reflection::UnsafeShallowSwapFields( void Reflection::UnsafeArenaSwapFields( Message* lhs, Message* rhs, const std::vector& fields) const { - GOOGLE_DCHECK_EQ(lhs->GetArenaForAllocation(), rhs->GetArenaForAllocation()); + GOOGLE_ABSL_DCHECK_EQ(lhs->GetArenaForAllocation(), rhs->GetArenaForAllocation()); UnsafeShallowSwapFields(lhs, rhs, fields); } @@ -1166,7 +1167,7 @@ bool Reflection::HasField(const Message& message, } void Reflection::UnsafeArenaSwap(Message* lhs, Message* rhs) const { - GOOGLE_DCHECK_EQ(lhs->GetOwningArena(), rhs->GetOwningArena()); + GOOGLE_ABSL_DCHECK_EQ(lhs->GetOwningArena(), rhs->GetOwningArena()); InternalSwap(lhs, rhs); } @@ -1236,8 +1237,8 @@ void Reflection::InternalSwap(Message* lhs, Message* rhs) const { ? 0 // One extra bit for the arena dtor tracking. : (inlined_string_count + 1 + 31) / 32; - GOOGLE_CHECK_EQ((lhs_donated_array[0] & 0x1u) == 0, - (rhs_donated_array[0] & 0x1u) == 0); + GOOGLE_ABSL_CHECK_EQ((lhs_donated_array[0] & 0x1u) == 0, + (rhs_donated_array[0] & 0x1u) == 0); for (int i = 0; i < donated_array_size; i++) { std::swap(lhs_donated_array[i], rhs_donated_array[i]); } @@ -1289,7 +1290,7 @@ int Reflection::FieldSize(const Message& message, } } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return 0; } } @@ -1550,7 +1551,7 @@ struct FieldNumberSorter { }; bool IsIndexInHasBitSet(const uint32_t* has_bit_set, uint32_t has_bit_index) { - GOOGLE_DCHECK_NE(has_bit_index, ~0u); + GOOGLE_ABSL_DCHECK_NE(has_bit_index, ~0u); return ((has_bit_set[has_bit_index / 32] >> (has_bit_index % 32)) & static_cast(1)) != 0; } @@ -1771,7 +1772,7 @@ void Reflection::SetString(Message* message, const FieldDescriptor* field, case FieldOptions::STRING: { if (IsInlined(field)) { const uint32_t index = schema_.InlinedStringIndex(field); - GOOGLE_DCHECK_GT(index, 0); + GOOGLE_ABSL_DCHECK_GT(index, 0); uint32_t* states = &MutableInlinedStringDonatedArray(message)[index / 32]; uint32_t mask = ~(static_cast(1) << (index % 32)); @@ -2150,8 +2151,9 @@ void Reflection::UnsafeArenaSetAllocatedMessage( void Reflection::SetAllocatedMessage(Message* message, Message* sub_message, const FieldDescriptor* field) const { - GOOGLE_DCHECK(sub_message == nullptr || sub_message->GetOwningArena() == nullptr || - sub_message->GetOwningArena() == message->GetArenaForAllocation()); + GOOGLE_ABSL_DCHECK( + sub_message == nullptr || sub_message->GetOwningArena() == nullptr || + sub_message->GetOwningArena() == message->GetArenaForAllocation()); CheckInvalidAccess(schema_, field); // If message and sub-message are in different memory ownership domains @@ -2367,7 +2369,7 @@ void* Reflection::MutableRawRepeatedField(Message* message, ReportReflectionUsageTypeError(descriptor_, field, "MutableRawRepeatedField", cpptype); if (desc != nullptr) - GOOGLE_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; + GOOGLE_ABSL_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; if (field->is_extension()) { return MutableExtensionSet(message)->MutableRawRepeatedField( field->number(), field->type(), field->is_packed(), field); @@ -2391,9 +2393,9 @@ const void* Reflection::GetRawRepeatedField(const Message& message, ReportReflectionUsageTypeError(descriptor_, field, "GetRawRepeatedField", cpptype); if (ctype >= 0) - GOOGLE_CHECK_EQ(field->options().ctype(), ctype) << "subtype mismatch"; + GOOGLE_ABSL_CHECK_EQ(field->options().ctype(), ctype) << "subtype mismatch"; if (desc != nullptr) - GOOGLE_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; + GOOGLE_ABSL_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; if (field->is_extension()) { // Should use extension_set::GetRawRepeatedField. However, the required // parameter "default repeated value" is not very easy to get here. @@ -2517,7 +2519,7 @@ const Type& Reflection::GetRawNonOneof(const Message& message, } void Reflection::PrepareSplitMessageForWrite(Message* message) const { - GOOGLE_DCHECK_NE(message, schema_.default_instance_); + GOOGLE_ABSL_DCHECK_NE(message, schema_.default_instance_); void** split = MutableSplitField(message); const void* default_split = GetSplitField(schema_.default_instance_); if (*split == default_split) { @@ -2553,18 +2555,18 @@ Type* Reflection::MutableRaw(Message* message, } const uint32_t* Reflection::GetHasBits(const Message& message) const { - GOOGLE_DCHECK(schema_.HasHasbits()); + GOOGLE_ABSL_DCHECK(schema_.HasHasbits()); return &GetConstRefAtOffset(message, schema_.HasBitsOffset()); } uint32_t* Reflection::MutableHasBits(Message* message) const { - GOOGLE_DCHECK(schema_.HasHasbits()); + GOOGLE_ABSL_DCHECK(schema_.HasHasbits()); return GetPointerAtOffset(message, schema_.HasBitsOffset()); } uint32_t* Reflection::MutableOneofCase( Message* message, const OneofDescriptor* oneof_descriptor) const { - GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); + GOOGLE_ABSL_DCHECK(!oneof_descriptor->is_synthetic()); return GetPointerAtOffset( message, schema_.GetOneofCaseOffset(oneof_descriptor)); } @@ -2592,13 +2594,13 @@ InternalMetadata* Reflection::MutableInternalMetadata(Message* message) const { const uint32_t* Reflection::GetInlinedStringDonatedArray( const Message& message) const { - GOOGLE_DCHECK(schema_.HasInlinedString()); + GOOGLE_ABSL_DCHECK(schema_.HasInlinedString()); return &GetConstRefAtOffset(message, schema_.InlinedStringDonatedOffset()); } uint32_t* Reflection::MutableInlinedStringDonatedArray(Message* message) const { - GOOGLE_DCHECK(schema_.HasInlinedString()); + GOOGLE_ABSL_DCHECK(schema_.HasInlinedString()); return GetPointerAtOffset(message, schema_.InlinedStringDonatedOffset()); } @@ -2607,7 +2609,7 @@ uint32_t* Reflection::MutableInlinedStringDonatedArray(Message* message) const { bool Reflection::IsInlinedStringDonated(const Message& message, const FieldDescriptor* field) const { uint32_t index = schema_.InlinedStringIndex(field); - GOOGLE_DCHECK_GT(index, 0); + GOOGLE_ABSL_DCHECK_GT(index, 0); return IsIndexInHasBitSet(GetInlinedStringDonatedArray(message), index); } @@ -2636,11 +2638,11 @@ void Reflection::SwapInlinedStringDonated(Message* lhs, Message* rhs, // If one is undonated, both must have already registered ArenaDtor. uint32_t* lhs_array = MutableInlinedStringDonatedArray(lhs); uint32_t* rhs_array = MutableInlinedStringDonatedArray(rhs); - GOOGLE_CHECK_EQ(lhs_array[0] & 0x1u, 0u); - GOOGLE_CHECK_EQ(rhs_array[0] & 0x1u, 0u); + GOOGLE_ABSL_CHECK_EQ(lhs_array[0] & 0x1u, 0u); + GOOGLE_ABSL_CHECK_EQ(rhs_array[0] & 0x1u, 0u); // Swap donation status bit. uint32_t index = schema_.InlinedStringIndex(field); - GOOGLE_DCHECK_GT(index, 0); + GOOGLE_ABSL_DCHECK_GT(index, 0); if (rhs_donated) { SetInlinedStringDonated(index, lhs_array); ClearInlinedStringDonated(index, rhs_array); @@ -2653,7 +2655,7 @@ void Reflection::SwapInlinedStringDonated(Message* lhs, Message* rhs, // Simple accessors for manipulating has_bits_. bool Reflection::HasBit(const Message& message, const FieldDescriptor* field) const { - GOOGLE_DCHECK(!field->options().weak()); + GOOGLE_ABSL_DCHECK(!field->options().weak()); if (schema_.HasBitIndex(field) != static_cast(-1)) { return IsIndexInHasBitSet(GetHasBits(message), schema_.HasBitIndex(field)); } @@ -2715,13 +2717,13 @@ bool Reflection::HasBit(const Message& message, // handled above; avoid warning break; } - GOOGLE_LOG(FATAL) << "Reached impossible case in HasBit()."; + GOOGLE_ABSL_LOG(FATAL) << "Reached impossible case in HasBit()."; return false; } } void Reflection::SetBit(Message* message, const FieldDescriptor* field) const { - GOOGLE_DCHECK(!field->options().weak()); + GOOGLE_ABSL_DCHECK(!field->options().weak()); const uint32_t index = schema_.HasBitIndex(field); if (index == static_cast(-1)) return; MutableHasBits(message)[index / 32] |= @@ -2730,7 +2732,7 @@ void Reflection::SetBit(Message* message, const FieldDescriptor* field) const { void Reflection::ClearBit(Message* message, const FieldDescriptor* field) const { - GOOGLE_DCHECK(!field->options().weak()); + GOOGLE_ABSL_DCHECK(!field->options().weak()); const uint32_t index = schema_.HasBitIndex(field); if (index == static_cast(-1)) return; MutableHasBits(message)[index / 32] &= @@ -2739,7 +2741,7 @@ void Reflection::ClearBit(Message* message, void Reflection::SwapBit(Message* message1, Message* message2, const FieldDescriptor* field) const { - GOOGLE_DCHECK(!field->options().weak()); + GOOGLE_ABSL_DCHECK(!field->options().weak()); if (!schema_.HasHasbits()) { return; } @@ -2933,15 +2935,15 @@ void* Reflection::RepeatedFieldData(Message* message, const FieldDescriptor* field, FieldDescriptor::CppType cpp_type, const Descriptor* message_type) const { - GOOGLE_CHECK(field->is_repeated()); - GOOGLE_CHECK(field->cpp_type() == cpp_type || - (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM && - cpp_type == FieldDescriptor::CPPTYPE_INT32)) + GOOGLE_ABSL_CHECK(field->is_repeated()); + GOOGLE_ABSL_CHECK(field->cpp_type() == cpp_type || + (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM && + cpp_type == FieldDescriptor::CPPTYPE_INT32)) << "The type parameter T in RepeatedFieldRef API doesn't match " << "the actual field type (for enums T should be the generated enum " << "type or int32_t)."; if (message_type != nullptr) { - GOOGLE_CHECK_EQ(message_type, field->message_type()); + GOOGLE_ABSL_CHECK_EQ(message_type, field->message_type()); } if (field->is_extension()) { return MutableExtensionSet(message)->MutableRawRepeatedField( @@ -3088,7 +3090,7 @@ static internal::TailCallParseFunc GetFastParseFunction( }; auto it = map->find(name); if (it == map->end()) { - GOOGLE_LOG(DFATAL) << "Failed to find function: " << name; + GOOGLE_ABSL_LOG(DFATAL) << "Failed to find function: " << name; // Let's not crash in opt, just in case. // MiniParse is always a valid parser. return &internal::TcParser::MiniParse; @@ -3109,8 +3111,8 @@ const internal::TcParseTableBase* Reflection::CreateTcParseTableForMessageSet() auto* full_table = ::new (p) Table{ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, schema_.default_instance_, nullptr}, {{{&internal::TcParser::ReflectionParseLoop, {}}}}}; - GOOGLE_DCHECK_EQ(static_cast(&full_table->header), - static_cast(full_table)); + GOOGLE_ABSL_DCHECK_EQ(static_cast(&full_table->header), + static_cast(full_table)); return &full_table->header; } @@ -3221,7 +3223,7 @@ void Reflection::PopulateTcParseFieldAux( case internal::TailCallTableInfo::kSubTable: case internal::TailCallTableInfo::kSubMessageWeak: case internal::TailCallTableInfo::kMessageVerifyFunc: - GOOGLE_LOG(FATAL) << "Not supported"; + GOOGLE_ABSL_LOG(FATAL) << "Not supported"; break; case internal::TailCallTableInfo::kSubMessage: field_aux++->message_default_p = @@ -3232,7 +3234,7 @@ void Reflection::PopulateTcParseFieldAux( aux_entry.enum_range.size}; break; case internal::TailCallTableInfo::kEnumValidator: - GOOGLE_LOG(FATAL) << "Not supported."; + GOOGLE_ABSL_LOG(FATAL) << "Not supported."; break; case internal::TailCallTableInfo::kNumericOffset: field_aux++->offset = aux_entry.offset; @@ -3306,7 +3308,7 @@ const internal::TcParseTableBase* Reflection::CreateTcParseTable() const { inlined_string_indices); const size_t fast_entries_count = table_info.fast_path_fields.size(); - GOOGLE_CHECK_EQ(fast_entries_count, 1 << table_info.table_size_log2); + GOOGLE_ABSL_CHECK_EQ(fast_entries_count, 1 << table_info.table_size_log2); const uint16_t lookup_table_offset = AlignTo( sizeof(TcParseTableBase) + fast_entries_count * sizeof(TcParseTableBase::FastFieldEntry)); @@ -3349,9 +3351,9 @@ const internal::TcParseTableBase* Reflection::CreateTcParseTable() const { table_info.field_name_data.size()); } // Validation to make sure we used all the bytes correctly. - GOOGLE_CHECK_EQ(res->name_data() + table_info.field_name_data.size() - - reinterpret_cast(res), - byte_size); + GOOGLE_ABSL_CHECK_EQ(res->name_data() + table_info.field_name_data.size() - + reinterpret_cast(res), + byte_size); return res; } @@ -3505,7 +3507,7 @@ void AssignDescriptorsImpl(const DescriptorTable* table, bool eager) { const FileDescriptor* file = DescriptorPool::internal_generated_pool()->FindFileByName( table->filename); - GOOGLE_CHECK(file != nullptr); + GOOGLE_ABSL_CHECK(file != nullptr); MessageFactory* factory = MessageFactory::generated_factory(); diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index 70a75aa20db2..1b5485b09380 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -140,7 +140,7 @@ struct ReflectionSchema { // Offset of a non-oneof field. Getting a field offset is slightly more // efficient when we know statically that it is not a oneof field. uint32_t GetFieldOffsetNonOneof(const FieldDescriptor* field) const { - GOOGLE_DCHECK(!InRealOneof(field)); + GOOGLE_ABSL_DCHECK(!InRealOneof(field)); return OffsetValue(offsets_[field->index()], field->type()); } @@ -172,13 +172,13 @@ struct ReflectionSchema { // Bit index within the bit array of hasbits. Bit order is low-to-high. uint32_t HasBitIndex(const FieldDescriptor* field) const { if (has_bits_offset_ == -1) return static_cast(-1); - GOOGLE_DCHECK(HasHasbits()); + GOOGLE_ABSL_DCHECK(HasHasbits()); return has_bit_indices_[field->index()]; } // Byte offset of the hasbits array. uint32_t HasBitsOffset() const { - GOOGLE_DCHECK(HasHasbits()); + GOOGLE_ABSL_DCHECK(HasHasbits()); return static_cast(has_bits_offset_); } @@ -187,13 +187,13 @@ struct ReflectionSchema { // Bit index within the bit array of _inlined_string_donated_. Bit order is // low-to-high. uint32_t InlinedStringIndex(const FieldDescriptor* field) const { - GOOGLE_DCHECK(HasInlinedString()); + GOOGLE_ABSL_DCHECK(HasInlinedString()); return inlined_string_indices_[field->index()]; } // Byte offset of the _inlined_string_donated_ array. uint32_t InlinedStringDonatedOffset() const { - GOOGLE_DCHECK(HasInlinedString()); + GOOGLE_ABSL_DCHECK(HasInlinedString()); return static_cast(inlined_string_donated_offset_); } @@ -210,7 +210,7 @@ struct ReflectionSchema { // The offset of the ExtensionSet in this message. uint32_t GetExtensionSetOffset() const { - GOOGLE_DCHECK(HasExtensionSet()); + GOOGLE_ABSL_DCHECK(HasExtensionSet()); return static_cast(extensions_offset_); } @@ -231,7 +231,7 @@ struct ReflectionSchema { // Returns true if the field is implicitly backed by LazyField. bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const { - GOOGLE_DCHECK_EQ(field->type(), FieldDescriptor::TYPE_MESSAGE); + GOOGLE_ABSL_DCHECK_EQ(field->type(), FieldDescriptor::TYPE_MESSAGE); (void)field; return false; } @@ -255,12 +255,12 @@ struct ReflectionSchema { // Byte offset of _split_. uint32_t SplitOffset() const { - GOOGLE_DCHECK(IsSplit()); + GOOGLE_ABSL_DCHECK(IsSplit()); return static_cast(split_offset_); } uint32_t SizeofSplit() const { - GOOGLE_DCHECK(IsSplit()); + GOOGLE_ABSL_DCHECK(IsSplit()); return static_cast(sizeof_split_); } diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc index d127ecd410c9..8c2b90a12a15 100644 --- a/src/google/protobuf/generated_message_reflection_unittest.cc +++ b/src/google/protobuf/generated_message_reflection_unittest.cc @@ -46,11 +46,11 @@ #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arena.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" #include "google/protobuf/map_test_util.h" #include "google/protobuf/map_unittest.pb.h" @@ -95,7 +95,7 @@ namespace { const FieldDescriptor* F(const std::string& name) { const FieldDescriptor* result = unittest::TestAllTypes::descriptor()->FindFieldByName(name); - GOOGLE_CHECK(result != nullptr); + GOOGLE_ABSL_CHECK(result != nullptr); return result; } diff --git a/src/google/protobuf/generated_message_tctable_gen.cc b/src/google/protobuf/generated_message_tctable_gen.cc index 1c5e22803cbf..fd39199f1f87 100644 --- a/src/google/protobuf/generated_message_tctable_gen.cc +++ b/src/google/protobuf/generated_message_tctable_gen.cc @@ -53,7 +53,7 @@ namespace { bool GetEnumValidationRange(const EnumDescriptor* enum_type, int16_t& start, uint16_t& size) { - GOOGLE_CHECK_GT(enum_type->value_count(), 0) << enum_type->DebugString(); + GOOGLE_ABSL_CHECK_GT(enum_type->value_count(), 0) << enum_type->DebugString(); // Check if the enum values are a single, contiguous range. std::vector enum_values; @@ -149,7 +149,7 @@ void PopulateFastFieldEntry(const TailCallTableInfo::FieldEntryInfo& entry, name.append("c"); } else if (options.is_string_inlined) { name.append("i"); - GOOGLE_CHECK(!field->is_repeated()); + GOOGLE_ABSL_CHECK(!field->is_repeated()); aux_idx = static_cast(entry.inlined_string_idx); } } @@ -205,7 +205,7 @@ bool IsFieldEligibleForFastParsing( return false; } if (options.is_string_inlined) { - GOOGLE_CHECK(!field->is_repeated()); + GOOGLE_ABSL_CHECK(!field->is_repeated()); // For inlined strings, the donation state index is stored in the // `aux_idx` field of the fast parsing info. We need to check the range // of that value instead of the auxiliary index. @@ -220,7 +220,7 @@ bool IsFieldEligibleForFastParsing( if (cpp::HasHasbit(field)) { // The tailcall parser can only update the first 32 hasbits. Fields with // has-bits beyond the first 32 are handled by mini parsing/fallback. - GOOGLE_CHECK_GE(entry.hasbit_idx, 0) << field->DebugString(); + GOOGLE_ABSL_CHECK_GE(entry.hasbit_idx, 0) << field->DebugString(); if (entry.hasbit_idx >= 32) return false; } @@ -255,7 +255,7 @@ absl::optional GetEndGroupTag(const Descriptor* descriptor) { } uint32_t RecodeTagForFastParsing(uint32_t tag) { - GOOGLE_DCHECK_LE(tag, 0x3FFF); + GOOGLE_ABSL_DCHECK_LE(tag, 0x3FFF); // Construct the varint-coded tag. If it is more than 7 bits, we need to // shift the high bits and add a continue bit. if (uint32_t hibits = tag & 0xFFFFFF80) { @@ -318,7 +318,7 @@ std::vector SplitFastFieldsForSize( } // Fill in this field's entry: - GOOGLE_CHECK(info.func_name.empty()) << info.func_name; + GOOGLE_ABSL_CHECK(info.func_name.empty()) << info.func_name; PopulateFastFieldEntry(entry, options, info); info.field = field; info.coded_tag = tag; @@ -486,7 +486,7 @@ TailCallTableInfo::NumToEntryTable MakeNumToEntryTable( for (; field_entry_index != N; ++field_entry_index) { auto* field_descriptor = field_descriptors[field_entry_index]; uint32_t fnum = static_cast(field_descriptor->number()); - GOOGLE_CHECK_GT(fnum, last_skip_entry_start); + GOOGLE_ABSL_CHECK_GT(fnum, last_skip_entry_start); if (start_new_block == false) { // If the next field number is within 15 of the last_skip_entry_start, we // continue writing just to that entry. If it's between 16 and 31 more, @@ -653,8 +653,8 @@ uint16_t MakeTypeCardForField( } else { type_card |= fl::kMessage; if (options.lazy_opt != 0) { - GOOGLE_CHECK(options.lazy_opt == field_layout::kTvEager || - options.lazy_opt == field_layout::kTvLazy); + GOOGLE_ABSL_CHECK(options.lazy_opt == field_layout::kTvEager || + options.lazy_opt == field_layout::kTvLazy); type_card |= +fl::kRepLazy | options.lazy_opt; } else { if (options.is_implicitly_weak) { @@ -774,7 +774,7 @@ TailCallTableInfo::TailCallTableInfo( } else if ((field->type() == FieldDescriptor::TYPE_STRING || field->type() == FieldDescriptor::TYPE_BYTES) && options.is_string_inlined) { - GOOGLE_CHECK(!field->is_repeated()); + GOOGLE_ABSL_CHECK(!field->is_repeated()); // Inlined strings have an extra marker to represent their donation state. int idx = inlined_string_indices[static_cast(field->index())]; // For mini parsing, the donation state index is stored as an `offset` @@ -795,7 +795,7 @@ TailCallTableInfo::TailCallTableInfo( size_t try_size = 1 << try_size_log2; auto split_fields = SplitFastFieldsForSize(end_group_tag, field_entries, try_size_log2, option_provider); - GOOGLE_CHECK_EQ(split_fields.size(), try_size); + GOOGLE_ABSL_CHECK_EQ(split_fields.size(), try_size); int try_num_fast_fields = 0; for (const auto& info : split_fields) { if (info.field != nullptr) ++try_num_fast_fields; @@ -831,7 +831,7 @@ TailCallTableInfo::TailCallTableInfo( fallback_fields = FilterMiniParsedFields(ordered_fields, option_provider); num_to_entry_table = MakeNumToEntryTable(ordered_fields); - GOOGLE_CHECK_EQ(field_entries.size(), ordered_fields.size()); + GOOGLE_ABSL_CHECK_EQ(field_entries.size(), ordered_fields.size()); field_name_data = GenerateFieldNames(descriptor, field_entries); // If there are no fallback fields, and at most one extension range, the diff --git a/src/google/protobuf/generated_message_tctable_impl.h b/src/google/protobuf/generated_message_tctable_impl.h index 67d9bb268729..fe7bdb096e3b 100644 --- a/src/google/protobuf/generated_message_tctable_impl.h +++ b/src/google/protobuf/generated_message_tctable_impl.h @@ -265,7 +265,7 @@ enum FieldType : uint16_t { #ifndef NDEBUG template void AlignFail(uintptr_t address) { - GOOGLE_LOG(FATAL) << "Unaligned (" << align << ") access at " << address; + GOOGLE_ABSL_LOG(FATAL) << "Unaligned (" << align << ") access at " << address; // Explicit abort to let compilers know this function does not return abort(); diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc index d2c89e826665..b672c304ed99 100644 --- a/src/google/protobuf/generated_message_tctable_lite.cc +++ b/src/google/protobuf/generated_message_tctable_lite.cc @@ -467,7 +467,7 @@ PROTOBUF_NOINLINE const char* TcParser::FastGtS2(PROTOBUF_TC_PARAM_DECL) { template const char* TcParser::LazyMessage(PROTOBUF_TC_PARAM_DECL) { - GOOGLE_LOG(FATAL) << "Unimplemented"; + GOOGLE_ABSL_LOG(FATAL) << "Unimplemented"; return nullptr; } @@ -741,7 +741,7 @@ Parse64FallbackPair(const char* p, int64_t res1) { // On x86-64, a shld from a single register filled with enough 1s in the high // bits can accomplish all this in one instruction. It so happens that res1 // has 57 high bits of ones, which is enough for the largest shift done. - GOOGLE_DCHECK_EQ(res1 >> 7, -1); + GOOGLE_ABSL_DCHECK_EQ(res1 >> 7, -1); uint64_t ones = res1; // save the high 1 bits from res1 (input to SHLD) int64_t res2, res3; // accumulated result chunks @@ -1783,8 +1783,8 @@ bool TcParser::ChangeOneof(const TcParseTableBase* table, case field_layout::kRepSString: case field_layout::kRepIString: default: - GOOGLE_LOG(DFATAL) << "string rep not handled: " - << (current_rep >> field_layout::kRepShift); + GOOGLE_ABSL_LOG(DFATAL) << "string rep not handled: " + << (current_rep >> field_layout::kRepShift); return true; } } else if (current_kind == field_layout::kFkMessage) { @@ -1798,8 +1798,8 @@ bool TcParser::ChangeOneof(const TcParseTableBase* table, break; } default: - GOOGLE_LOG(DFATAL) << "message rep not handled: " - << (current_rep >> field_layout::kRepShift); + GOOGLE_ABSL_LOG(DFATAL) << "message rep not handled: " + << (current_rep >> field_layout::kRepShift); break; } } @@ -1855,7 +1855,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpFixed(PROTOBUF_TC_PARAM_DECL) { PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS); } } else { - GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep32Bits)); + GOOGLE_ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep32Bits)); if (decoded_wiretype != WireFormatLite::WIRETYPE_FIXED32) { PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS); } @@ -1907,7 +1907,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedFixed( ptr2 = ReadTag(ptr, &next_tag); } while (next_tag == decoded_tag); } else { - GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep32Bits)); + GOOGLE_ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep32Bits)); if (decoded_wiretype != WireFormatLite::WIRETYPE_FIXED32) { PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS); } @@ -1947,7 +1947,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpPackedFixed(PROTOBUF_TC_PARAM_DECL) { auto& field = RefAt>(msg, entry.offset); ptr = ctx->ReadPackedFixed(ptr, size, &field); } else { - GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep32Bits)); + GOOGLE_ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep32Bits)); auto& field = RefAt>(msg, entry.offset); ptr = ctx->ReadPackedFixed(ptr, size, &field); } @@ -2013,7 +2013,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpVarint(PROTOBUF_TC_PARAM_DECL) { } else if (rep == field_layout::kRep32Bits) { RefAt(base, entry.offset) = static_cast(tmp); } else { - GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); + GOOGLE_ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); RefAt(base, entry.offset) = static_cast(tmp); } @@ -2075,7 +2075,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedVarint( if (ptr2 == nullptr) return Error(PROTOBUF_TC_PARAM_PASS); } while (next_tag == decoded_tag); } else { - GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); + GOOGLE_ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); auto& field = RefAt>(msg, entry.offset); const char* ptr2 = ptr; uint32_t next_tag; @@ -2135,7 +2135,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpPackedVarint(PROTOBUF_TC_PARAM_DECL) { }); } } else { - GOOGLE_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); + GOOGLE_ABSL_DCHECK_EQ(rep, static_cast(field_layout::kRep8Bits)); auto* field = &RefAt>(msg, entry.offset); return ctx->ReadPackedVarint( ptr, [field](uint64_t value) { field->Add(value); }); @@ -2293,7 +2293,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedString( #ifndef NDEBUG default: - GOOGLE_LOG(FATAL) << "Unsupported repeated string rep: " << rep; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported repeated string rep: " << rep; break; #endif } @@ -2302,7 +2302,7 @@ PROTOBUF_NOINLINE const char* TcParser::MpRepeatedString( } const char* TcParser::MpLazyMessage(PROTOBUF_TC_PARAM_DECL) { - GOOGLE_LOG(FATAL) << "Unimplemented"; + GOOGLE_ABSL_LOG(FATAL) << "Unimplemented"; return nullptr; } @@ -2369,7 +2369,8 @@ PROTOBUF_NOINLINE const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) { if ((type_card & field_layout::kTvMask) == field_layout::kTvDefault) { def = table->field_aux(&entry)->message_default(); } else { - GOOGLE_DCHECK_EQ(type_card & field_layout::kTvMask, +field_layout::kTvWeakPtr); + GOOGLE_ABSL_DCHECK_EQ(type_card & field_layout::kTvMask, + +field_layout::kTvWeakPtr); def = table->field_aux(&entry)->message_default_weak(); } field = def->New(msg->GetArenaForAllocation()); @@ -2384,8 +2385,8 @@ PROTOBUF_NOINLINE const char* TcParser::MpMessage(PROTOBUF_TC_PARAM_DECL) { const char* TcParser::MpRepeatedMessage(PROTOBUF_TC_PARAM_DECL) { const auto& entry = RefAt(table, data.entry_offset()); const uint16_t type_card = entry.type_card; - GOOGLE_DCHECK_EQ(type_card & field_layout::kFcMask, - static_cast(field_layout::kFcRepeated)); + GOOGLE_ABSL_DCHECK_EQ(type_card & field_layout::kFcMask, + static_cast(field_layout::kFcRepeated)); const uint32_t decoded_tag = data.tag(); const uint32_t decoded_wiretype = decoded_tag & 7; const uint16_t rep = type_card & field_layout::kRepMask; @@ -2427,7 +2428,8 @@ const char* TcParser::MpRepeatedMessage(PROTOBUF_TC_PARAM_DECL) { if ((type_card & field_layout::kTvMask) == field_layout::kTvDefault) { def = aux.message_default(); } else { - GOOGLE_DCHECK_EQ(type_card & field_layout::kTvMask, +field_layout::kTvWeakPtr); + GOOGLE_ABSL_DCHECK_EQ(type_card & field_layout::kTvMask, + +field_layout::kTvWeakPtr); def = aux.message_default_weak(); } MessageLite* value = field.Add>(def); diff --git a/src/google/protobuf/generated_message_tctable_lite_test.cc b/src/google/protobuf/generated_message_tctable_lite_test.cc index 56b0cea5cdef..3a33084fc3d3 100644 --- a/src/google/protobuf/generated_message_tctable_lite_test.cc +++ b/src/google/protobuf/generated_message_tctable_lite_test.cc @@ -163,7 +163,7 @@ TEST_F(FindFieldEntryTest, SequentialFieldRange) { IsEntryForFieldNum(&table, i, table_field_numbers)); } for (int i : {0, 1, 6, 7, 110, 112, 500000000}) { - GOOGLE_LOG(WARNING) << "Field " << i; + GOOGLE_ABSL_LOG(WARNING) << "Field " << i; EXPECT_THAT(FindFieldEntry(table, i), Eq(nullptr)); } } diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc index 4dd5ccbdb01a..0884b8e19a44 100644 --- a/src/google/protobuf/generated_message_util.cc +++ b/src/google/protobuf/generated_message_util.cc @@ -317,7 +317,7 @@ class AccessorHelper { }; void SerializeNotImplemented(int field) { - GOOGLE_LOG(FATAL) << "Not implemented field number " << field; + GOOGLE_ABSL_LOG(FATAL) << "Not implemented field number " << field; } // When switching to c++11 we should make these constexpr functions @@ -389,9 +389,9 @@ void GenericSwap(MessageLite* m1, MessageLite* m2) { MessageLite* GetOwnedMessageInternal(Arena* message_arena, MessageLite* submessage, Arena* submessage_arena) { - GOOGLE_DCHECK(Arena::InternalGetOwningArena(submessage) == submessage_arena); - GOOGLE_DCHECK(message_arena != submessage_arena); - GOOGLE_DCHECK_EQ(submessage_arena, nullptr); + GOOGLE_ABSL_DCHECK(Arena::InternalGetOwningArena(submessage) == submessage_arena); + GOOGLE_ABSL_DCHECK(message_arena != submessage_arena); + GOOGLE_ABSL_DCHECK_EQ(submessage_arena, nullptr); if (message_arena != nullptr && submessage_arena == nullptr) { message_arena->Own(submessage); return submessage; diff --git a/src/google/protobuf/inlined_string_field.h b/src/google/protobuf/inlined_string_field.h index a6d904ac2211..ba7b9386bd71 100644 --- a/src/google/protobuf/inlined_string_field.h +++ b/src/google/protobuf/inlined_string_field.h @@ -34,8 +34,8 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/port.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/string_view.h" #include "google/protobuf/arenastring.h" #include "google/protobuf/message_lite.h" diff --git a/src/google/protobuf/inlined_string_field_unittest.cc b/src/google/protobuf/inlined_string_field_unittest.cc index dbcb9d3b4010..1a7fcdeabe59 100644 --- a/src/google/protobuf/inlined_string_field_unittest.cc +++ b/src/google/protobuf/inlined_string_field_unittest.cc @@ -38,9 +38,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arenastring.h" #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/string_view.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" diff --git a/src/google/protobuf/lazy_field_lite.cc b/src/google/protobuf/lazy_field_lite.cc index 18305233afcf..3293b21f1125 100644 --- a/src/google/protobuf/lazy_field_lite.cc +++ b/src/google/protobuf/lazy_field_lite.cc @@ -59,7 +59,7 @@ inline int GetInitDepth(LazyVerifyOption option) { template inline bool ParseWithOuterContextImpl(const T& input, LazyVerifyOption option, ParseContext* ctx, MessageLite* message) { - GOOGLE_DCHECK(ctx == nullptr || !ctx->AliasingEnabled()); + GOOGLE_ABSL_DCHECK(ctx == nullptr || !ctx->AliasingEnabled()); // Create local context with depth. const char* ptr; @@ -137,9 +137,10 @@ bool LazyField::ParseWithOuterContext(MessageLite* message, } void LazyField::LogParseError(const MessageLite* message) { - GOOGLE_LOG_EVERY_N(INFO, 100) << "Lazy parsing failed for " << message->GetTypeName() - << " error=" << message->InitializationErrorString() - << " (N = " << COUNTER << ")"; + GOOGLE_ABSL_LOG_EVERY_N(INFO, 100) + << "Lazy parsing failed for " << message->GetTypeName() + << " error=" << message->InitializationErrorString() + << " (N = " << COUNTER << ")"; } } // namespace internal diff --git a/src/google/protobuf/lite_unittest.cc b/src/google/protobuf/lite_unittest.cc index ac6c893beec6..75f5446bccd0 100644 --- a/src/google/protobuf/lite_unittest.cc +++ b/src/google/protobuf/lite_unittest.cc @@ -35,8 +35,8 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/match.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena_test_util.h" diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 43cb58037bdf..aedd11695360 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -292,7 +292,7 @@ inline bool TableEntryIsTooLong(NodeBase* node) { node = node->next; } while (node != nullptr); // Invariant: no linked list ever is more than kMaxLength in length. - GOOGLE_DCHECK_LE(count, kMaxLength); + GOOGLE_ABSL_DCHECK_LE(count, kMaxLength); return count >= kMaxLength; } @@ -331,21 +331,21 @@ inline bool TableEntryIsNonEmptyList(TableEntryPtr entry) { return !TableEntryIsEmpty(entry) && TableEntryIsList(entry); } inline NodeBase* TableEntryToNode(TableEntryPtr entry) { - GOOGLE_DCHECK(TableEntryIsList(entry)); + GOOGLE_ABSL_DCHECK(TableEntryIsList(entry)); return reinterpret_cast(static_cast(entry)); } inline TableEntryPtr NodeToTableEntry(NodeBase* node) { - GOOGLE_DCHECK((reinterpret_cast(node) & 1) == 0); + GOOGLE_ABSL_DCHECK((reinterpret_cast(node) & 1) == 0); return static_cast(reinterpret_cast(node)); } template Tree* TableEntryToTree(TableEntryPtr entry) { - GOOGLE_DCHECK(TableEntryIsTree(entry)); + GOOGLE_ABSL_DCHECK(TableEntryIsTree(entry)); return reinterpret_cast(static_cast(entry) - 1); } template TableEntryPtr TreeToTableEntry(Tree* node) { - GOOGLE_DCHECK((reinterpret_cast(node) & 1) == 0); + GOOGLE_ABSL_DCHECK((reinterpret_cast(node) & 1) == 0); return static_cast(reinterpret_cast(node) | 1); } @@ -482,8 +482,8 @@ class KeyMapBase { // Advance through buckets, looking for the first that isn't empty. // If nothing non-empty is found then leave node_ == nullptr. void SearchFrom(size_type start_bucket) { - GOOGLE_DCHECK(m_->index_of_first_non_null_ == m_->num_buckets_ || - !m_->TableEntryIsEmpty(m_->index_of_first_non_null_)); + GOOGLE_ABSL_DCHECK(m_->index_of_first_non_null_ == m_->num_buckets_ || + !m_->TableEntryIsEmpty(m_->index_of_first_non_null_)); for (size_type i = start_bucket; i < m_->num_buckets_; ++i) { TableEntryPtr entry = m_->table_[i]; if (entry == TableEntryPtr{}) continue; @@ -492,7 +492,7 @@ class KeyMapBase { node_ = static_cast(TableEntryToNode(entry)); } else { Tree* tree = TableEntryToTree(entry); - GOOGLE_DCHECK(!tree->empty()); + GOOGLE_ABSL_DCHECK(!tree->empty()); node_ = static_cast(tree->begin()->second); } return; @@ -547,12 +547,12 @@ class KeyMapBase { TreeIterator tree_it; const bool is_list = revalidate_if_necessary(b, node, &tree_it); if (is_list) { - GOOGLE_DCHECK(TableEntryIsNonEmptyList(b)); + GOOGLE_ABSL_DCHECK(TableEntryIsNonEmptyList(b)); auto* head = TableEntryToNode(table_[b]); head = EraseFromLinkedList(node, head); table_[b] = NodeToTableEntry(head); } else { - GOOGLE_DCHECK(this->TableEntryIsTree(b)); + GOOGLE_ABSL_DCHECK(this->TableEntryIsTree(b)); Tree* tree = internal::TableEntryToTree(this->table_[b]); if (tree_it != tree->begin()) { auto* prev = std::prev(tree_it)->second; @@ -609,13 +609,13 @@ class KeyMapBase { // Requires count(*KeyPtrFromNodePtr(node)) == 0 and that b is the correct // bucket. num_elements_ is not modified. void InsertUnique(size_type b, KeyNode* node) { - GOOGLE_DCHECK(index_of_first_non_null_ == num_buckets_ || - !TableEntryIsEmpty(index_of_first_non_null_)); + GOOGLE_ABSL_DCHECK(index_of_first_non_null_ == num_buckets_ || + !TableEntryIsEmpty(index_of_first_non_null_)); // In practice, the code that led to this point may have already // determined whether we are inserting into an empty list, a short list, // or whatever. But it's probably cheap enough to recompute that here; // it's likely that we're inserting into an empty or short list. - GOOGLE_DCHECK(FindHelper(node->key()).node == nullptr); + GOOGLE_ABSL_DCHECK(FindHelper(node->key()).node == nullptr); if (TableEntryIsEmpty(b)) { InsertUniqueInList(b, node); index_of_first_non_null_ = (std::min)(index_of_first_non_null_, b); @@ -625,7 +625,7 @@ class KeyMapBase { if (TableEntryIsNonEmptyList(b)) { TreeConvert(b); } - GOOGLE_DCHECK(TableEntryIsTree(b)) + GOOGLE_ABSL_DCHECK(TableEntryIsTree(b)) << (void*)table_[b] << " " << (uintptr_t)table_[b]; InsertUniqueInTree(b, node); index_of_first_non_null_ = (std::min)(index_of_first_non_null_, b); @@ -725,7 +725,7 @@ class KeyMapBase { return; } - GOOGLE_DCHECK_GE(new_num_buckets, kMinTableSize); + GOOGLE_ABSL_DCHECK_GE(new_num_buckets, kMinTableSize); const auto old_table = table_; const size_type old_table_size = num_buckets_; num_buckets_ = new_num_buckets; @@ -772,12 +772,12 @@ class KeyMapBase { } void TreeConvert(size_type b) { - GOOGLE_DCHECK(!TableEntryIsTree(b)); + GOOGLE_ABSL_DCHECK(!TableEntryIsTree(b)); Tree* tree = Arena::Create(alloc_.arena(), typename Tree::key_compare(), typename Tree::allocator_type(alloc_)); size_type count = CopyListToTree(b, tree); - GOOGLE_DCHECK_EQ(count, tree->size()); + GOOGLE_ABSL_DCHECK_EQ(count, tree->size()); table_[b] = TreeToTableEntry(tree); // Relink the nodes. NodeBase* next = nullptr; @@ -852,8 +852,8 @@ class KeyMapBase { } TableEntryPtr* CreateEmptyTable(size_type n) { - GOOGLE_DCHECK(n >= kMinTableSize); - GOOGLE_DCHECK_EQ(n & (n - 1), 0u); + GOOGLE_ABSL_DCHECK(n >= kMinTableSize); + GOOGLE_ABSL_DCHECK_EQ(n & (n - 1), 0u); TableEntryPtr* result = Alloc(n); memset(result, 0, n * sizeof(result[0])); return result; @@ -1197,7 +1197,7 @@ class Map { } void erase(iterator it) { - GOOGLE_DCHECK_EQ(it.m_, this); + GOOGLE_ABSL_DCHECK_EQ(it.m_, this); auto* node = static_cast(it.node_); this->erase_no_destroy(it.bucket_index_, node); DestroyNode(node); @@ -1407,14 +1407,14 @@ class Map { template const T& at(const key_arg& key) const { const_iterator it = find(key); - GOOGLE_CHECK(it != end()) << "key not found: " << static_cast(key); + GOOGLE_ABSL_CHECK(it != end()) << "key not found: " << static_cast(key); return it->second; } template T& at(const key_arg& key) { iterator it = find(key); - GOOGLE_CHECK(it != end()) << "key not found: " << static_cast(key); + GOOGLE_ABSL_CHECK(it != end()) << "key not found: " << static_cast(key); return it->second; } diff --git a/src/google/protobuf/map_field.cc b/src/google/protobuf/map_field.cc index b34010491bef..c15222f52589 100644 --- a/src/google/protobuf/map_field.cc +++ b/src/google/protobuf/map_field.cc @@ -74,8 +74,8 @@ void MapFieldBase::SwapState(MapFieldBase* other) { void SwapRepeatedPtrToNull(RepeatedPtrField** from, RepeatedPtrField** to, Arena* from_arena, Arena* to_arena) { - GOOGLE_DCHECK(*from != nullptr); - GOOGLE_DCHECK(*to == nullptr); + GOOGLE_ABSL_DCHECK(*from != nullptr); + GOOGLE_ABSL_DCHECK(*to == nullptr); *to = Arena::CreateMessage >(to_arena); **to = std::move(**from); if (from_arena == nullptr) { @@ -104,7 +104,7 @@ void MapFieldBase::Swap(MapFieldBase* other) { } void MapFieldBase::UnsafeShallowSwap(MapFieldBase* other) { - GOOGLE_DCHECK_EQ(arena_, other->arena_); + GOOGLE_ABSL_DCHECK_EQ(arena_, other->arena_); InternalSwap(other); } @@ -363,7 +363,7 @@ void DynamicMapField::SetMapIteratorValue(MapIterator* map_iter) const { } void DynamicMapField::MergeFrom(const MapFieldBase& other) { - GOOGLE_DCHECK(IsMapValid() && other.IsMapValid()); + GOOGLE_ABSL_DCHECK(IsMapValid() && other.IsMapValid()); Map* map = MutableMap(); const DynamicMapField& other_field = reinterpret_cast(other); @@ -478,7 +478,7 @@ void DynamicMapField::SyncRepeatedFieldWithMapNoLock() const { case FieldDescriptor::CPPTYPE_FLOAT: case FieldDescriptor::CPPTYPE_ENUM: case FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; break; } const MapValueRef& map_val = it->second; @@ -561,7 +561,7 @@ void DynamicMapField::SyncMapWithRepeatedFieldNoLock() const { case FieldDescriptor::CPPTYPE_FLOAT: case FieldDescriptor::CPPTYPE_ENUM: case FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; break; } diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h index 0f1a607f3f1a..7aa8194cbaa7 100644 --- a/src/google/protobuf/map_field.h +++ b/src/google/protobuf/map_field.h @@ -67,13 +67,14 @@ class MapIterator; #pragma warning(disable : 4265) #endif // _MSC_VER -#define TYPE_CHECK(EXPECTEDTYPE, METHOD) \ - if (type() != EXPECTEDTYPE) { \ - GOOGLE_LOG(FATAL) << "Protocol Buffer map usage error:\n" \ - << METHOD << " type does not match\n" \ - << " Expected : " \ - << FieldDescriptor::CppTypeName(EXPECTEDTYPE) << "\n" \ - << " Actual : " << FieldDescriptor::CppTypeName(type()); \ +#define TYPE_CHECK(EXPECTEDTYPE, METHOD) \ + if (type() != EXPECTEDTYPE) { \ + GOOGLE_ABSL_LOG(FATAL) << "Protocol Buffer map usage error:\n" \ + << METHOD << " type does not match\n" \ + << " Expected : " \ + << FieldDescriptor::CppTypeName(EXPECTEDTYPE) << "\n" \ + << " Actual : " \ + << FieldDescriptor::CppTypeName(type()); \ } // MapKey is an union type for representing any possible @@ -96,9 +97,9 @@ class PROTOBUF_EXPORT MapKey { FieldDescriptor::CppType type() const { if (type_ == FieldDescriptor::CppType()) { - GOOGLE_LOG(FATAL) << "Protocol Buffer map usage error:\n" - << "MapKey::type MapKey is not initialized. " - << "Call set methods to initialize MapKey."; + GOOGLE_ABSL_LOG(FATAL) << "Protocol Buffer map usage error:\n" + << "MapKey::type MapKey is not initialized. " + << "Call set methods to initialize MapKey."; } return type_; } @@ -157,14 +158,14 @@ class PROTOBUF_EXPORT MapKey { if (type_ != other.type_) { // We could define a total order that handles this case, but // there currently no need. So, for now, fail. - GOOGLE_LOG(FATAL) << "Unsupported: type mismatch"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported: type mismatch"; } switch (type()) { case FieldDescriptor::CPPTYPE_DOUBLE: case FieldDescriptor::CPPTYPE_FLOAT: case FieldDescriptor::CPPTYPE_ENUM: case FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; return false; case FieldDescriptor::CPPTYPE_STRING: return val_.string_value_.get() < other.val_.string_value_.get(); @@ -185,14 +186,14 @@ class PROTOBUF_EXPORT MapKey { bool operator==(const MapKey& other) const { if (type_ != other.type_) { // To be consistent with operator<, we don't allow this either. - GOOGLE_LOG(FATAL) << "Unsupported: type mismatch"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported: type mismatch"; } switch (type()) { case FieldDescriptor::CPPTYPE_DOUBLE: case FieldDescriptor::CPPTYPE_FLOAT: case FieldDescriptor::CPPTYPE_ENUM: case FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; break; case FieldDescriptor::CPPTYPE_STRING: return val_.string_value_.get() == other.val_.string_value_.get(); @@ -207,7 +208,7 @@ class PROTOBUF_EXPORT MapKey { case FieldDescriptor::CPPTYPE_BOOL: return val_.bool_value_ == other.val_.bool_value_; } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return false; } @@ -218,7 +219,7 @@ class PROTOBUF_EXPORT MapKey { case FieldDescriptor::CPPTYPE_FLOAT: case FieldDescriptor::CPPTYPE_ENUM: case FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; break; case FieldDescriptor::CPPTYPE_STRING: *val_.string_value_.get_mutable() = other.val_.string_value_.get(); @@ -284,7 +285,7 @@ struct hash<::PROTOBUF_NAMESPACE_ID::MapKey> { case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_FLOAT: case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_ENUM: case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; break; case ::PROTOBUF_NAMESPACE_ID::FieldDescriptor::CPPTYPE_STRING: return hash()(map_key.GetStringValue()); @@ -308,7 +309,7 @@ struct hash<::PROTOBUF_NAMESPACE_ID::MapKey> { return hash()(map_key.GetBoolValue()); } } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return 0; } bool operator()(const ::PROTOBUF_NAMESPACE_ID::MapKey& map_key1, @@ -351,7 +352,7 @@ class PROTOBUF_EXPORT MapFieldBase { protected: ~MapFieldBase() { // "protected" stops users from deleting a `MapFieldBase *` - GOOGLE_DCHECK(repeated_field_ == nullptr); + GOOGLE_ABSL_DCHECK(repeated_field_ == nullptr); } void Destruct(); @@ -427,7 +428,7 @@ class PROTOBUF_EXPORT MapFieldBase { // MapFieldBase-derived object, and there is no synchronization going // on between them, tsan will alert. #if defined(__SANITIZE_THREAD__) || defined(THREAD_SANITIZER) - void ConstAccess() const { GOOGLE_CHECK_EQ(seq1_, seq2_); } + void ConstAccess() const { GOOGLE_ABSL_CHECK_EQ(seq1_, seq2_); } void MutableAccess() { if (seq1_ & 1) { seq2_ = ++seq1_; @@ -767,7 +768,7 @@ class PROTOBUF_EXPORT MapValueConstRef { FieldDescriptor::CppType type() const { if (type_ == FieldDescriptor::CppType() || data_ == nullptr) { - GOOGLE_LOG(FATAL) + GOOGLE_ABSL_LOG(FATAL) << "Protocol Buffer map usage error:\n" << "MapValueConstRef::type MapValueConstRef is not initialized."; } diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h index 9311abdd81a8..17f728c242b8 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -142,7 +142,7 @@ template void TypeDefinedMapFieldBase::InitializeIterator( MapIterator* map_iter) const { map_iter->iter_ = new typename Map::const_iterator; - GOOGLE_CHECK(map_iter->iter_ != nullptr); + GOOGLE_ABSL_CHECK(map_iter->iter_ != nullptr); } template @@ -345,7 +345,7 @@ void MapField* repeated_field = reinterpret_cast*>( this->MapFieldBase::repeated_field_); - GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != nullptr); + GOOGLE_ABSL_CHECK(this->MapFieldBase::repeated_field_ != nullptr); map->clear(); for (typename RepeatedPtrField::iterator it = repeated_field->begin(); diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h index fe2f2b26fccf..799b621cf966 100644 --- a/src/google/protobuf/map_field_lite.h +++ b/src/google/protobuf/map_field_lite.h @@ -193,7 +193,7 @@ struct MapEntryToMapField< #ifndef NDEBUG inline PROTOBUF_NOINLINE void MapFieldLiteNotDestructed(void* map_field_lite) { bool proper_destruct = false; - GOOGLE_CHECK(proper_destruct) << map_field_lite; + GOOGLE_ABSL_CHECK(proper_destruct) << map_field_lite; } #endif diff --git a/src/google/protobuf/map_field_test.cc b/src/google/protobuf/map_field_test.cc index 193edbee1ef1..1ec6c9bd3a9a 100644 --- a/src/google/protobuf/map_field_test.cc +++ b/src/google/protobuf/map_field_test.cc @@ -31,7 +31,6 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arena.h" #include "google/protobuf/map.h" #include "google/protobuf/map_field_inl.h" @@ -39,6 +38,7 @@ #include "google/protobuf/repeated_field.h" #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_format.h" #include "google/protobuf/arena_test_util.h" #include "google/protobuf/map_test_util.h" diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc index d45247687431..c57cf5c652bf 100644 --- a/src/google/protobuf/map_test.inc +++ b/src/google/protobuf/map_test.inc @@ -44,6 +44,7 @@ #include #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/descriptor.pb.h" @@ -399,7 +400,7 @@ TEST_F(MapImplTest, BeginIsFast) { frog += counter++; last_key = static_cast(frog) >= 0 ? static_cast(frog) : last_key ^ 1; - GOOGLE_DCHECK_GE(last_key, 0); + GOOGLE_ABSL_DCHECK_GE(last_key, 0); map[last_key] = last_key ^ 1; } std::vector times; @@ -407,7 +408,7 @@ TEST_F(MapImplTest, BeginIsFast) { // just in case one iteration is fast compared to the granularity of // our time keeping, we measure kChunkSize iterations per outer-loop iter. const int kChunkSize = 1000; - GOOGLE_CHECK_EQ(kTestSize % kChunkSize, 0); + GOOGLE_ABSL_CHECK_EQ(kTestSize % kChunkSize, 0); do { const int64_t start = Now(); for (int i = 0; i < kChunkSize; i++) { @@ -419,12 +420,12 @@ TEST_F(MapImplTest, BeginIsFast) { } } while (!map.empty()); if (times.size() < .99 * kTestSize / kChunkSize) { - GOOGLE_LOG(WARNING) << "Now() isn't helping us measure time"; + GOOGLE_ABSL_LOG(WARNING) << "Now() isn't helping us measure time"; return; } int64_t x0 = median(times.begin(), times.begin() + 9); int64_t x1 = median(times.begin() + times.size() - 9, times.end()); - GOOGLE_LOG(INFO) << "x0=" << x0 << ", x1=" << x1; + GOOGLE_ABSL_LOG(INFO) << "x0=" << x0 << ", x1=" << x1; // x1 will greatly exceed x0 if the code we just executed took O(n^2) time. // And we'll probably time out and never get here. So, this test is // intentionally loose: we check that x0 and x1 are within a factor of 8. @@ -516,7 +517,7 @@ static void TestOldVersusNewIterator(int skip, Map* m) { } if (it == m->end()) return; const IteratorType old = it; - GOOGLE_LOG(INFO) << "skip=" << skip << ", old->first=" << old->first; + GOOGLE_ABSL_LOG(INFO) << "skip=" << skip << ", old->first=" << old->first; const int target_size = initial_size < 100 ? initial_size * 5 : initial_size * 5 / 4; for (int i = 0; m->size() <= target_size; i++) { @@ -544,8 +545,8 @@ static void TestOldVersusNewIterator(int skip, Map* m) { // Create and test an n-element Map, with emphasis on iterator correctness. static void StressTestIterators(int n) { - GOOGLE_LOG(INFO) << "StressTestIterators " << n; - GOOGLE_CHECK_GT(n, 0); + GOOGLE_ABSL_LOG(INFO) << "StressTestIterators " << n; + GOOGLE_ABSL_CHECK_GT(n, 0); // Create a random-looking map of size n. Use non-negative integer keys. Map m; uint32_t frog = 123987 + n; @@ -557,7 +558,7 @@ static void StressTestIterators(int n) { frog += counter++; last_key = static_cast(frog) >= 0 ? static_cast(frog) : last_key ^ 1; - GOOGLE_DCHECK_GE(last_key, 0); + GOOGLE_ABSL_DCHECK_GE(last_key, 0); m[last_key] = last_key ^ 1; } // Test it. @@ -3833,7 +3834,7 @@ TEST(MapSerializationTest, DeterministicSubmessage) { UNITTEST::TestMaps t; const std::string filename = "golden_message_maps"; std::string golden; - GOOGLE_CHECK_OK(File::GetContents( + GOOGLE_ABSL_CHECK_OK(File::GetContents( TestUtil::GetTestDataPath("third_party/protobuf/testdata/" + filename), &golden, true)); t.ParseFromString(golden); @@ -3875,7 +3876,7 @@ TEST(TextFormatMapTest, DynamicMessage) { tester.SetMapFieldsViaReflection(message.get()); std::string expected_text; - GOOGLE_CHECK_OK( + GOOGLE_ABSL_CHECK_OK( File::GetContents(TestUtil::GetTestDataPath("third_party/protobuf/" "testdata/map_test_data.txt"), &expected_text, true)); @@ -3891,7 +3892,7 @@ TEST(TextFormatMapTest, Sorted) { tester.SetMapFieldsViaReflection(&message); std::string expected_text; - GOOGLE_CHECK_OK( + GOOGLE_ABSL_CHECK_OK( File::GetContents(TestUtil::GetTestDataPath("third_party/protobuf/" "testdata/map_test_data.txt"), &expected_text, true)); @@ -3911,12 +3912,12 @@ TEST(TextFormatMapTest, Sorted) { TEST(TextFormatMapTest, ParseCorruptedString) { std::string serialized_message; - GOOGLE_CHECK_OK(File::GetContents( + GOOGLE_ABSL_CHECK_OK(File::GetContents( TestUtil::GetTestDataPath( "third_party/protobuf/testdata/golden_message_maps"), &serialized_message, true)); UNITTEST::TestMaps message; - GOOGLE_CHECK(message.ParseFromString(serialized_message)); + GOOGLE_ABSL_CHECK(message.ParseFromString(serialized_message)); TestParseCorruptedString(message); TestParseCorruptedString(message); } @@ -3978,7 +3979,7 @@ TEST(TextFormatMapTest, NoDisableReflectionIterator) { const Reflection* map_entry_reflection = iter->GetReflection(); const FieldDescriptor* value_field_desc = iter->GetDescriptor()->map_value(); map_entry_reflection->SetInt32(&(*iter), value_field_desc, 2); - GOOGLE_LOG(INFO) << iter->DebugString(); + GOOGLE_ABSL_LOG(INFO) << iter->DebugString(); // In previous implementation, the new change won't be reflected in text // format, because the previous iterator has been invalidated. diff --git a/src/google/protobuf/map_test_util_impl.h b/src/google/protobuf/map_test_util_impl.h index ff025b6eee5e..9f12f53a478d 100644 --- a/src/google/protobuf/map_test_util_impl.h +++ b/src/google/protobuf/map_test_util_impl.h @@ -31,7 +31,6 @@ #ifndef GOOGLE_PROTOBUF_MAP_TEST_UTIL_IMPL_H__ #define GOOGLE_PROTOBUF_MAP_TEST_UTIL_IMPL_H__ -#include "google/protobuf/stubs/logging.h" #include diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index ddb542111b2d..b2ae719b9fd2 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -37,10 +37,11 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "absl/base/casts.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_join.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" @@ -105,7 +106,7 @@ void Message::CopyFrom(const Message& from) { if (class_to == nullptr || class_to != class_from) { const Descriptor* descriptor = GetDescriptor(); - GOOGLE_CHECK_EQ(from.GetDescriptor(), descriptor) + GOOGLE_ABSL_CHECK_EQ(from.GetDescriptor(), descriptor) << ": Tried to copy from a message with a different type. " "to: " << descriptor->full_name() @@ -132,7 +133,7 @@ void Message::FailIfCopyFromDescendant(Message& to, const Message& from) { bool same_message_owned_arena = to.GetOwningArena() == nullptr && arena != nullptr && arena == from.GetOwningArena(); - GOOGLE_CHECK(!same_message_owned_arena && !internal::IsDescendant(to, from)) + GOOGLE_ABSL_CHECK(!same_message_owned_arena && !internal::IsDescendant(to, from)) << "Source of CopyFrom cannot be a descendant of the target."; } @@ -157,9 +158,9 @@ std::string Message::InitializationErrorString() const { } void Message::CheckInitialized() const { - GOOGLE_CHECK(IsInitialized()) << "Message of type \"" << GetDescriptor()->full_name() - << "\" is missing required fields: " - << InitializationErrorString(); + GOOGLE_ABSL_CHECK(IsInitialized()) + << "Message of type \"" << GetDescriptor()->full_name() + << "\" is missing required fields: " << InitializationErrorString(); } void Message::DiscardUnknownFields() { @@ -191,9 +192,9 @@ size_t Message::ByteSizeLong() const { } void Message::SetCachedSize(int /* size */) const { - GOOGLE_LOG(FATAL) << "Message class \"" << GetDescriptor()->full_name() - << "\" implements neither SetCachedSize() nor ByteSize(). " - "Must implement one or the other."; + GOOGLE_ABSL_LOG(FATAL) << "Message class \"" << GetDescriptor()->full_name() + << "\" implements neither SetCachedSize() nor ByteSize(). " + "Must implement one or the other."; } size_t Message::ComputeUnknownFieldsSize( @@ -226,7 +227,7 @@ namespace internal { void* CreateSplitMessageGeneric(Arena* arena, const void* default_split, size_t size, const void* message, const void* default_message) { - GOOGLE_DCHECK_NE(message, default_message); + GOOGLE_ABSL_DCHECK_NE(message, default_message); void* split = (arena == nullptr) ? ::operator new(size) : arena->AllocateAligned(size); memcpy(split, default_split, size); @@ -315,13 +316,13 @@ GeneratedMessageFactory* GeneratedMessageFactory::singleton() { void GeneratedMessageFactory::RegisterFile( const google::protobuf::internal::DescriptorTable* table) { if (!files_.insert(table).second) { - GOOGLE_LOG(FATAL) << "File is already registered: " << table->filename; + GOOGLE_ABSL_LOG(FATAL) << "File is already registered: " << table->filename; } } void GeneratedMessageFactory::RegisterType(const Descriptor* descriptor, const Message* prototype) { - GOOGLE_DCHECK_EQ(descriptor->file()->pool(), DescriptorPool::generated_pool()) + GOOGLE_ABSL_DCHECK_EQ(descriptor->file()->pool(), DescriptorPool::generated_pool()) << "Tried to register a non-generated type with the generated " "type registry."; @@ -330,7 +331,8 @@ void GeneratedMessageFactory::RegisterType(const Descriptor* descriptor, // the mutex. mutex_.AssertHeld(); if (!type_map_.try_emplace(descriptor, prototype).second) { - GOOGLE_LOG(DFATAL) << "Type is already registered: " << descriptor->full_name(); + GOOGLE_ABSL_LOG(DFATAL) << "Type is already registered: " + << descriptor->full_name(); } } @@ -350,9 +352,9 @@ const Message* GeneratedMessageFactory::GetPrototype(const Descriptor* type) { const internal::DescriptorTable* registration_data = FindInFileMap(type->file()->name()); if (registration_data == nullptr) { - GOOGLE_LOG(DFATAL) << "File appears to be in generated pool but wasn't " - "registered: " - << type->file()->name(); + GOOGLE_ABSL_LOG(DFATAL) << "File appears to be in generated pool but wasn't " + "registered: " + << type->file()->name(); return nullptr; } @@ -368,8 +370,8 @@ const Message* GeneratedMessageFactory::GetPrototype(const Descriptor* type) { } if (result == nullptr) { - GOOGLE_LOG(DFATAL) << "Type appears to be in generated pool but wasn't " - << "registered: " << type->full_name(); + GOOGLE_ABSL_LOG(DFATAL) << "Type appears to be in generated pool but wasn't " + << "registered: " << type->full_name(); } return result; @@ -402,7 +404,7 @@ T* GetSingleton() { const internal::RepeatedFieldAccessor* Reflection::RepeatedFieldAccessor( const FieldDescriptor* field) const { - GOOGLE_CHECK(field->is_repeated()); + GOOGLE_ABSL_CHECK(field->is_repeated()); switch (field->cpp_type()) { #define HANDLE_PRIMITIVE_TYPE(TYPE, type) \ case FieldDescriptor::CPPTYPE_##TYPE: \ @@ -430,7 +432,7 @@ const internal::RepeatedFieldAccessor* Reflection::RepeatedFieldAccessor( return GetSingleton(); } } - GOOGLE_LOG(FATAL) << "Should not reach here."; + GOOGLE_ABSL_LOG(FATAL) << "Should not reach here."; return nullptr; } diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 2813c270095f..0ede96e8c9bd 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -276,8 +276,8 @@ class PROTOBUF_EXPORT Message : public MessageLite { // exact same class). virtual void MergeFrom(const Message& from); - // Verifies that IsInitialized() returns true. GOOGLE_CHECK-fails otherwise, with - // a nice error message. + // Verifies that IsInitialized() returns true. GOOGLE_ABSL_CHECK-fails otherwise, + // with a nice error message. void CheckInitialized() const; // Slowly build a list of all required fields that are not set. @@ -941,7 +941,7 @@ class PROTOBUF_EXPORT Reflection final { // take arbitrary integer values, and the legacy GetEnum() getter will // dynamically create an EnumValueDescriptor for any integer value without // one. If |false|, setting an unknown enum value via the integer-based - // setters results in undefined behavior (in practice, GOOGLE_DCHECK-fails). + // setters results in undefined behavior (in practice, GOOGLE_ABSL_DCHECK-fails). // // Generic code that uses reflection to handle messages with enum fields // should check this flag before using the integer-based setter, and either @@ -1546,7 +1546,7 @@ const Type& Reflection::DefaultRaw(const FieldDescriptor* field) const { uint32_t Reflection::GetOneofCase( const Message& message, const OneofDescriptor* oneof_descriptor) const { - GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); + GOOGLE_ABSL_DCHECK(!oneof_descriptor->is_synthetic()); return internal::GetConstRefAtOffset( message, schema_.GetOneofCaseOffset(oneof_descriptor)); } @@ -1558,20 +1558,20 @@ bool Reflection::HasOneofField(const Message& message, } const void* Reflection::GetSplitField(const Message* message) const { - GOOGLE_DCHECK(schema_.IsSplit()); + GOOGLE_ABSL_DCHECK(schema_.IsSplit()); return *internal::GetConstPointerAtOffset(message, schema_.SplitOffset()); } void** Reflection::MutableSplitField(Message* message) const { - GOOGLE_DCHECK(schema_.IsSplit()); + GOOGLE_ABSL_DCHECK(schema_.IsSplit()); return internal::GetPointerAtOffset(message, schema_.SplitOffset()); } template const Type& Reflection::GetRaw(const Message& message, const FieldDescriptor* field) const { - GOOGLE_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field)) + GOOGLE_ABSL_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field)) << "Field = " << field->full_name(); if (schema_.IsSplit(field)) { return *internal::GetConstPointerAtOffset( diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 624ab851058d..5e0ab8a3832a 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -42,9 +42,10 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arena.h" #include "absl/base/dynamic_annotations.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" #include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/str_cat.h" @@ -83,15 +84,15 @@ void ByteSizeConsistencyError(size_t byte_size_before_serialization, size_t byte_size_after_serialization, size_t bytes_produced_by_serialization, const MessageLite& message) { - GOOGLE_CHECK_EQ(byte_size_before_serialization, byte_size_after_serialization) + GOOGLE_ABSL_CHECK_EQ(byte_size_before_serialization, byte_size_after_serialization) << message.GetTypeName() << " was modified concurrently during serialization."; - GOOGLE_CHECK_EQ(bytes_produced_by_serialization, byte_size_before_serialization) + GOOGLE_ABSL_CHECK_EQ(bytes_produced_by_serialization, byte_size_before_serialization) << "Byte size calculation and serialization were inconsistent. This " "may indicate a bug in protocol buffers or it may be caused by " "concurrent modification of " << message.GetTypeName() << "."; - GOOGLE_LOG(FATAL) << "This shouldn't be called if all the sizes are equal."; + GOOGLE_ABSL_LOG(FATAL) << "This shouldn't be called if all the sizes are equal."; } std::string InitializationErrorMessage(absl::string_view action, @@ -120,7 +121,7 @@ inline bool CheckFieldPresence(const internal::ParseContext& ctx, } // namespace void MessageLite::LogInitializationErrorMessage() const { - GOOGLE_LOG(ERROR) << InitializationErrorMessage("parse", *this); + GOOGLE_ABSL_LOG(ERROR) << InitializationErrorMessage("parse", *this); } namespace internal { @@ -219,7 +220,7 @@ bool MessageLite::MergeFromImpl(io::CodedInputStream* input, if (PROTOBUF_PREDICT_FALSE(!ptr)) return false; ctx.BackUp(ptr); if (!ctx.EndedAtEndOfStream()) { - GOOGLE_DCHECK_NE(ctx.LastTag(), 1); // We can't end on a pushed limit. + GOOGLE_ABSL_DCHECK_NE(ctx.LastTag(), 1); // We can't end on a pushed limit. if (ctx.IsExceedingLimit(ptr)) return false; input->SetLastTag(ctx.LastTag()); } else { @@ -332,14 +333,14 @@ inline uint8_t* SerializeToArrayImpl(const MessageLite& msg, uint8_t* target, &ptr); ptr = msg._InternalSerialize(ptr, &out); out.Trim(ptr); - GOOGLE_DCHECK(!out.HadError() && stream.ByteCount() == size); + GOOGLE_ABSL_DCHECK(!out.HadError() && stream.ByteCount() == size); return target + size; } else { io::EpsCopyOutputStream out( target, size, io::CodedOutputStream::IsDefaultSerializationDeterministic()); uint8_t* res = msg._InternalSerialize(target, &out); - GOOGLE_DCHECK(target + size == res); + GOOGLE_ABSL_DCHECK(target + size == res); return res; } } @@ -351,7 +352,8 @@ uint8_t* MessageLite::SerializeWithCachedSizesToArray(uint8_t* target) const { } bool MessageLite::SerializeToCodedStream(io::CodedOutputStream* output) const { - GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + GOOGLE_ABSL_DCHECK(IsInitialized()) + << InitializationErrorMessage("serialize", *this); return SerializePartialToCodedStream(output); } @@ -359,8 +361,8 @@ bool MessageLite::SerializePartialToCodedStream( io::CodedOutputStream* output) const { const size_t size = ByteSizeLong(); // Force size to be cached. if (size > INT_MAX) { - GOOGLE_LOG(ERROR) << GetTypeName() - << " exceeded maximum protobuf size of 2GB: " << size; + GOOGLE_ABSL_LOG(ERROR) << GetTypeName() + << " exceeded maximum protobuf size of 2GB: " << size; return false; } @@ -381,7 +383,8 @@ bool MessageLite::SerializePartialToCodedStream( bool MessageLite::SerializeToZeroCopyStream( io::ZeroCopyOutputStream* output) const { - GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + GOOGLE_ABSL_DCHECK(IsInitialized()) + << InitializationErrorMessage("serialize", *this); return SerializePartialToZeroCopyStream(output); } @@ -389,8 +392,8 @@ bool MessageLite::SerializePartialToZeroCopyStream( io::ZeroCopyOutputStream* output) const { const size_t size = ByteSizeLong(); // Force size to be cached. if (size > INT_MAX) { - GOOGLE_LOG(ERROR) << GetTypeName() - << " exceeded maximum protobuf size of 2GB: " << size; + GOOGLE_ABSL_LOG(ERROR) << GetTypeName() + << " exceeded maximum protobuf size of 2GB: " << size; return false; } @@ -428,7 +431,8 @@ bool MessageLite::SerializePartialToOstream(std::ostream* output) const { } bool MessageLite::AppendToString(std::string* output) const { - GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + GOOGLE_ABSL_DCHECK(IsInitialized()) + << InitializationErrorMessage("serialize", *this); return AppendPartialToString(output); } @@ -436,8 +440,8 @@ bool MessageLite::AppendPartialToString(std::string* output) const { size_t old_size = output->size(); size_t byte_size = ByteSizeLong(); if (byte_size > INT_MAX) { - GOOGLE_LOG(ERROR) << GetTypeName() - << " exceeded maximum protobuf size of 2GB: " << byte_size; + GOOGLE_ABSL_LOG(ERROR) << GetTypeName() + << " exceeded maximum protobuf size of 2GB: " << byte_size; return false; } @@ -460,15 +464,16 @@ bool MessageLite::SerializePartialToString(std::string* output) const { } bool MessageLite::SerializeToArray(void* data, int size) const { - GOOGLE_DCHECK(IsInitialized()) << InitializationErrorMessage("serialize", *this); + GOOGLE_ABSL_DCHECK(IsInitialized()) + << InitializationErrorMessage("serialize", *this); return SerializePartialToArray(data, size); } bool MessageLite::SerializePartialToArray(void* data, int size) const { const size_t byte_size = ByteSizeLong(); if (byte_size > INT_MAX) { - GOOGLE_LOG(ERROR) << GetTypeName() - << " exceeded maximum protobuf size of 2GB: " << byte_size; + GOOGLE_ABSL_LOG(ERROR) << GetTypeName() + << " exceeded maximum protobuf size of 2GB: " << byte_size; return false; } if (size < static_cast(byte_size)) return false; diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 35db842b1140..663321a8b483 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -45,10 +45,10 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arena.h" #include "google/protobuf/port.h" #include "absl/base/call_once.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/string_view.h" #include "google/protobuf/explicitly_constructed.h" #include "google/protobuf/io/coded_stream.h" @@ -103,7 +103,7 @@ class GenericTypeHandler; // defined in repeated_field.h // computed size to a cached size. Since we don't proceed with serialization // if the total size was > INT_MAX, it is not important what this function // returns for inputs > INT_MAX. However this case should not error or -// GOOGLE_CHECK-fail, because the full size_t resolution is still returned from +// GOOGLE_ABSL_CHECK-fail, because the full size_t resolution is still returned from // ByteSizeLong() and checked against INT_MAX; we can catch the overflow // there. inline int ToCachedSize(size_t size) { return static_cast(size); } @@ -118,11 +118,11 @@ inline size_t FromIntSize(int size) { return static_cast(size); } -// For cases where a legacy function returns an integer size. We GOOGLE_DCHECK() +// For cases where a legacy function returns an integer size. We GOOGLE_ABSL_DCHECK() // that the conversion will fit within an integer; if this is false then we // are losing information. inline int ToIntSize(size_t size) { - GOOGLE_DCHECK_LE(size, static_cast(INT_MAX)); + GOOGLE_ABSL_DCHECK_LE(size, static_cast(INT_MAX)); return static_cast(size); } @@ -325,7 +325,7 @@ class PROTOBUF_EXPORT MessageLite { // Write a protocol buffer of this message to the given output. Returns // false on a write error. If the message is missing required fields, - // this may GOOGLE_CHECK-fail. + // this may GOOGLE_ABSL_CHECK-fail. bool SerializeToCodedStream(io::CodedOutputStream* output) const; // Like SerializeToCodedStream(), but allows missing required fields. bool SerializePartialToCodedStream(io::CodedOutputStream* output) const; diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc index 6ee6b8b6ebd5..c3a7eeaecdf5 100644 --- a/src/google/protobuf/message_unittest.inc +++ b/src/google/protobuf/message_unittest.inc @@ -1270,7 +1270,7 @@ TEST(MESSAGE_TEST_NAME, TestEnumParsers) { continue; } SCOPED_TRACE(value_desc->number()); - GOOGLE_CHECK_NE(value_desc->number(), kInvalidValue) + GOOGLE_ABSL_CHECK_NE(value_desc->number(), kInvalidValue) << "Invalid value is a real label."; auto encoded = EncodeEnumValue(field->number(), value_desc->number(), @@ -1416,13 +1416,13 @@ class TestInputStream final : public io::ZeroCopyInputStream { return true; } - void BackUp(int) override { GOOGLE_CHECK(false); } + void BackUp(int) override { GOOGLE_ABSL_CHECK(false); } bool Skip(int) override { - GOOGLE_CHECK(false); + GOOGLE_ABSL_CHECK(false); return false; } int64_t ByteCount() const override { - GOOGLE_CHECK(false); + GOOGLE_ABSL_CHECK(false); return 0; } diff --git a/src/google/protobuf/no_field_presence_test.cc b/src/google/protobuf/no_field_presence_test.cc index a02cd926018d..067f4082db84 100644 --- a/src/google/protobuf/no_field_presence_test.cc +++ b/src/google/protobuf/no_field_presence_test.cc @@ -392,9 +392,9 @@ TEST(NoFieldPresenceTest, HasFieldOneofsTest) { desc->FindFieldByName("oneof_nested_message"); const FieldDescriptor* desc_oneof_string = desc->FindFieldByName("oneof_string"); - GOOGLE_CHECK(desc_oneof_uint32 != nullptr); - GOOGLE_CHECK(desc_oneof_nested_message != nullptr); - GOOGLE_CHECK(desc_oneof_string != nullptr); + GOOGLE_ABSL_CHECK(desc_oneof_uint32 != nullptr); + GOOGLE_ABSL_CHECK(desc_oneof_nested_message != nullptr); + GOOGLE_ABSL_CHECK(desc_oneof_string != nullptr); EXPECT_EQ(false, r->HasField(message, desc_oneof_uint32)); EXPECT_EQ(false, r->HasField(message, desc_oneof_nested_message)); @@ -500,7 +500,7 @@ TEST(NoFieldPresenceTest, LazyMessageFieldHasBit) { const Reflection* r = message.GetReflection(); const Descriptor* desc = message.GetDescriptor(); const FieldDescriptor* field = desc->FindFieldByName("optional_lazy_message"); - GOOGLE_CHECK(field != nullptr); + GOOGLE_ABSL_CHECK(field != nullptr); EXPECT_EQ(false, message.has_optional_lazy_message()); EXPECT_EQ(false, r->HasField(message, field)); diff --git a/src/google/protobuf/parse_context.cc b/src/google/protobuf/parse_context.cc index 9e591ad91da6..393d0884d7b0 100644 --- a/src/google/protobuf/parse_context.cc +++ b/src/google/protobuf/parse_context.cc @@ -49,8 +49,8 @@ namespace { // Only call if at start of tag. bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { constexpr int kSlopBytes = EpsCopyInputStream::kSlopBytes; - GOOGLE_DCHECK_GE(overrun, 0); - GOOGLE_DCHECK_LE(overrun, kSlopBytes); + GOOGLE_ABSL_DCHECK_GE(overrun, 0); + GOOGLE_ABSL_DCHECK_LE(overrun, kSlopBytes); auto ptr = begin + overrun; auto end = begin + kSlopBytes; while (ptr < end) { @@ -101,7 +101,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { const char* EpsCopyInputStream::NextBuffer(int overrun, int depth) { if (next_chunk_ == nullptr) return nullptr; // We've reached end of stream. if (next_chunk_ != buffer_) { - GOOGLE_DCHECK(size_ > kSlopBytes); + GOOGLE_ABSL_DCHECK(size_ > kSlopBytes); // The chunk is large enough to be used directly buffer_end_ = next_chunk_ + size_ - kSlopBytes; auto res = next_chunk_; @@ -133,7 +133,7 @@ const char* EpsCopyInputStream::NextBuffer(int overrun, int depth) { if (aliasing_ >= kNoDelta) aliasing_ = kOnPatch; return buffer_; } - GOOGLE_DCHECK(size_ == 0) << size_; + GOOGLE_ABSL_DCHECK(size_ == 0) << size_; } overall_limit_ = 0; // Next failed, no more needs for next } @@ -154,7 +154,7 @@ const char* EpsCopyInputStream::NextBuffer(int overrun, int depth) { } const char* EpsCopyInputStream::Next() { - GOOGLE_DCHECK(limit_ > kSlopBytes); + GOOGLE_ABSL_DCHECK(limit_ > kSlopBytes); auto p = NextBuffer(0 /* immaterial */, -1); if (p == nullptr) { limit_end_ = buffer_end_; @@ -171,25 +171,25 @@ std::pair EpsCopyInputStream::DoneFallback(int overrun, int depth) { // Did we exceeded the limit (parse error). if (PROTOBUF_PREDICT_FALSE(overrun > limit_)) return {nullptr, true}; - GOOGLE_DCHECK(overrun != limit_); // Guaranteed by caller. - GOOGLE_DCHECK(overrun < limit_); // Follows from above + GOOGLE_ABSL_DCHECK(overrun != limit_); // Guaranteed by caller. + GOOGLE_ABSL_DCHECK(overrun < limit_); // Follows from above // TODO(gerbens) Instead of this dcheck we could just assign, and remove // updating the limit_end from PopLimit, ie. // limit_end_ = buffer_end_ + (std::min)(0, limit_); // if (ptr < limit_end_) return {ptr, false}; - GOOGLE_DCHECK(limit_end_ == buffer_end_ + (std::min)(0, limit_)); + GOOGLE_ABSL_DCHECK(limit_end_ == buffer_end_ + (std::min)(0, limit_)); // At this point we know the following assertion holds. - GOOGLE_DCHECK_GT(limit_, 0); - GOOGLE_DCHECK(limit_end_ == buffer_end_); // because limit_ > 0 + GOOGLE_ABSL_DCHECK_GT(limit_, 0); + GOOGLE_ABSL_DCHECK(limit_end_ == buffer_end_); // because limit_ > 0 const char* p; do { // We are past the end of buffer_end_, in the slop region. - GOOGLE_DCHECK_GE(overrun, 0); + GOOGLE_ABSL_DCHECK_GE(overrun, 0); p = NextBuffer(overrun, depth); if (p == nullptr) { // We are at the end of the stream if (PROTOBUF_PREDICT_FALSE(overrun != 0)) return {nullptr, true}; - GOOGLE_DCHECK_GT(limit_, 0); + GOOGLE_ABSL_DCHECK_GT(limit_, 0); limit_end_ = buffer_end_; // Distinguish ending on a pushed limit or ending on end-of-stream. SetEndOfStream(); @@ -280,7 +280,7 @@ const char* ParseContext::ParseMessage(MessageLite* msg, const char* ptr) { if (ptr == nullptr) return ptr; auto old_depth = depth_; ptr = msg->_InternalParse(ptr, this); - if (ptr != nullptr) GOOGLE_DCHECK_EQ(old_depth, depth_); + if (ptr != nullptr) GOOGLE_ABSL_DCHECK_EQ(old_depth, depth_); depth_++; if (!PopLimit(old)) return nullptr; return ptr; @@ -618,7 +618,7 @@ const char* UnknownFieldParse(uint32_t tag, std::string* unknown, // result = // num_bits = ValueBarrier(num_bits, result); // if (num_bits == 63) { -// GOOGLE_LOG(FATAL) << "Invalid num_bits value"; +// GOOGLE_ABSL_LOG(FATAL) << "Invalid num_bits value"; // } // ``` template @@ -638,7 +638,7 @@ PROTOBUF_ALWAYS_INLINE inline V1Type ValueBarrier(V1Type value1) { PROTOBUF_ALWAYS_INLINE inline uint64_t ExtractAndMergeTwoChunks( uint64_t data, uint64_t first_byte) { - GOOGLE_DCHECK_LE(first_byte, 6); + GOOGLE_ABSL_DCHECK_LE(first_byte, 6); uint64_t first = Ubfx7(data, first_byte * 8); uint64_t second = Ubfx7(data, (first_byte + 1) * 8); return ForceToRegister(first | (second << 7)); diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index eb7e2a5fbdb2..fb7505c3551b 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -578,7 +578,7 @@ #endif // PROTOBUF_ASSUME(pred) tells the compiler that it can assume pred is true. To -// be safe, we also validate the assumption with a GOOGLE_DCHECK in unoptimized +// be safe, we also validate the assumption with a GOOGLE_ABSL_DCHECK in unoptimized // builds. The macro does not do anything useful if the compiler does not // support __builtin_assume. #ifdef PROTOBUF_ASSUME @@ -586,10 +586,10 @@ #endif #if __has_builtin(__builtin_assume) #define PROTOBUF_ASSUME(pred) \ - GOOGLE_DCHECK(pred); \ + GOOGLE_ABSL_DCHECK(pred); \ __builtin_assume(pred) #else -#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred) +#define PROTOBUF_ASSUME(pred) GOOGLE_ABSL_DCHECK(pred) #endif // Specify memory alignment for structs, classes, etc. @@ -1020,14 +1020,14 @@ static_assert(PROTOBUF_CLANG_MIN(5, 0), "Protobuf only supports Clang 6.0 and ne #define PROTOBUF_DEBUG false #endif -// This `for` allows us to condition the `GOOGLE_LOG` on the define above, so that +// This `for` allows us to condition the `GOOGLE_ABSL_LOG` on the define above, so that // code can write `PROTOBUF_DLOG(INFO) << ...;` and have it turned off when // debug logging is off. // // This is a `for`, not and `if`, to avoid it accidentally chaining with an // `else` below it. #define PROTOBUF_DLOG(x) \ - for (bool b = PROTOBUF_DEBUG; b; b = false) GOOGLE_LOG(x) + for (bool b = PROTOBUF_DEBUG; b; b = false) GOOGLE_ABSL_LOG(x) #define PROTO2_IS_OSS true diff --git a/src/google/protobuf/proto3_arena_unittest.cc b/src/google/protobuf/proto3_arena_unittest.cc index 1d7273406c92..a79dfb686736 100644 --- a/src/google/protobuf/proto3_arena_unittest.cc +++ b/src/google/protobuf/proto3_arena_unittest.cc @@ -314,8 +314,8 @@ TEST(Proto3OptionalTest, Extensions) { "protobuf_unittest.Proto3OptionalExtensions.ext_no_optional"); const FieldDescriptor* with_optional = p->FindExtensionByName( "protobuf_unittest.Proto3OptionalExtensions.ext_with_optional"); - GOOGLE_CHECK(no_optional); - GOOGLE_CHECK(with_optional); + GOOGLE_ABSL_CHECK(no_optional); + GOOGLE_ABSL_CHECK(with_optional); EXPECT_FALSE(no_optional->has_optional_keyword()); EXPECT_TRUE(with_optional->has_optional_keyword()); @@ -363,8 +363,8 @@ TEST(Proto3OptionalTest, OptionalFieldReflection) { const google::protobuf::Reflection* r = msg.GetReflection(); const google::protobuf::FieldDescriptor* f = d->FindFieldByName("optional_int32"); const google::protobuf::OneofDescriptor* o = d->FindOneofByName("_optional_int32"); - GOOGLE_CHECK(f); - GOOGLE_CHECK(o); + GOOGLE_ABSL_CHECK(f); + GOOGLE_ABSL_CHECK(o); EXPECT_TRUE(o->is_synthetic()); EXPECT_FALSE(r->HasField(msg, f)); diff --git a/src/google/protobuf/reflection_internal.h b/src/google/protobuf/reflection_internal.h index 5e2cfa07eb93..99e9c30633aa 100644 --- a/src/google/protobuf/reflection_internal.h +++ b/src/google/protobuf/reflection_internal.h @@ -234,7 +234,7 @@ class MapFieldAccessor final : public RandomAccessRepeatedFieldAccessor { } void Swap(Field* data, const internal::RepeatedFieldAccessor* other_mutator, Field* other_data) const override { - GOOGLE_CHECK(this == other_mutator); + GOOGLE_ABSL_CHECK(this == other_mutator); MutableRepeatedField(data)->Swap(MutableRepeatedField(other_data)); } @@ -278,7 +278,7 @@ class RepeatedFieldPrimitiveAccessor final : public RepeatedFieldWrapper { // Currently RepeatedFieldPrimitiveAccessor is the only implementation of // RepeatedFieldAccessor for primitive types. As we are using singletons // for these accessors, here "other_mutator" must be "this". - GOOGLE_CHECK(this == other_mutator); + GOOGLE_ABSL_CHECK(this == other_mutator); MutableRepeatedField(data)->Swap(MutableRepeatedField(other_data)); } @@ -342,7 +342,7 @@ class RepeatedPtrFieldMessageAccessor final RepeatedPtrFieldMessageAccessor() {} void Swap(Field* data, const internal::RepeatedFieldAccessor* other_mutator, Field* other_data) const override { - GOOGLE_CHECK(this == other_mutator); + GOOGLE_ABSL_CHECK(this == other_mutator); MutableRepeatedField(data)->Swap(MutableRepeatedField(other_data)); } diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc index 56c2d40d40b2..67b12f6ba5d5 100644 --- a/src/google/protobuf/reflection_ops.cc +++ b/src/google/protobuf/reflection_ops.cc @@ -36,6 +36,7 @@ #include #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/descriptor.h" @@ -57,7 +58,8 @@ static const Reflection* GetReflectionOrDie(const Message& m) { const Descriptor* d = m.GetDescriptor(); const std::string& mtype = d ? d->name() : "unknown"; // RawMessage is one known type for which GetReflection() returns nullptr. - GOOGLE_LOG(FATAL) << "Message does not support reflection (type " << mtype << ")."; + GOOGLE_ABSL_LOG(FATAL) << "Message does not support reflection (type " << mtype + << ")."; } return r; } @@ -69,10 +71,10 @@ void ReflectionOps::Copy(const Message& from, Message* to) { } void ReflectionOps::Merge(const Message& from, Message* to) { - GOOGLE_CHECK_NE(&from, to); + GOOGLE_ABSL_CHECK_NE(&from, to); const Descriptor* descriptor = from.GetDescriptor(); - GOOGLE_CHECK_EQ(to->GetDescriptor(), descriptor) + GOOGLE_ABSL_CHECK_EQ(to->GetDescriptor(), descriptor) << "Tried to merge messages of different types " << "(merge " << descriptor->full_name() << " to " << to->GetDescriptor()->full_name() << ")"; @@ -197,7 +199,7 @@ bool ReflectionOps::IsInitialized(const Message& message, bool check_fields, if (const int field_count = descriptor->field_count()) { const FieldDescriptor* begin = descriptor->field(0); const FieldDescriptor* end = begin + field_count; - GOOGLE_DCHECK_EQ(descriptor->field(field_count - 1), end - 1); + GOOGLE_ABSL_DCHECK_EQ(descriptor->field(field_count - 1), end - 1); if (check_fields) { // Check required fields of this message. @@ -425,10 +427,10 @@ void ReflectionOps::FindInitializationErrors(const Message& message, void GenericSwap(Message* lhs, Message* rhs) { #ifndef PROTOBUF_FORCE_COPY_IN_SWAP - GOOGLE_DCHECK(Arena::InternalGetOwningArena(lhs) != - Arena::InternalGetOwningArena(rhs)); - GOOGLE_DCHECK(Arena::InternalGetOwningArena(lhs) != nullptr || - Arena::InternalGetOwningArena(rhs) != nullptr); + GOOGLE_ABSL_DCHECK(Arena::InternalGetOwningArena(lhs) != + Arena::InternalGetOwningArena(rhs)); + GOOGLE_ABSL_DCHECK(Arena::InternalGetOwningArena(lhs) != nullptr || + Arena::InternalGetOwningArena(rhs) != nullptr); #endif // !PROTOBUF_FORCE_COPY_IN_SWAP // At least one of these must have an arena, so make `rhs` point to it. Arena* arena = Arena::InternalGetOwningArena(rhs); diff --git a/src/google/protobuf/reflection_ops_unittest.cc b/src/google/protobuf/reflection_ops_unittest.cc index 57ca1da29eb7..5500a01cd1da 100644 --- a/src/google/protobuf/reflection_ops_unittest.cc +++ b/src/google/protobuf/reflection_ops_unittest.cc @@ -34,7 +34,6 @@ #include "google/protobuf/reflection_ops.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.h" #include #include "absl/strings/str_join.h" diff --git a/src/google/protobuf/reflection_tester.cc b/src/google/protobuf/reflection_tester.cc index 23084dc275be..ca8044501423 100644 --- a/src/google/protobuf/reflection_tester.cc +++ b/src/google/protobuf/reflection_tester.cc @@ -193,7 +193,7 @@ MapReflectionTester::MapReflectionTester(const Descriptor* base_descriptor) map_int32_foreign_message_key_, map_int32_foreign_message_val_}; for (const FieldDescriptor* fdesc : all_map_descriptors) { - GOOGLE_CHECK(fdesc->containing_type() != nullptr) << fdesc->name(); + GOOGLE_ABSL_CHECK(fdesc->containing_type() != nullptr) << fdesc->name(); if (fdesc->name() == "key") { EXPECT_EQ(fdesc->containing_type()->map_key(), fdesc); } else { @@ -207,7 +207,7 @@ MapReflectionTester::MapReflectionTester(const Descriptor* base_descriptor) const FieldDescriptor* MapReflectionTester::F(const std::string& name) { const FieldDescriptor* result = nullptr; result = base_descriptor_->FindFieldByName(name); - GOOGLE_CHECK(result != nullptr); + GOOGLE_ABSL_CHECK(result != nullptr); return result; } diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc index 6c22620cb402..44513c7fe9c3 100644 --- a/src/google/protobuf/repeated_field.cc +++ b/src/google/protobuf/repeated_field.cc @@ -37,6 +37,7 @@ #include #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index d08628a7b83c..2f46f2b46e6a 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -52,9 +52,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arena.h" #include "google/protobuf/port.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" #include "google/protobuf/repeated_ptr_field.h" @@ -308,7 +308,7 @@ class RepeatedField final { // Swaps entire contents with "other". Should be called only if the caller can // guarantee that both repeated fields are on the same arena or are on the // heap. Swapping between different arenas is disallowed and caught by a - // GOOGLE_DCHECK (see API docs for details). + // GOOGLE_ABSL_DCHECK (see API docs for details). void UnsafeArenaSwap(RepeatedField* other); static constexpr int kInitialSize = 0; @@ -355,7 +355,7 @@ class RepeatedField final { // Returns a pointer to elements array. // pre-condition: the array must have been allocated. Element* elements() const { - GOOGLE_DCHECK_GT(total_size_, 0); + GOOGLE_ABSL_DCHECK_GT(total_size_, 0); // Because of above pre-condition this cast is safe. return unsafe_elements(); } @@ -614,19 +614,19 @@ inline int RepeatedField::Capacity() const { template inline void RepeatedField::AddAlreadyReserved(const Element& value) { - GOOGLE_DCHECK_LT(current_size_, total_size_); + GOOGLE_ABSL_DCHECK_LT(current_size_, total_size_); elements()[ExchangeCurrentSize(current_size_ + 1)] = value; } template inline Element* RepeatedField::AddAlreadyReserved() { - GOOGLE_DCHECK_LT(current_size_, total_size_); + GOOGLE_ABSL_DCHECK_LT(current_size_, total_size_); return &elements()[ExchangeCurrentSize(current_size_ + 1)]; } template inline Element* RepeatedField::AddNAlreadyReserved(int elements) { - GOOGLE_DCHECK_GE(total_size_ - current_size_, elements) + GOOGLE_ABSL_DCHECK_GE(total_size_ - current_size_, elements) << total_size_ << ", " << current_size_; // Warning: sometimes people call this when elements == 0 and // total_size_ == 0. In this case the return pointer points to a zero size @@ -637,7 +637,7 @@ inline Element* RepeatedField::AddNAlreadyReserved(int elements) { template inline void RepeatedField::Resize(int new_size, const Element& value) { - GOOGLE_DCHECK_GE(new_size, 0); + GOOGLE_ABSL_DCHECK_GE(new_size, 0); if (new_size > current_size_) { Reserve(new_size); std::fill(&elements()[ExchangeCurrentSize(new_size)], &elements()[new_size], @@ -649,36 +649,36 @@ inline void RepeatedField::Resize(int new_size, const Element& value) { template inline const Element& RepeatedField::Get(int index) const { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); + GOOGLE_ABSL_DCHECK_GE(index, 0); + GOOGLE_ABSL_DCHECK_LT(index, current_size_); return elements()[index]; } template inline const Element& RepeatedField::at(int index) const { - GOOGLE_CHECK_GE(index, 0); - GOOGLE_CHECK_LT(index, current_size_); + GOOGLE_ABSL_CHECK_GE(index, 0); + GOOGLE_ABSL_CHECK_LT(index, current_size_); return elements()[index]; } template inline Element& RepeatedField::at(int index) { - GOOGLE_CHECK_GE(index, 0); - GOOGLE_CHECK_LT(index, current_size_); + GOOGLE_ABSL_CHECK_GE(index, 0); + GOOGLE_ABSL_CHECK_LT(index, current_size_); return elements()[index]; } template inline Element* RepeatedField::Mutable(int index) { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); + GOOGLE_ABSL_DCHECK_GE(index, 0); + GOOGLE_ABSL_DCHECK_LT(index, current_size_); return &elements()[index]; } template inline void RepeatedField::Set(int index, const Element& value) { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); + GOOGLE_ABSL_DCHECK_GE(index, 0); + GOOGLE_ABSL_DCHECK_LT(index, current_size_); elements()[index] = value; } @@ -727,16 +727,16 @@ inline void RepeatedField::Add(Iter begin, Iter end) { template inline void RepeatedField::RemoveLast() { - GOOGLE_DCHECK_GT(current_size_, 0); + GOOGLE_ABSL_DCHECK_GT(current_size_, 0); ExchangeCurrentSize(current_size_ - 1); } template void RepeatedField::ExtractSubrange(int start, int num, Element* elements) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, this->current_size_); + GOOGLE_ABSL_DCHECK_GE(start, 0); + GOOGLE_ABSL_DCHECK_GE(num, 0); + GOOGLE_ABSL_DCHECK_LE(start + num, this->current_size_); // Save the values of the removed elements if requested. if (elements != nullptr) { @@ -758,7 +758,7 @@ inline void RepeatedField::Clear() { template inline void RepeatedField::MergeFrom(const RepeatedField& other) { - GOOGLE_DCHECK_NE(&other, this); + GOOGLE_ABSL_DCHECK_NE(&other, this); if (other.current_size_ != 0) { int existing_size = size(); Reserve(existing_size + other.size()); @@ -809,7 +809,7 @@ inline const Element* RepeatedField::data() const { template inline void RepeatedField::InternalSwap(RepeatedField* other) { - GOOGLE_DCHECK(this != other); + GOOGLE_ABSL_DCHECK(this != other); // Swap all fields at once. static_assert(std::is_standard_layout>::value, @@ -842,7 +842,7 @@ void RepeatedField::Swap(RepeatedField* other) { template void RepeatedField::UnsafeArenaSwap(RepeatedField* other) { if (this == other) return; - GOOGLE_DCHECK_EQ(GetOwningArena(), other->GetOwningArena()); + GOOGLE_ABSL_DCHECK_EQ(GetOwningArena(), other->GetOwningArena()); InternalSwap(other); } @@ -928,7 +928,7 @@ void RepeatedField::Reserve(int new_size) { new_size = internal::CalculateReserveSize( total_size_, new_size); - GOOGLE_DCHECK_LE( + GOOGLE_ABSL_DCHECK_LE( static_cast(new_size), (std::numeric_limits::max() - kRepHeaderSize) / sizeof(Element)) << "Requested size is too large to fit into size_t."; @@ -972,7 +972,7 @@ void RepeatedField::Reserve(int new_size) { template inline void RepeatedField::Truncate(int new_size) { - GOOGLE_DCHECK_LE(new_size, current_size_); + GOOGLE_ABSL_DCHECK_LE(new_size, current_size_); if (current_size_ > 0) { ExchangeCurrentSize(new_size); } diff --git a/src/google/protobuf/repeated_field_reflection_unittest.cc b/src/google/protobuf/repeated_field_reflection_unittest.cc index f86ac0b14444..19970d69e99a 100644 --- a/src/google/protobuf/repeated_field_reflection_unittest.cc +++ b/src/google/protobuf/repeated_field_reflection_unittest.cc @@ -166,7 +166,7 @@ TEST(RepeatedFieldReflectionTest, ExtensionFields) { const FieldDescriptor* fd_repeated_int64_extension = desc->file()->FindExtensionByName("repeated_int64_extension"); - GOOGLE_CHECK(fd_repeated_int64_extension != nullptr); + GOOGLE_ABSL_CHECK(fd_repeated_int64_extension != nullptr); const RepeatedField& rf_int64_extension = refl->GetRepeatedField(extended_message, @@ -539,7 +539,7 @@ TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForExtensionFields) { const FieldDescriptor* fd_repeated_int64_extension = desc->file()->FindExtensionByName("repeated_int64_extension"); - GOOGLE_CHECK(fd_repeated_int64_extension != nullptr); + GOOGLE_ABSL_CHECK(fd_repeated_int64_extension != nullptr); const RepeatedFieldRef rf_int64_extension = refl->GetRepeatedFieldRef(extended_message, diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc index 50429c2d3ef1..dd80e071afcd 100644 --- a/src/google/protobuf/repeated_field_unittest.cc +++ b/src/google/protobuf/repeated_field_unittest.cc @@ -47,9 +47,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include #include +#include "google/protobuf/stubs/logging.h" #include "absl/numeric/bits.h" #include "absl/strings/cord.h" #include "absl/strings/str_cat.h" @@ -195,7 +195,7 @@ TEST(RepeatedField, ArenaAllocationSizesMatchExpectedValues) { // This is important to avoid a branch in the reallocation path. // This is also important because allocating anything less would be wasting // memory. - // If the allocation size is wrong, ReturnArrayMemory will GOOGLE_DCHECK. + // If the allocation size is wrong, ReturnArrayMemory will GOOGLE_ABSL_DCHECK. CheckAllocationSizes>(false); CheckAllocationSizes>(false); CheckAllocationSizes>(false); @@ -2143,7 +2143,7 @@ TEST_F(RepeatedPtrFieldPtrsIteratorTest, PtrSTLAlgorithms_lower_bound) { std::lower_bound(proto_array_.pointer_begin(), proto_array_.pointer_end(), &v, StringLessThan()); - GOOGLE_CHECK(*it != nullptr); + GOOGLE_ABSL_CHECK(*it != nullptr); EXPECT_EQ(**it, "n"); EXPECT_TRUE(it == proto_array_.pointer_begin() + 3); @@ -2154,7 +2154,7 @@ TEST_F(RepeatedPtrFieldPtrsIteratorTest, PtrSTLAlgorithms_lower_bound) { const_proto_array_->pointer_begin(), const_proto_array_->pointer_end(), &v, StringLessThan()); - GOOGLE_CHECK(*it != nullptr); + GOOGLE_ABSL_CHECK(*it != nullptr); EXPECT_EQ(**it, "n"); EXPECT_TRUE(it == const_proto_array_->pointer_begin() + 3); diff --git a/src/google/protobuf/repeated_ptr_field.cc b/src/google/protobuf/repeated_ptr_field.cc index f4d8a137cd70..025b0875773b 100644 --- a/src/google/protobuf/repeated_ptr_field.cc +++ b/src/google/protobuf/repeated_ptr_field.cc @@ -36,8 +36,8 @@ #include "google/protobuf/stubs/logging.h" #include "google/protobuf/implicit_weak_message.h" -#include "google/protobuf/repeated_field.h" #include "google/protobuf/port.h" +#include "google/protobuf/repeated_field.h" // Must be included last. #include "google/protobuf/port_def.inc" @@ -58,10 +58,10 @@ void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) { Arena* arena = GetOwningArena(); new_size = internal::CalculateReserveSize(total_size_, new_size); - GOOGLE_CHECK_LE(static_cast(new_size), - static_cast( - (std::numeric_limits::max() - kRepHeaderSize) / - sizeof(old_rep->elements[0]))) + GOOGLE_ABSL_CHECK_LE(static_cast(new_size), + static_cast( + (std::numeric_limits::max() - kRepHeaderSize) / + sizeof(old_rep->elements[0]))) << "Requested size is too large to fit into size_t."; size_t bytes = kRepHeaderSize + sizeof(old_rep->elements[0]) * new_size; if (arena == nullptr) { @@ -98,8 +98,8 @@ void RepeatedPtrFieldBase::Reserve(int new_size) { } void RepeatedPtrFieldBase::DestroyProtos() { - GOOGLE_DCHECK(rep_); - GOOGLE_DCHECK(arena_ == nullptr); + GOOGLE_ABSL_DCHECK(rep_); + GOOGLE_ABSL_DCHECK(arena_ == nullptr); int n = rep_->allocated_size; void* const* elements = rep_->elements; for (int i = 0; i < n; i++) { diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h index 886cf40b05d1..00b1e966d0e0 100644 --- a/src/google/protobuf/repeated_ptr_field.h +++ b/src/google/protobuf/repeated_ptr_field.h @@ -58,9 +58,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arena.h" #include "google/protobuf/port.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" @@ -187,22 +187,22 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template const typename TypeHandler::Type& at(int index) const { - GOOGLE_CHECK_GE(index, 0); - GOOGLE_CHECK_LT(index, current_size_); + GOOGLE_ABSL_CHECK_GE(index, 0); + GOOGLE_ABSL_CHECK_LT(index, current_size_); return *cast(rep_->elements[index]); } template typename TypeHandler::Type& at(int index) { - GOOGLE_CHECK_GE(index, 0); - GOOGLE_CHECK_LT(index, current_size_); + GOOGLE_ABSL_CHECK_GE(index, 0); + GOOGLE_ABSL_CHECK_LT(index, current_size_); return *cast(rep_->elements[index]); } template typename TypeHandler::Type* Mutable(int index) { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); + GOOGLE_ABSL_DCHECK_GE(index, 0); + GOOGLE_ABSL_DCHECK_LT(index, current_size_); return cast(rep_->elements[index]); } @@ -240,8 +240,8 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template void Delete(int index) { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); + GOOGLE_ABSL_DCHECK_GE(index, 0); + GOOGLE_ABSL_DCHECK_LT(index, current_size_); TypeHandler::Delete(cast(rep_->elements[index]), arena_); } @@ -270,8 +270,8 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template const typename TypeHandler::Type& Get(int index) const { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); + GOOGLE_ABSL_DCHECK_GE(index, 0); + GOOGLE_ABSL_DCHECK_LT(index, current_size_); return *cast(rep_->elements[index]); } @@ -284,7 +284,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template void Clear() { const int n = current_size_; - GOOGLE_DCHECK_GE(n, 0); + GOOGLE_ABSL_DCHECK_GE(n, 0); if (n > 0) { ClearNonEmpty(); } @@ -298,14 +298,14 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // binary. This calls a shared implementation with most of the logic, // passing a function pointer to another type-specific piece of code that // calls the object-allocate and merge handlers. - GOOGLE_DCHECK_NE(&other, this); + GOOGLE_ABSL_DCHECK_NE(&other, this); if (other.current_size_ == 0) return; MergeFromInternal(other, &RepeatedPtrFieldBase::MergeFromInnerLoop); } inline void InternalSwap(RepeatedPtrFieldBase* rhs) { - GOOGLE_DCHECK(this != rhs); + GOOGLE_ABSL_DCHECK(this != rhs); // Swap all fields at once. auto temp = std::make_tuple(rhs->arena_, rhs->current_size_, @@ -346,7 +346,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { protected: template void RemoveLast() { - GOOGLE_DCHECK_GT(current_size_, 0); + GOOGLE_ABSL_DCHECK_GT(current_size_, 0); ExchangeCurrentSize(current_size_ - 1); TypeHandler::Clear(cast(rep_->elements[current_size_])); } @@ -481,7 +481,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // arena. template typename TypeHandler::Type* UnsafeArenaReleaseLast() { - GOOGLE_DCHECK_GT(current_size_, 0); + GOOGLE_ABSL_DCHECK_GT(current_size_, 0); ExchangeCurrentSize(current_size_ - 1); typename TypeHandler::Type* result = cast(rep_->elements[current_size_]); @@ -500,9 +500,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template void AddCleared(typename TypeHandler::Type* value) { - GOOGLE_DCHECK(GetOwningArena() == nullptr) << "AddCleared() can only be used on a " - "RepeatedPtrField not on an arena."; - GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr) + GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr) + << "AddCleared() can only be used on a " + "RepeatedPtrField not on an arena."; + GOOGLE_ABSL_DCHECK(TypeHandler::GetOwningArena(value) == nullptr) << "AddCleared() can only accept values not on an arena."; if (!rep_ || rep_->allocated_size == total_size_) { Reserve(total_size_ + 1); @@ -512,12 +513,12 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template PROTOBUF_NODISCARD typename TypeHandler::Type* ReleaseCleared() { - GOOGLE_DCHECK(GetOwningArena() == nullptr) + GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr) << "ReleaseCleared() can only be used on a RepeatedPtrField not on " << "an arena."; - GOOGLE_DCHECK(GetOwningArena() == nullptr); - GOOGLE_DCHECK(rep_ != nullptr); - GOOGLE_DCHECK_GT(rep_->allocated_size, current_size_); + GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr); + GOOGLE_ABSL_DCHECK(rep_ != nullptr); + GOOGLE_ABSL_DCHECK_GT(rep_->allocated_size, current_size_); return cast(rep_->elements[--rep_->allocated_size]); } @@ -609,10 +610,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template typename TypeHandler::Type* ReleaseLastInternal(std::false_type) { // ReleaseLast() for types that *do not* implement merge/copy behavior -- - // this is the same as UnsafeArenaReleaseLast(). Note that we GOOGLE_DCHECK-fail if - // we're on an arena, since the user really should implement the copy - // operation in this case. - GOOGLE_DCHECK(GetOwningArena() == nullptr) + // this is the same as UnsafeArenaReleaseLast(). Note that we + // GOOGLE_ABSL_DCHECK-fail if we're on an arena, since the user really should + // implement the copy operation in this case. + GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr) << "ReleaseLast() called on a RepeatedPtrField that is on an arena, " << "with a type that does not implement MergeFrom. This is unsafe; " << "please implement MergeFrom for your type."; @@ -622,10 +623,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { template PROTOBUF_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other) { #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - GOOGLE_DCHECK(GetOwningArena() == nullptr || - other->GetOwningArena() != GetOwningArena()); + GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr || + other->GetOwningArena() != GetOwningArena()); #else // PROTOBUF_FORCE_COPY_IN_SWAP - GOOGLE_DCHECK(other->GetOwningArena() != GetOwningArena()); + GOOGLE_ABSL_DCHECK(other->GetOwningArena() != GetOwningArena()); #endif // !PROTOBUF_FORCE_COPY_IN_SWAP // Copy semantics in this case. We try to improve efficiency by placing the @@ -699,8 +700,9 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { const int n = current_size_; void* const* elements = rep_->elements; int i = 0; - GOOGLE_DCHECK_GT(n, - 0); // do/while loop to avoid initial test because we know n > 0 + GOOGLE_ABSL_DCHECK_GT( + n, + 0); // do/while loop to avoid initial test because we know n > 0 do { TypeHandler::Clear(cast(elements[i++])); } while (i < n); @@ -996,7 +998,7 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { // Swaps entire contents with "other". Caller should guarantee that either // both fields are on the same arena or both are on the heap. Swapping between // different arenas with this function is disallowed and is caught via - // GOOGLE_DCHECK. + // GOOGLE_ABSL_DCHECK. void UnsafeArenaSwap(RepeatedPtrField* other); // Swaps two elements. @@ -1137,14 +1139,14 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { // this method. // // This method cannot be called when either the repeated field or |value| is - // on an arena; both cases will trigger a GOOGLE_DCHECK-failure. + // on an arena; both cases will trigger a GOOGLE_ABSL_DCHECK-failure. void AddCleared(Element* value); // Removes and returns a single element from the cleared pool, passing // ownership to the caller. The element is guaranteed to be cleared. // Requires: ClearedCount() > 0 // // This method cannot be called when the repeated field is on an arena; doing - // so will trigger a GOOGLE_DCHECK-failure. + // so will trigger a GOOGLE_ABSL_DCHECK-failure. PROTOBUF_NODISCARD Element* ReleaseCleared(); #endif // !PROTOBUF_FUTURE_REMOVE_CLEARED_API @@ -1353,9 +1355,9 @@ inline void RepeatedPtrField::RemoveLast() { template inline void RepeatedPtrField::DeleteSubrange(int start, int num) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, size()); + GOOGLE_ABSL_DCHECK_GE(start, 0); + GOOGLE_ABSL_DCHECK_GE(num, 0); + GOOGLE_ABSL_DCHECK_LE(start + num, size()); for (int i = 0; i < num; ++i) { RepeatedPtrFieldBase::Delete(start + i); } @@ -1375,13 +1377,13 @@ inline void RepeatedPtrField::ExtractSubrange(int start, int num, template inline void RepeatedPtrField::ExtractSubrangeInternal( int start, int num, Element** elements, std::true_type) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, size()); + GOOGLE_ABSL_DCHECK_GE(start, 0); + GOOGLE_ABSL_DCHECK_GE(num, 0); + GOOGLE_ABSL_DCHECK_LE(start + num, size()); if (num == 0) return; - GOOGLE_DCHECK_NE(elements, nullptr) + GOOGLE_ABSL_DCHECK_NE(elements, nullptr) << "Releasing elements without transferring ownership is an unsafe " "operation. Use UnsafeArenaExtractSubrange."; if (elements == nullptr) { @@ -1425,9 +1427,9 @@ inline void RepeatedPtrField::ExtractSubrangeInternal( int start, int num, Element** elements, std::false_type) { // This case is identical to UnsafeArenaExtractSubrange(). However, since // ExtractSubrange() must return heap-allocated objects by contract, and we - // cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that - // we are not on an arena. - GOOGLE_DCHECK(GetOwningArena() == nullptr) + // cannot fulfill this contract if we are an on arena, we must GOOGLE_ABSL_DCHECK() + // that we are not on an arena. + GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr) << "ExtractSubrange() when arena is non-nullptr is only supported when " << "the Element type supplies a MergeFrom() operation to make copies."; UnsafeArenaExtractSubrange(start, num, elements); @@ -1436,9 +1438,9 @@ inline void RepeatedPtrField::ExtractSubrangeInternal( template inline void RepeatedPtrField::UnsafeArenaExtractSubrange( int start, int num, Element** elements) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, size()); + GOOGLE_ABSL_DCHECK_GE(start, 0); + GOOGLE_ABSL_DCHECK_GE(num, 0); + GOOGLE_ABSL_DCHECK_LE(start + num, size()); if (num > 0) { // Save the values of the removed elements if requested. @@ -1509,7 +1511,7 @@ template inline void RepeatedPtrField::UnsafeArenaSwap( RepeatedPtrField* other) { if (this == other) return; - GOOGLE_DCHECK_EQ(GetOwningArena(), other->GetOwningArena()); + GOOGLE_ABSL_DCHECK_EQ(GetOwningArena(), other->GetOwningArena()); RepeatedPtrFieldBase::InternalSwap(other); } diff --git a/src/google/protobuf/test_util.h b/src/google/protobuf/test_util.h index 5449ed67ef7d..466d03b12a00 100644 --- a/src/google/protobuf/test_util.h +++ b/src/google/protobuf/test_util.h @@ -185,7 +185,7 @@ inline const FieldDescriptor* TestUtil::ReflectionTester::F( } else { result = base_descriptor_->FindFieldByName(name); } - GOOGLE_CHECK(result != nullptr); + GOOGLE_ABSL_CHECK(result != nullptr); return result; } diff --git a/src/google/protobuf/test_util.inc b/src/google/protobuf/test_util.inc index 2b1dfe001f36..df62d415c61c 100644 --- a/src/google/protobuf/test_util.inc +++ b/src/google/protobuf/test_util.inc @@ -37,8 +37,8 @@ // within an enclosing namespace and requires header files to be included // out of this file. -#include "google/protobuf/stubs/logging.h" #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/message.h" @@ -1113,7 +1113,7 @@ inline void TestUtil::SetOneofFields(UNITTEST::TestAllExtensions* message) { inline void TestUtil::SetAllFieldsAndExtensions( UNITTEST::TestFieldOrderings* message) { - GOOGLE_CHECK(message); + GOOGLE_ABSL_CHECK(message); message->set_my_int(1); message->set_my_string("foo"); message->set_my_float(1.0); diff --git a/src/google/protobuf/test_util2.h b/src/google/protobuf/test_util2.h index 07a712c2f623..8777286bf1d4 100644 --- a/src/google/protobuf/test_util2.h +++ b/src/google/protobuf/test_util2.h @@ -50,7 +50,7 @@ inline std::string TranslatePathToOpensource(absl::string_view google3_path) { constexpr absl::string_view net_proto2 = "net/proto2/"; constexpr absl::string_view third_party_protobuf = "third_party/protobuf/"; if (!absl::ConsumePrefix(&google3_path, net_proto2)) { - GOOGLE_CHECK(absl::ConsumePrefix(&google3_path, third_party_protobuf)) + GOOGLE_ABSL_CHECK(absl::ConsumePrefix(&google3_path, third_party_protobuf)) << google3_path; } @@ -93,7 +93,7 @@ class BoundedArrayInputStream : public io::ZeroCopyInputStream { ~BoundedArrayInputStream() override {} bool Next(const void** data, int* size) override { - GOOGLE_CHECK_LT(stream_.ByteCount(), bound_); + GOOGLE_ABSL_CHECK_LT(stream_.ByteCount(), bound_); return stream_.Next(data, size); } void BackUp(int count) override { stream_.BackUp(count); } diff --git a/src/google/protobuf/test_util_lite.cc b/src/google/protobuf/test_util_lite.cc index 9fb1886407c6..a9eafdcaaa90 100644 --- a/src/google/protobuf/test_util_lite.cc +++ b/src/google/protobuf/test_util_lite.cc @@ -34,7 +34,6 @@ #include "google/protobuf/test_util_lite.h" -#include "google/protobuf/stubs/logging.h" #include #include "absl/strings/string_view.h" diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc index d6298c8c4248..16ac146aab79 100644 --- a/src/google/protobuf/text_format.cc +++ b/src/google/protobuf/text_format.cc @@ -206,11 +206,11 @@ void CheckFieldIndex(const FieldDescriptor* field, int index) { } if (field->is_repeated() && index == -1) { - GOOGLE_LOG(DFATAL) << "Index must be in range of repeated field values. " - << "Field: " << field->name(); + GOOGLE_ABSL_LOG(DFATAL) << "Index must be in range of repeated field values. " + << "Field: " << field->name(); } else if (!field->is_repeated() && index != -1) { - GOOGLE_LOG(DFATAL) << "Index must be -1 for singular fields." - << "Field: " << field->name(); + GOOGLE_ABSL_LOG(DFATAL) << "Index must be -1 for singular fields." + << "Field: " << field->name(); } } @@ -346,7 +346,7 @@ class TextFormat::Parser::ParserImpl { // Parses the ASCII representation specified in input and saves the // information into the output pointer (a Message). Returns // false if an error occurs (an error will also be logged to - // GOOGLE_LOG(ERROR)). + // GOOGLE_ABSL_LOG(ERROR)). bool Parse(Message* output) { // Consume fields until we cannot do so anymore. while (true) { @@ -354,7 +354,7 @@ class TextFormat::Parser::ParserImpl { // Ensures recursion limit properly unwinded, but only for success // cases. This implicitly avoids the check when `Parse` returns false // via `DO(...)`. - GOOGLE_DCHECK(had_errors_ || recursion_limit_ == initial_recursion_limit_) + GOOGLE_ABSL_DCHECK(had_errors_ || recursion_limit_ == initial_recursion_limit_) << "Recursion limit at end of parse should be " << initial_recursion_limit_ << ", but was " << recursion_limit_ << ". Difference of " << initial_recursion_limit_ - recursion_limit_ @@ -381,12 +381,12 @@ class TextFormat::Parser::ParserImpl { had_errors_ = true; if (error_collector_ == nullptr) { if (line >= 0) { - GOOGLE_LOG(ERROR) << "Error parsing text-format " - << root_message_type_->full_name() << ": " << (line + 1) - << ":" << (col + 1) << ": " << message; + GOOGLE_ABSL_LOG(ERROR) << "Error parsing text-format " + << root_message_type_->full_name() << ": " << (line + 1) + << ":" << (col + 1) << ": " << message; } else { - GOOGLE_LOG(ERROR) << "Error parsing text-format " - << root_message_type_->full_name() << ": " << message; + GOOGLE_ABSL_LOG(ERROR) << "Error parsing text-format " + << root_message_type_->full_name() << ": " << message; } } else { error_collector_->AddError(line, col, message); @@ -396,12 +396,12 @@ class TextFormat::Parser::ParserImpl { void ReportWarning(int line, int col, const std::string& message) { if (error_collector_ == nullptr) { if (line >= 0) { - GOOGLE_LOG(WARNING) << "Warning parsing text-format " - << root_message_type_->full_name() << ": " << (line + 1) - << ":" << (col + 1) << ": " << message; + GOOGLE_ABSL_LOG(WARNING) << "Warning parsing text-format " + << root_message_type_->full_name() << ": " + << (line + 1) << ":" << (col + 1) << ": " << message; } else { - GOOGLE_LOG(WARNING) << "Warning parsing text-format " - << root_message_type_->full_name() << ": " << message; + GOOGLE_ABSL_LOG(WARNING) << "Warning parsing text-format " + << root_message_type_->full_name() << ": " << message; } } else { error_collector_->AddWarning(line, col, message); @@ -591,7 +591,8 @@ class TextFormat::Parser::ParserImpl { // Skips unknown or reserved fields. if (field == nullptr) { - GOOGLE_CHECK(allow_unknown_field_ || allow_unknown_extension_ || reserved_field); + GOOGLE_ABSL_CHECK(allow_unknown_field_ || allow_unknown_extension_ || + reserved_field); // Try to guess the type of this field. // If this field is not a message, there should be a ":" between the @@ -925,7 +926,7 @@ class TextFormat::Parser::ParserImpl { case FieldDescriptor::CPPTYPE_MESSAGE: { // We should never get here. Put here instead of a default // so that if new types are added, we get a nice compiler warning. - GOOGLE_LOG(FATAL) << "Reached an unintended state: CPPTYPE_MESSAGE"; + GOOGLE_ABSL_LOG(FATAL) << "Reached an unintended state: CPPTYPE_MESSAGE"; break; } } @@ -1429,7 +1430,7 @@ class TextFormat::Printer::TextGenerator // level is zero. void Outdent() override { if (indent_level_ == 0 || indent_level_ < initial_indent_level_) { - GOOGLE_LOG(DFATAL) << " Outdent() without matching Indent()."; + GOOGLE_ABSL_LOG(DFATAL) << " Outdent() without matching Indent()."; return; } @@ -1523,7 +1524,7 @@ class TextFormat::Printer::TextGenerator if (indent_level_ == 0) { return; } - GOOGLE_DCHECK(!failed_); + GOOGLE_ABSL_DCHECK(!failed_); int size = GetCurrentIndentationSize(); while (size > buffer_size_) { @@ -2102,7 +2103,7 @@ bool TextFormat::Printer::RegisterMessagePrinter( bool TextFormat::Printer::PrintToString(const Message& message, std::string* output) const { - GOOGLE_DCHECK(output) << "output specified is nullptr"; + GOOGLE_ABSL_DCHECK(output) << "output specified is nullptr"; output->clear(); io::StringOutputStream output_stream(output); @@ -2112,7 +2113,7 @@ bool TextFormat::Printer::PrintToString(const Message& message, bool TextFormat::Printer::PrintUnknownFieldsToString( const UnknownFieldSet& unknown_fields, std::string* output) const { - GOOGLE_DCHECK(output) << "output specified is nullptr"; + GOOGLE_ABSL_DCHECK(output) << "output specified is nullptr"; output->clear(); io::StringOutputStream output_stream(output); @@ -2195,8 +2196,8 @@ bool TextFormat::Printer::PrintAny(const Message& message, finder_ ? finder_->FindAnyType(message, url_prefix, full_type_name) : DefaultFinderFindAnyType(message, url_prefix, full_type_name); if (value_descriptor == nullptr) { - GOOGLE_LOG(WARNING) << "Can't print proto content: proto type " << type_url - << " not found"; + GOOGLE_ABSL_LOG(WARNING) << "Can't print proto content: proto type " << type_url + << " not found"; return false; } DynamicMessageFactory factory; @@ -2204,7 +2205,7 @@ bool TextFormat::Printer::PrintAny(const Message& message, factory.GetPrototype(value_descriptor)->New()); std::string serialized_value = reflection->GetString(message, value_field); if (!value_message->ParseFromString(serialized_value)) { - GOOGLE_LOG(WARNING) << type_url << ": failed to parse contents"; + GOOGLE_ABSL_LOG(WARNING) << type_url << ": failed to parse contents"; return false; } generator->PrintLiteral("["); @@ -2281,7 +2282,7 @@ void TextFormat::Printer::PrintFieldValueToString(const Message& message, const FieldDescriptor* field, int index, std::string* output) const { - GOOGLE_DCHECK(output) << "output specified is nullptr"; + GOOGLE_ABSL_DCHECK(output) << "output specified is nullptr"; output->clear(); io::StringOutputStream output_stream(output); @@ -2329,7 +2330,7 @@ class MapEntryMessageComparator { return first < second; } default: - GOOGLE_LOG(DFATAL) << "Invalid key for map field."; + GOOGLE_ABSL_LOG(DFATAL) << "Invalid key for map field."; return true; } } @@ -2400,7 +2401,7 @@ void MapFieldPrinterHelper::CopyKey(const MapKey& key, Message* message, case FieldDescriptor::CPPTYPE_FLOAT: case FieldDescriptor::CPPTYPE_ENUM: case FieldDescriptor::CPPTYPE_MESSAGE: - GOOGLE_LOG(ERROR) << "Not supported."; + GOOGLE_ABSL_LOG(ERROR) << "Not supported."; break; case FieldDescriptor::CPPTYPE_STRING: reflection->SetString(message, field_desc, key.GetStringValue()); @@ -2575,7 +2576,7 @@ void TextFormat::Printer::PrintFieldValue(const Message& message, const FieldDescriptor* field, int index, BaseTextGenerator* generator) const { - GOOGLE_DCHECK(field->is_repeated() || (index == -1)) + GOOGLE_ABSL_DCHECK(field->is_repeated() || (index == -1)) << "Index must be -1 for non-repeated fields"; const FastFieldValuePrinter* printer = GetFieldPrinter(field); @@ -2627,7 +2628,7 @@ void TextFormat::Printer::PrintFieldValue(const Message& message, if (field->type() == FieldDescriptor::TYPE_STRING) { printer->PrintString(*value_to_print, generator); } else { - GOOGLE_DCHECK_EQ(field->type(), FieldDescriptor::TYPE_BYTES); + GOOGLE_ABSL_DCHECK_EQ(field->type(), FieldDescriptor::TYPE_BYTES); printer->PrintBytes(*value_to_print, generator); } break; diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc index 71dd756136a3..d85be9c4859f 100644 --- a/src/google/protobuf/text_format_unittest.cc +++ b/src/google/protobuf/text_format_unittest.cc @@ -42,13 +42,13 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/any.pb.h" #include #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -91,7 +91,7 @@ const std::string kEscapeTestStringEscaped = class TextFormatTest : public testing::Test { public: static void SetUpTestSuite() { - GOOGLE_CHECK_OK(File::GetContents( + GOOGLE_ABSL_CHECK_OK(File::GetContents( TestUtil::GetTestDataPath( "third_party/protobuf/" "testdata/text_format_unittest_data_oneof_implemented.txt"), @@ -113,7 +113,7 @@ std::string TextFormatTest::static_proto_text_format_; class TextFormatExtensionsTest : public testing::Test { public: static void SetUpTestSuite() { - GOOGLE_CHECK_OK(File::GetContents( + GOOGLE_ABSL_CHECK_OK(File::GetContents( TestUtil::GetTestDataPath("third_party/protobuf/testdata/" "text_format_unittest_extensions_data.txt"), &static_proto_text_format_, true)); diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc index d9337bb1ad04..c155bca6210f 100644 --- a/src/google/protobuf/unknown_field_set.cc +++ b/src/google/protobuf/unknown_field_set.cc @@ -61,7 +61,7 @@ const UnknownFieldSet& UnknownFieldSet::default_instance() { } void UnknownFieldSet::ClearFallback() { - GOOGLE_DCHECK(!fields_.empty()); + GOOGLE_ABSL_DCHECK(!fields_.empty()); int n = fields_.size(); do { (fields_)[--n].Delete(); @@ -289,7 +289,7 @@ void UnknownField::DeepCopy(const UnknownField& other) { uint8_t* UnknownField::InternalSerializeLengthDelimitedNoTag( uint8_t* target, io::EpsCopyOutputStream* stream) const { - GOOGLE_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type()); + GOOGLE_ABSL_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type()); const std::string& data = *data_.length_delimited_.string_value; target = io::CodedOutputStream::WriteVarint32ToArray(data.size(), target); target = stream->WriteRaw(data.data(), data.size(), target); diff --git a/src/google/protobuf/unknown_field_set.h b/src/google/protobuf/unknown_field_set.h index 85e51a577f11..e914e78b889e 100644 --- a/src/google/protobuf/unknown_field_set.h +++ b/src/google/protobuf/unknown_field_set.h @@ -45,8 +45,8 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/port.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/message_lite.h" @@ -393,7 +393,7 @@ bool UnknownFieldSet::MergeFromMessage(const MessageType& message) { inline size_t UnknownField::GetLengthDelimitedSize() const { - GOOGLE_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type()); + GOOGLE_ABSL_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type()); return data_.length_delimited_.string_value->size(); } diff --git a/src/google/protobuf/unknown_field_set_unittest.cc b/src/google/protobuf/unknown_field_set_unittest.cc index 9401e568a8ff..3a04b6b31e03 100644 --- a/src/google/protobuf/unknown_field_set_unittest.cc +++ b/src/google/protobuf/unknown_field_set_unittest.cc @@ -42,7 +42,6 @@ #include "google/protobuf/stubs/callback.h" #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include #include "google/protobuf/testing/googletest.h" #include diff --git a/src/google/protobuf/wire_format.cc b/src/google/protobuf/wire_format.cc index 7dbbb99fef70..2a66968d4def 100644 --- a/src/google/protobuf/wire_format.cc +++ b/src/google/protobuf/wire_format.cc @@ -38,6 +38,7 @@ #include #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" #include "google/protobuf/descriptor.h" @@ -401,7 +402,7 @@ bool WireFormat::ParseAndMergeMessageSetField(uint32_t field_number, field->type() != FieldDescriptor::TYPE_MESSAGE) { // This shouldn't happen as we only allow optional message extensions to // MessageSet. - GOOGLE_LOG(ERROR) << "Extensions of MessageSets must be optional messages."; + GOOGLE_ABSL_LOG(ERROR) << "Extensions of MessageSets must be optional messages."; return false; } else { Message* sub_message = message_reflection->MutableMessage( @@ -789,8 +790,8 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, internal::ParseContext* ctx) { const Descriptor* descriptor = msg->GetDescriptor(); const Reflection* reflection = msg->GetReflection(); - GOOGLE_DCHECK(descriptor); - GOOGLE_DCHECK(reflection); + GOOGLE_ABSL_DCHECK(descriptor); + GOOGLE_ABSL_DCHECK(reflection); if (descriptor->options().message_set_wire_format()) { MessageSetParser message_set{msg, descriptor, reflection}; return message_set.ParseMessageSet(ptr, ctx); @@ -889,7 +890,7 @@ const char* WireFormat::_InternalParseAndMergeField( case FieldDescriptor::TYPE_GROUP: case FieldDescriptor::TYPE_MESSAGE: case FieldDescriptor::TYPE_BYTES: - GOOGLE_LOG(FATAL) << "Can't reach"; + GOOGLE_ABSL_LOG(FATAL) << "Can't reach"; return nullptr; } } else { @@ -1080,7 +1081,7 @@ uint8_t* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, case FieldDescriptor::TYPE_MESSAGE: case FieldDescriptor::TYPE_BYTES: case FieldDescriptor::TYPE_ENUM: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; break; #define CASE_TYPE(FieldType, CamelFieldType, CamelCppType) \ case FieldDescriptor::TYPE_##FieldType: \ @@ -1169,7 +1170,7 @@ class MapKeySorter { class MapKeyComparator { public: bool operator()(const MapKey& a, const MapKey& b) const { - GOOGLE_DCHECK(a.type() == b.type()); + GOOGLE_ABSL_DCHECK(a.type() == b.type()); switch (a.type()) { #define CASE_TYPE(CppType, CamelCppType) \ case FieldDescriptor::CPPTYPE_##CppType: { \ @@ -1184,7 +1185,7 @@ class MapKeySorter { #undef CASE_TYPE default: - GOOGLE_LOG(DFATAL) << "Invalid key for map field."; + GOOGLE_ABSL_LOG(DFATAL) << "Invalid key for map field."; return true; } } @@ -1326,7 +1327,7 @@ uint8_t* WireFormat::InternalSerializeField(const FieldDescriptor* field, HANDLE_PRIMITIVE_TYPE(BOOL, bool, Bool, Bool) #undef HANDLE_PRIMITIVE_TYPE default: - GOOGLE_LOG(FATAL) << "Invalid descriptor"; + GOOGLE_ABSL_LOG(FATAL) << "Invalid descriptor"; } return target; } @@ -1542,7 +1543,7 @@ size_t WireFormat::FieldByteSize(const FieldDescriptor* field, size_t MapKeyDataOnlyByteSize(const FieldDescriptor* field, const MapKey& value) { - GOOGLE_DCHECK_EQ(FieldDescriptor::TypeToCppType(field->type()), value.type()); + GOOGLE_ABSL_DCHECK_EQ(FieldDescriptor::TypeToCppType(field->type()), value.type()); switch (field->type()) { case FieldDescriptor::TYPE_DOUBLE: case FieldDescriptor::TYPE_FLOAT: @@ -1550,7 +1551,7 @@ size_t MapKeyDataOnlyByteSize(const FieldDescriptor* field, case FieldDescriptor::TYPE_MESSAGE: case FieldDescriptor::TYPE_BYTES: case FieldDescriptor::TYPE_ENUM: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; return 0; #define CASE_TYPE(FieldType, CamelFieldType, CamelCppType) \ case FieldDescriptor::TYPE_##FieldType: \ @@ -1577,7 +1578,7 @@ size_t MapKeyDataOnlyByteSize(const FieldDescriptor* field, #undef CASE_TYPE #undef FIXED_CASE_TYPE } - GOOGLE_LOG(FATAL) << "Cannot get here"; + GOOGLE_ABSL_LOG(FATAL) << "Cannot get here"; return 0; } @@ -1585,7 +1586,7 @@ static size_t MapValueRefDataOnlyByteSize(const FieldDescriptor* field, const MapValueConstRef& value) { switch (field->type()) { case FieldDescriptor::TYPE_GROUP: - GOOGLE_LOG(FATAL) << "Unsupported"; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported"; return 0; #define CASE_TYPE(FieldType, CamelFieldType, CamelCppType) \ case FieldDescriptor::TYPE_##FieldType: \ @@ -1617,7 +1618,7 @@ static size_t MapValueRefDataOnlyByteSize(const FieldDescriptor* field, #undef CASE_TYPE #undef FIXED_CASE_TYPE } - GOOGLE_LOG(FATAL) << "Cannot get here"; + GOOGLE_ABSL_LOG(FATAL) << "Cannot get here"; return 0; } diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h index 64313c2f5778..5abd8138f409 100644 --- a/src/google/protobuf/wire_format.h +++ b/src/google/protobuf/wire_format.h @@ -130,7 +130,7 @@ class PROTOBUF_EXPORT WireFormat { int expected_endpoint = output->ByteCount() + size; output->SetCur( _InternalSerialize(message, output->Cur(), output->EpsCopy())); - GOOGLE_CHECK_EQ(output->ByteCount(), expected_endpoint) + GOOGLE_ABSL_CHECK_EQ(output->ByteCount(), expected_endpoint) << ": Protocol message serialized to a size different from what was " "originally expected. Perhaps it was modified by another thread " "during serialization?"; diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc index b2b9e7c7ecdc..2ed92101e086 100644 --- a/src/google/protobuf/wire_format_lite.cc +++ b/src/google/protobuf/wire_format_lite.cc @@ -39,6 +39,7 @@ #include #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" #include "absl/strings/str_cat.h" @@ -482,7 +483,7 @@ void WireFormatLite::WriteString(int field_number, const std::string& value, io::CodedOutputStream* output) { // String is for UTF-8 text only WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); + GOOGLE_ABSL_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteString(value); } @@ -491,14 +492,14 @@ void WireFormatLite::WriteStringMaybeAliased(int field_number, io::CodedOutputStream* output) { // String is for UTF-8 text only WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); + GOOGLE_ABSL_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteRawMaybeAliased(value.data(), value.size()); } void WireFormatLite::WriteBytes(int field_number, const std::string& value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); + GOOGLE_ABSL_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteString(value); } @@ -506,7 +507,7 @@ void WireFormatLite::WriteBytesMaybeAliased(int field_number, const std::string& value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); + GOOGLE_ABSL_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteRawMaybeAliased(value.data(), value.size()); } @@ -614,7 +615,7 @@ void PrintUTF8ErrorLog(absl::string_view message_name, " a protocol buffer. Use the 'bytes' type if you intend to " "send raw bytes. ", stacktrace); - GOOGLE_LOG(ERROR) << error_message; + GOOGLE_ABSL_LOG(ERROR) << error_message; } bool WireFormatLite::VerifyUtf8String(const char* data, int size, Operation op, diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h index 59fb09dbacdd..b95098e94b01 100644 --- a/src/google/protobuf/wire_format_lite.h +++ b/src/google/protobuf/wire_format_lite.h @@ -45,9 +45,9 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/port.h" #include "absl/base/casts.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/arenastring.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/message_lite.h" @@ -1085,7 +1085,7 @@ template inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( int tag_size, uint32_t tag, io::CodedInputStream* input, RepeatedField* values) { - GOOGLE_DCHECK_EQ(UInt32Size(tag), static_cast(tag_size)); + GOOGLE_ABSL_DCHECK_EQ(UInt32Size(tag), static_cast(tag_size)); CType value; if (!ReadPrimitive(input, &value)) return false; values->Add(value); @@ -1446,7 +1446,7 @@ inline uint8_t* WireFormatLite::WritePrimitiveNoTagToArray( const RepeatedField& value, uint8_t* (*Writer)(T, uint8_t*), uint8_t* target) { const int n = value.size(); - GOOGLE_DCHECK_GT(n, 0); + GOOGLE_ABSL_DCHECK_GT(n, 0); const T* ii = value.data(); int i = 0; @@ -1465,7 +1465,7 @@ inline uint8_t* WireFormatLite::WriteFixedNoTagToArray( (void)Writer; const int n = value.size(); - GOOGLE_DCHECK_GT(n, 0); + GOOGLE_ABSL_DCHECK_GT(n, 0); const T* ii = value.data(); const int bytes = n * static_cast(sizeof(ii[0])); diff --git a/src/google/protobuf/wire_format_unittest.inc b/src/google/protobuf/wire_format_unittest.inc index e803aa35cee3..95cfe2564c54 100644 --- a/src/google/protobuf/wire_format_unittest.inc +++ b/src/google/protobuf/wire_format_unittest.inc @@ -1230,7 +1230,7 @@ class WireFormatInvalidInputTest : public testing::Test { const FieldDescriptor* field = UNITTEST::TestAllTypes::descriptor()->FindFieldByName( "optional_nested_message"); - GOOGLE_CHECK(field != nullptr); + GOOGLE_ABSL_CHECK(field != nullptr); std::string result; @@ -1252,7 +1252,7 @@ class WireFormatInvalidInputTest : public testing::Test { bool include_end_tag) { const FieldDescriptor* field = UNITTEST::TestAllTypes::descriptor()->FindFieldByName("optionalgroup"); - GOOGLE_CHECK(field != nullptr); + GOOGLE_ABSL_CHECK(field != nullptr); std::string result; From ad746163bc200d31a928f64005128a591f86de94 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 12 Dec 2022 16:47:43 -0800 Subject: [PATCH 06/43] Remove MOA experiment flag. PiperOrigin-RevId: 494865635 --- src/google/protobuf/arena.cc | 1 - src/google/protobuf/compiler/cpp/message.cc | 23 ++++++++++--------- src/google/protobuf/extension_set_unittest.cc | 3 +-- .../generated_message_reflection_unittest.cc | 12 ++++++++++ src/google/protobuf/map_test.inc | 2 ++ src/google/protobuf/message.cc | 16 ++++--------- src/google/protobuf/message.h | 3 --- src/google/protobuf/message_lite.h | 5 ++-- src/google/protobuf/metadata_lite.h | 4 ---- src/google/protobuf/port_def.inc | 12 ---------- src/google/protobuf/port_undef.inc | 1 - src/google/protobuf/repeated_ptr_field.h | 1 - 12 files changed, 33 insertions(+), 50 deletions(-) diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index 99f247fd823f..2a624145c582 100644 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -603,7 +603,6 @@ void ThreadSafeArena::AddSerialArena(void* id, SerialArena* serial) { } void ThreadSafeArena::Init() { - // Message-owned arenas bypass thread cache and do not need life cycle ID. tag_and_id_ = GetNextLifeCycleId(); arena_stats_ = Sample(); head_.store(SentrySerialArenaChunk(), std::memory_order_relaxed); diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 3ac44ad13c1a..0f293a90e0ee 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -3602,20 +3602,21 @@ void MessageGenerator::GenerateCopyFrom(io::Printer* p) { // It is also disabled if a message has neither message fields nor // extensions, as it's impossible to copy from its descendant. // - // Note that FailIfCopyFromDescendant is implemented by reflection and not - // available for lite runtime. In that case, check if the size of the source - // has changed after Clear. - format("#ifndef NDEBUG\n"); + // Note that IsDescendant is implemented by reflection and not available for + // lite runtime. In that case, check if the size of the source has changed + // after Clear. if (HasDescriptorMethods(descriptor_->file(), options_)) { - format("FailIfCopyFromDescendant(*this, from);\n"); + format( + "$DCHK$(!::_pbi::IsDescendant(*this, from))\n" + " << \"Source of CopyFrom cannot be a descendant of the " + "target.\";\n" + "Clear();\n"); } else { - format("::size_t from_size = from.ByteSizeLong();\n"); - } - format( - "#endif\n" - "Clear();\n"); - if (!HasDescriptorMethods(descriptor_->file(), options_)) { format( + "#ifndef NDEBUG\n" + "::size_t from_size = from.ByteSizeLong();\n" + "#endif\n" + "Clear();\n" "#ifndef NDEBUG\n" "$CHK$_EQ(from_size, from.ByteSizeLong())\n" " << \"Source of CopyFrom changed when clearing target. Either \"\n" diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc index 5a351405f464..94e4bbbc4b76 100644 --- a/src/google/protobuf/extension_set_unittest.cc +++ b/src/google/protobuf/extension_set_unittest.cc @@ -829,8 +829,7 @@ TEST(ExtensionSetTest, SpaceUsedExcludingSelf) { // Repeated primitive extensions will increase space used by at least a // RepeatedField, and will cause additional allocations when the array - // gets too big for the initial space. Note, we explicitly allocate on the - // heap to avoid message-owned arenas. + // gets too big for the initial space. // This macro: // - Adds a value to the repeated extension, then clears it, establishing // the base size. diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc index 8c2b90a12a15..d4a1e1337dc0 100644 --- a/src/google/protobuf/generated_message_reflection_unittest.cc +++ b/src/google/protobuf/generated_message_reflection_unittest.cc @@ -614,10 +614,16 @@ TEST(GeneratedMessageReflectionTest, ReleaseLast) { (void)expected; // unused in somce configurations std::unique_ptr released(message.GetReflection()->ReleaseLast( &message, descriptor->FindFieldByName("repeated_foreign_message"))); +#ifndef PROTOBUF_FORCE_COPY_IN_RELEASE EXPECT_EQ(expected, released.get()); +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE } TEST(GeneratedMessageReflectionTest, ReleaseLastExtensions) { +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + GTEST_SKIP() << "Won't work with FORCE_COPY_IN_RELEASE."; +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + unittest::TestAllExtensions message; const Descriptor* descriptor = message.GetDescriptor(); TestUtil::ReflectionTester reflection_tester(descriptor); @@ -1041,7 +1047,9 @@ TEST(GeneratedMessageReflectionTest, SetAllocatedOneofMessageTest) { released = reflection->ReleaseMessage( &to_message, descriptor->FindFieldByName("foo_lazy_message")); EXPECT_TRUE(released != nullptr); +#ifndef PROTOBUF_FORCE_COPY_IN_RELEASE EXPECT_EQ(&sub_message, released); +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE delete released; TestUtil::ReflectionTester::SetOneofViaReflection(&from_message2); @@ -1059,7 +1067,9 @@ TEST(GeneratedMessageReflectionTest, SetAllocatedOneofMessageTest) { released = reflection->ReleaseMessage( &to_message, descriptor->FindFieldByName("foo_message")); EXPECT_TRUE(released != nullptr); +#ifndef PROTOBUF_FORCE_COPY_IN_RELEASE EXPECT_EQ(&sub_message2, released); +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE delete released; } @@ -1180,7 +1190,9 @@ TEST(GeneratedMessageReflectionTest, ReleaseOneofMessageTest) { &message, descriptor->FindFieldByName("foo_lazy_message")); EXPECT_TRUE(released != nullptr); +#ifndef PROTOBUF_FORCE_COPY_IN_RELEASE EXPECT_EQ(&sub_message, released); +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE delete released; released = reflection->ReleaseMessage( diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc index c57cf5c652bf..78a4808296ed 100644 --- a/src/google/protobuf/map_test.inc +++ b/src/google/protobuf/map_test.inc @@ -3170,7 +3170,9 @@ TEST(GeneratedMapFieldReflectionTest, ReleaseLast) { std::vector release_last = MapTestUtil::GetMapEntriesFromRelease(&message); MapTestUtil::ExpectMapsSize(message, 1); +#ifndef PROTOBUF_FORCE_COPY_IN_RELEASE EXPECT_TRUE(expect_last == release_last); +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE for (std::vector::iterator it = release_last.begin(); it != release_last.end(); ++it) { delete *it; diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc index b2ae719b9fd2..7191ba5fd688 100644 --- a/src/google/protobuf/message.cc +++ b/src/google/protobuf/message.cc @@ -121,22 +121,14 @@ void Message::CopyFrom(const Message& from) { } void Message::CopyWithSourceCheck(Message& to, const Message& from) { -#ifndef NDEBUG - FailIfCopyFromDescendant(to, from); -#endif + // Fail if "from" is a descendant of "to" as such copy is not allowed. + GOOGLE_ABSL_DCHECK(!internal::IsDescendant(to, from)) + << "Source of CopyFrom cannot be a descendant of the target."; + to.Clear(); to.GetClassData()->merge_to_from(to, from); } -void Message::FailIfCopyFromDescendant(Message& to, const Message& from) { - auto* arena = to.GetArenaForAllocation(); - bool same_message_owned_arena = to.GetOwningArena() == nullptr && - arena != nullptr && - arena == from.GetOwningArena(); - GOOGLE_ABSL_CHECK(!same_message_owned_arena && !internal::IsDescendant(to, from)) - << "Source of CopyFrom cannot be a descendant of the target."; -} - std::string Message::GetTypeName() const { return GetDescriptor()->full_name(); } diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 0ede96e8c9bd..28b9fc70f824 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -412,9 +412,6 @@ class PROTOBUF_EXPORT Message : public MessageLite { // type, and thus uses GetClassData(). static void CopyWithSourceCheck(Message& to, const Message& from); - // Fail if "from" is a descendant of "to" as such copy is not allowed. - static void FailIfCopyFromDescendant(Message& to, const Message& from); - inline explicit Message(Arena* arena) : MessageLite(arena) {} size_t ComputeUnknownFieldsSize(size_t total_size, internal::CachedSize* cached_size) const; diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 663321a8b483..7f266b3d649c 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -187,8 +187,7 @@ class PROTOBUF_EXPORT MessageLite { // if arena is a nullptr. virtual MessageLite* New(Arena* arena) const = 0; - // Returns user-owned arena; nullptr if it's message owned. - Arena* GetArena() const { return _internal_metadata_.user_arena(); } + Arena* GetArena() const { return _internal_metadata_.arena(); } // Clear all fields of the message and set them to their default values. // Clear() assumes that any memory allocated to hold parts of the message @@ -436,7 +435,7 @@ class PROTOBUF_EXPORT MessageLite { // internal memory). This method is used in proto's implementation for // swapping, moving and setting allocated, for deciding whether the ownership // of this message or its internal memory could be changed. - Arena* GetOwningArena() const { return _internal_metadata_.owning_arena(); } + Arena* GetOwningArena() const { return _internal_metadata_.arena(); } // Returns the arena, used for allocating internal objects(e.g., child // messages, etc), or owning incoming objects (e.g., set allocated). diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h index cb75e57e07b0..66c944086124 100644 --- a/src/google/protobuf/metadata_lite.h +++ b/src/google/protobuf/metadata_lite.h @@ -95,10 +95,6 @@ class PROTOBUF_EXPORT InternalMetadata { } } - PROTOBUF_NDEBUG_INLINE Arena* owning_arena() const { return arena(); } - - PROTOBUF_NDEBUG_INLINE Arena* user_arena() const { return arena(); } - PROTOBUF_NDEBUG_INLINE Arena* arena() const { if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) { return PtrValue()->arena; diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index fb7505c3551b..1a05c4fd1bf7 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -655,18 +655,6 @@ #error "endian detection failed for current compiler" #endif -// For enabling message owned arena, one major blocker is semantic change from -// moving to copying when there is ownership transfer (e.g., move ctor, swap, -// set allocated, release). This change not only causes performance regression -// but also breaks users code (e.g., dangling reference). For top-level -// messages, since it owns the arena, we can mitigate the issue by transferring -// ownership of arena. However, we cannot do that for nested messages. In order -// to tell how many usages of nested messages affected by message owned arena, -// we need to simulate the arena ownership. -// This experiment is purely for the purpose of gathering data. All code guarded -// by this flag is supposed to be removed after this experiment. -#define PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT - #ifdef PROTOBUF_CONSTINIT #error PROTOBUF_CONSTINIT was previously defined #endif diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc index 217b49b642fa..c52eb30a4ec0 100644 --- a/src/google/protobuf/port_undef.inc +++ b/src/google/protobuf/port_undef.inc @@ -90,7 +90,6 @@ #undef PROTOBUF_THREAD_LOCAL #undef PROTOBUF_LITTLE_ENDIAN #undef PROTOBUF_BIG_ENDIAN -#undef PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT #undef PROTOBUF_CONSTINIT #undef PROTOBUF_CONSTEXPR #undef PROTOBUF_ATTRIBUTE_WEAK diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h index 00b1e966d0e0..0d82a8e516e2 100644 --- a/src/google/protobuf/repeated_ptr_field.h +++ b/src/google/protobuf/repeated_ptr_field.h @@ -516,7 +516,6 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr) << "ReleaseCleared() can only be used on a RepeatedPtrField not on " << "an arena."; - GOOGLE_ABSL_DCHECK(GetOwningArena() == nullptr); GOOGLE_ABSL_DCHECK(rep_ != nullptr); GOOGLE_ABSL_DCHECK_GT(rep_->allocated_size, current_size_); return cast(rep_->elements[--rep_->allocated_size]); From d7610a4a322be4b5798bf0bc05e937d29dd903f6 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 12 Dec 2022 17:04:27 -0800 Subject: [PATCH 07/43] Internal changes PiperOrigin-RevId: 494869411 --- .../protobuf/compiler/annotation_test_util.cc | 7 ++- .../protobuf/compiler/code_generator.cc | 6 +- .../compiler/command_line_interface.cc | 25 ++++---- .../command_line_interface_unittest.cc | 39 +++++++------ .../csharp/csharp_bootstrap_unittest.cc | 5 +- .../protobuf/compiler/csharp/csharp_enum.cc | 6 +- .../compiler/csharp/csharp_field_base.cc | 9 +-- .../compiler/csharp/csharp_helpers.cc | 7 ++- .../compiler/csharp/csharp_message.cc | 4 +- .../protobuf/compiler/importer_unittest.cc | 11 ++-- .../protobuf/compiler/mock_code_generator.cc | 13 +++-- .../protobuf/compiler/objectivec/field.cc | 6 +- .../protobuf/compiler/objectivec/helpers.cc | 13 +++-- .../compiler/objectivec/import_writer.cc | 3 +- .../protobuf/compiler/objectivec/map_field.cc | 3 +- .../protobuf/compiler/objectivec/message.cc | 3 +- .../compiler/objectivec/primitive_field.cc | 5 +- src/google/protobuf/compiler/parser.cc | 25 ++++---- .../protobuf/compiler/parser_unittest.cc | 5 +- .../protobuf/compiler/php/php_generator.cc | 5 +- src/google/protobuf/compiler/plugin.cc | 1 - .../protobuf/compiler/ruby/ruby_generator.cc | 15 +++-- .../compiler/ruby/ruby_generator_unittest.cc | 36 ++++-------- src/google/protobuf/compiler/scc.h | 8 +-- src/google/protobuf/compiler/subprocess.cc | 57 ++++++++++--------- 25 files changed, 167 insertions(+), 150 deletions(-) diff --git a/src/google/protobuf/compiler/annotation_test_util.cc b/src/google/protobuf/compiler/annotation_test_util.cc index f8ffeec58477..35ec75c53b9f 100644 --- a/src/google/protobuf/compiler/annotation_test_util.cc +++ b/src/google/protobuf/compiler/annotation_test_util.cc @@ -40,6 +40,7 @@ #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/io/zero_copy_stream.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" @@ -70,8 +71,8 @@ class DescriptorCapturingGenerator : public CodeGenerator { } // namespace void AddFile(const std::string& filename, const std::string& data) { - GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data, - true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/" + filename, data, + true)); } bool RunProtoCompiler(const std::string& filename, @@ -94,7 +95,7 @@ bool RunProtoCompiler(const std::string& filename, bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info) { std::string data; - GOOGLE_CHECK_OK(File::GetContents(path, &data, true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &data, true)); io::ArrayInputStream input(data.data(), data.size()); return info->ParseFromZeroCopyStream(&input); } diff --git a/src/google/protobuf/compiler/code_generator.cc b/src/google/protobuf/compiler/code_generator.cc index 8bc11cb0d675..737306415c6a 100644 --- a/src/google/protobuf/compiler/code_generator.cc +++ b/src/google/protobuf/compiler/code_generator.cc @@ -34,9 +34,9 @@ #include "google/protobuf/compiler/code_generator.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/descriptor.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_split.h" #include "absl/strings/strip.h" @@ -81,7 +81,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForAppend( io::ZeroCopyOutputStream* GeneratorContext::OpenForInsert( const std::string& filename, const std::string& insertion_point) { - GOOGLE_LOG(FATAL) << "This GeneratorContext does not support insertion."; + GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support insertion."; return nullptr; // make compiler happy } @@ -93,7 +93,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForInsertWithGeneratedCodeInfo( void GeneratorContext::ListParsedFiles( std::vector* output) { - GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; + GOOGLE_ABSL_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; } void GeneratorContext::GetCompilerVersion(Version* version) const { diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 6a44b04a47bf..9c7a1686707e 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -74,6 +74,7 @@ #include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/subprocess.h" #include "google/protobuf/compiler/plugin.pb.h" #include "absl/container/flat_hash_set.h" @@ -141,7 +142,7 @@ void SetFdToTextMode(int fd) { #ifdef _WIN32 if (setmode(fd, _O_TEXT) == -1) { // This should never happen, I think. - GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno); + GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd << ", _O_TEXT): " << strerror(errno); } #endif // (Text and binary are the same on non-Windows platforms.) @@ -151,7 +152,8 @@ void SetFdToBinaryMode(int fd) { #ifdef _WIN32 if (setmode(fd, _O_BINARY) == -1) { // This should never happen, I think. - GOOGLE_LOG(WARNING) << "setmode(" << fd << ", _O_BINARY): " << strerror(errno); + GOOGLE_ABSL_LOG(WARNING) << "setmode(" << fd + << ", _O_BINARY): " << strerror(errno); } #endif // (Text and binary are the same on non-Windows platforms.) @@ -892,7 +894,7 @@ CommandLineInterface::MemoryOutputStream::~MemoryOutputStream() { data_pos += line_length; } - GOOGLE_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size); + GOOGLE_ABSL_CHECK_EQ(target_ptr, &(*target)[pos] + data_.size() + indent_size); UpdateMetadata(data_, pos, data_.size() + indent_size, indent_.size()); } @@ -1106,7 +1108,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { } if (!dependency_out_name_.empty()) { - GOOGLE_DCHECK(disk_source_tree.get()); + GOOGLE_ABSL_DCHECK(disk_source_tree.get()); if (!GenerateDependencyManifestFile(parsed_files, output_directories, disk_source_tree.get())) { return 1; @@ -1126,7 +1128,7 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { FileDescriptorProto file; file.set_name("empty_message.proto"); file.add_message_type()->set_name("EmptyMessage"); - GOOGLE_CHECK(pool.BuildFile(file) != nullptr); + GOOGLE_ABSL_CHECK(pool.BuildFile(file) != nullptr); codec_type_ = "EmptyMessage"; if (!EncodeOrDecode(&pool)) { return 1; @@ -1154,8 +1156,9 @@ int CommandLineInterface::Run(int argc, const char* const argv[]) { } break; case PRINT_NONE: - GOOGLE_LOG(ERROR) << "If the code reaches here, it usually means a bug of " - "flag parsing in the CommandLineInterface."; + GOOGLE_ABSL_LOG(ERROR) + << "If the code reaches here, it usually means a bug of " + "flag parsing in the CommandLineInterface."; return 1; // Do not add a default case. @@ -1558,7 +1561,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments( input_files_.empty() && descriptor_set_in_names_.empty(); break; default: - GOOGLE_LOG(FATAL) << "Unexpected mode: " << mode_; + GOOGLE_ABSL_LOG(FATAL) << "Unexpected mode: " << mode_; } if (missing_proto_definitions) { std::cerr << "Missing input file." << std::endl; @@ -1763,7 +1766,7 @@ CommandLineInterface::InterpretArgument(const std::string& name, direct_dependencies_explicitly_set_ = true; std::vector direct = absl::StrSplit(value, ":", absl::SkipEmpty()); - GOOGLE_DCHECK(direct_dependencies_.empty()); + GOOGLE_ABSL_DCHECK(direct_dependencies_.empty()); direct_dependencies_.insert(direct.begin(), direct.end()); } else if (name == "--direct_dependencies_violation_msg") { @@ -2163,8 +2166,8 @@ bool CommandLineInterface::GenerateOutput( std::string error; if (output_directive.generator == nullptr) { // This is a plugin. - GOOGLE_CHECK(absl::StartsWith(output_directive.name, "--") && - absl::EndsWith(output_directive.name, "_out")) + GOOGLE_ABSL_CHECK(absl::StartsWith(output_directive.name, "--") && + absl::EndsWith(output_directive.name, "_out")) << "Bad name for plugin generator: " << output_directive.name; std::string plugin_name = PluginName(plugin_prefix_, output_directive.name); diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index b595cf19eb8f..bc268f01bf3f 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -38,6 +38,7 @@ #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_format.h" #ifndef _MSC_VER @@ -288,7 +289,7 @@ void CommandLineInterfaceTest::SetUp() { } // Create the temp directory. - GOOGLE_CHECK_OK(File::CreateDir(temp_directory_, 0777)); + GOOGLE_ABSL_CHECK_OK(File::CreateDir(temp_directory_, 0777)); // Register generators. CodeGenerator* generator = new MockCodeGenerator("test_generator"); @@ -361,7 +362,7 @@ void CommandLineInterfaceTest::RunWithArgs(std::vector args) { #endif if (plugin_path.empty() || !FileExists(plugin_path)) { - GOOGLE_LOG(ERROR) + GOOGLE_ABSL_LOG(ERROR) << "Plugin executable not found. Plugin tests are likely to fail." << plugin_path; } else { @@ -401,21 +402,21 @@ void CommandLineInterfaceTest::CreateTempFile(const std::string& name, if (slash_pos != std::string::npos) { std::string dir = name.substr(0, slash_pos); if (!FileExists(temp_directory_ + "/" + dir)) { - GOOGLE_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + dir, - 0777)); + GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + dir, + 0777)); } } // Write file. std::string full_name = temp_directory_ + "/" + name; - GOOGLE_CHECK_OK(File::SetContents( + GOOGLE_ABSL_CHECK_OK(File::SetContents( full_name, absl::StrReplaceAll(contents, {{"$tmpdir", temp_directory_}}), true)); } void CommandLineInterfaceTest::CreateTempDir(const std::string& name) { - GOOGLE_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + name, - 0777)); + GOOGLE_ABSL_CHECK_OK(File::RecursivelyCreateDir(temp_directory_ + "/" + name, + 0777)); } // ------------------------------------------------------------------- @@ -503,7 +504,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet( const std::string& filename, FileDescriptorSet* descriptor_set) { std::string path = temp_directory_ + "/" + filename; std::string file_contents; - GOOGLE_CHECK_OK(File::GetContents(path, &file_contents, true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true)); if (!descriptor_set->ParseFromString(file_contents)) { FAIL() << "Could not parse file contents: " << path; @@ -513,7 +514,7 @@ void CommandLineInterfaceTest::ReadDescriptorSet( void CommandLineInterfaceTest::WriteDescriptorSet( const std::string& filename, const FileDescriptorSet* descriptor_set) { std::string binary_proto; - GOOGLE_CHECK(descriptor_set->SerializeToString(&binary_proto)); + GOOGLE_ABSL_CHECK(descriptor_set->SerializeToString(&binary_proto)); CreateTempFile(filename, binary_proto); } @@ -539,7 +540,7 @@ void CommandLineInterfaceTest::ExpectFileContent(const std::string& filename, const std::string& content) { std::string path = temp_directory_ + "/" + filename; std::string file_contents; - GOOGLE_CHECK_OK(File::GetContents(path, &file_contents, true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(path, &file_contents, true)); EXPECT_EQ(absl::StrReplaceAll(content, {{"$tmpdir", temp_directory_}}), file_contents); @@ -2560,8 +2561,8 @@ class EncodeDecodeTest : public testing::TestWithParam { void RedirectStdinFromText(const std::string& input) { std::string filename = TestTempDir() + "/test_stdin"; - GOOGLE_CHECK_OK(File::SetContents(filename, input, true)); - GOOGLE_CHECK(RedirectStdinFromFile(filename)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, input, true)); + GOOGLE_ABSL_CHECK(RedirectStdinFromFile(filename)); } bool RedirectStdinFromFile(const std::string& filename) { @@ -2629,7 +2630,8 @@ class EncodeDecodeTest : public testing::TestWithParam { void ExpectStdoutMatchesBinaryFile(const std::string& filename) { std::string expected_output; - GOOGLE_CHECK_OK(File::GetContents(filename, &expected_output, true)); + GOOGLE_ABSL_CHECK_OK( + File::GetContents(filename, &expected_output, true)); // Don't use EXPECT_EQ because we don't want to print raw binary data to // stdout on failure. @@ -2638,7 +2640,8 @@ class EncodeDecodeTest : public testing::TestWithParam { void ExpectStdoutMatchesTextFile(const std::string& filename) { std::string expected_output; - GOOGLE_CHECK_OK(File::GetContents(filename, &expected_output, true)); + GOOGLE_ABSL_CHECK_OK( + File::GetContents(filename, &expected_output, true)); ExpectStdoutMatchesText(expected_output); } @@ -2670,12 +2673,12 @@ class EncodeDecodeTest : public testing::TestWithParam { protobuf_unittest_import::PublicImportMessage public_import_message; public_import_message.descriptor()->file()->CopyTo( file_descriptor_set.add_file()); - GOOGLE_DCHECK(file_descriptor_set.IsInitialized()); + GOOGLE_ABSL_DCHECK(file_descriptor_set.IsInitialized()); std::string binary_proto; - GOOGLE_CHECK(file_descriptor_set.SerializeToString(&binary_proto)); - GOOGLE_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_, - binary_proto, true)); + GOOGLE_ABSL_CHECK(file_descriptor_set.SerializeToString(&binary_proto)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(unittest_proto_descriptor_set_filename_, + binary_proto, true)); } int duped_stdin_; diff --git a/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc b/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc index b40e0bd6f3a5..189b07ddbd9b 100644 --- a/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc @@ -83,9 +83,8 @@ class MockGeneratorContext : public GeneratorContext { std::string expected_contents = *it->second; std::string actual_contents; - GOOGLE_CHECK_OK( - File::GetContentsAsText(TestSourceDir() + "/" + physical_filename, - &actual_contents, true)) + GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText( + TestSourceDir() + "/" + physical_filename, &actual_contents, true)) << "Unable to get " << physical_filename; EXPECT_TRUE(actual_contents == expected_contents) << physical_filename << " needs to be regenerated. Please run " diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc index eaeef310535f..5f30778a634a 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -35,6 +35,7 @@ #include "google/protobuf/compiler/code_generator.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/csharp/csharp_doc_comment.h" #include "google/protobuf/compiler/csharp/csharp_helpers.h" @@ -78,8 +79,9 @@ void EnumGenerator::Generate(io::Printer* printer) { // Make sure we don't get any duplicate names due to prefix removal. while (!used_names.insert(name).second) { // It's possible we'll end up giving this warning multiple times, but that's better than not at all. - GOOGLE_LOG(WARNING) << "Duplicate enum value " << name << " (originally " << original_name - << ") in " << descriptor_->name() << "; adding underscore to distinguish"; + GOOGLE_ABSL_LOG(WARNING) << "Duplicate enum value " << name << " (originally " + << original_name << ") in " << descriptor_->name() + << "; adding underscore to distinguish"; name += "_"; } int number = descriptor_->value(i)->number(); diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc index 158bf710749c..d7137aac7a74 100644 --- a/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -36,6 +36,7 @@ #include #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/csharp/csharp_helpers.h" #include "google/protobuf/compiler/csharp/names.h" #include "google/protobuf/descriptor.h" @@ -278,7 +279,7 @@ std::string FieldGeneratorBase::type_name(const FieldDescriptor* descriptor) { case FieldDescriptor::TYPE_SINT64: return "long"; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return ""; } } @@ -320,7 +321,7 @@ bool FieldGeneratorBase::has_default_value() { case FieldDescriptor::TYPE_SINT64: return descriptor_->default_value_int64() != 0L; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return true; } } @@ -420,7 +421,7 @@ std::string FieldGeneratorBase::default_value(const FieldDescriptor* descriptor) case FieldDescriptor::TYPE_SINT64: return absl::StrCat(descriptor->default_value_int64()) + "L"; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return ""; } } @@ -468,7 +469,7 @@ std::string FieldGeneratorBase::capitalized_type_name() { case FieldDescriptor::TYPE_SINT64: return "SInt64"; default: - GOOGLE_LOG(FATAL)<< "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return ""; } } diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc index 1ff5444cbca4..b14f31d024a0 100644 --- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -40,6 +40,7 @@ #include #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/str_replace.h" #include "absl/strings/string_view.h" @@ -106,7 +107,7 @@ CSharpType GetCSharpType(FieldDescriptor::Type type) { // No default because we want the compiler to complain if any new // types are added. } - GOOGLE_LOG(FATAL)<< "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return (CSharpType) -1; } @@ -336,7 +337,7 @@ int GetFixedSize(FieldDescriptor::Type type) { // No default because we want the compiler to complain if any new // types are added. } - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return -1; } @@ -461,7 +462,7 @@ bool IsNullable(const FieldDescriptor* descriptor) { return true; default: - GOOGLE_LOG(FATAL) << "Unknown field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unknown field type."; return true; } } diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc index d5c803fce600..861908475ad5 100644 --- a/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -35,6 +35,7 @@ #include "google/protobuf/compiler/code_generator.h" #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/csharp/csharp_doc_comment.h" #include "google/protobuf/compiler/csharp/csharp_enum.h" @@ -764,7 +765,8 @@ int MessageGenerator::GetPresenceIndex(const FieldDescriptor* descriptor) { index++; } } - GOOGLE_LOG(DFATAL)<< "Could not find presence index for field " << descriptor->name(); + GOOGLE_ABSL_LOG(DFATAL) << "Could not find presence index for field " + << descriptor->name(); return -1; } diff --git a/src/google/protobuf/compiler/importer_unittest.cc b/src/google/protobuf/compiler/importer_unittest.cc index 8b7c0ea495ca..ddfbd9c0d509 100644 --- a/src/google/protobuf/compiler/importer_unittest.cc +++ b/src/google/protobuf/compiler/importer_unittest.cc @@ -36,7 +36,6 @@ #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" @@ -44,6 +43,7 @@ #include "google/protobuf/testing/googletest.h" #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/status/status.h" #include "absl/strings/substitute.h" #include "google/protobuf/io/zero_copy_stream_impl.h" @@ -266,7 +266,7 @@ class DiskSourceTreeTest : public testing::Test { if (FileExists(dirnames_[i])) { File::DeleteRecursively(dirnames_[i], NULL, NULL); } - GOOGLE_CHECK_OK(File::CreateDir(dirnames_[i], 0777)); + GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirnames_[i], 0777)); } } @@ -279,11 +279,11 @@ class DiskSourceTreeTest : public testing::Test { } void AddFile(const std::string& filename, const char* contents) { - GOOGLE_CHECK_OK(File::SetContents(filename, contents, true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(filename, contents, true)); } void AddSubdir(const std::string& dirname) { - GOOGLE_CHECK_OK(File::CreateDir(dirname, 0777)); + GOOGLE_ABSL_CHECK_OK(File::CreateDir(dirname, 0777)); } void ExpectFileContents(const std::string& filename, @@ -397,7 +397,8 @@ TEST_F(DiskSourceTreeTest, OrderingTrumpsSpecificity) { // directory is more-specific than a former one. // Create the "bar" directory so we can put a file in it. - GOOGLE_CHECK_OK(File::CreateDir(dirnames_[0] + "/bar", 0777)); + GOOGLE_ABSL_CHECK_OK( + File::CreateDir(dirnames_[0] + "/bar", 0777)); // Add files and map paths. AddFile(dirnames_[0] + "/bar/foo", "Hello World!"); diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc index 3e053462961e..a4d6ecf39583 100644 --- a/src/google/protobuf/compiler/mock_code_generator.cc +++ b/src/google/protobuf/compiler/mock_code_generator.cc @@ -39,12 +39,13 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/descriptor.pb.h" #include +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_join.h" #include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" @@ -105,7 +106,7 @@ void MockCodeGenerator::ExpectGenerated( const std::string& first_parsed_file_name, const std::string& output_directory) { std::string content; - GOOGLE_CHECK_OK( + GOOGLE_ABSL_CHECK_OK( File::GetContents(output_directory + "/" + GetOutputFileName(name, file), &content, true)); @@ -163,15 +164,15 @@ void MockCodeGenerator::CheckGeneratedAnnotations( const std::string& name, const std::string& file, const std::string& output_directory) { std::string file_content; - GOOGLE_CHECK_OK( + GOOGLE_ABSL_CHECK_OK( File::GetContents(output_directory + "/" + GetOutputFileName(name, file), &file_content, true)); std::string meta_content; - GOOGLE_CHECK_OK(File::GetContents( + GOOGLE_ABSL_CHECK_OK(File::GetContents( output_directory + "/" + GetOutputFileName(name, file) + ".pb.meta", &meta_content, true)); GeneratedCodeInfo annotations; - GOOGLE_CHECK(TextFormat::ParseFromString(meta_content, &annotations)); + GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(meta_content, &annotations)); ASSERT_EQ(7, annotations.annotation_size()); CheckSingleAnnotation("first_annotation", "first", file_content, @@ -245,7 +246,7 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file, << " " << compiler_version.suffix() << std::endl; abort(); } else { - GOOGLE_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command; + GOOGLE_ABSL_LOG(FATAL) << "Unknown MockCodeGenerator command: " << command; } } } diff --git a/src/google/protobuf/compiler/objectivec/field.cc b/src/google/protobuf/compiler/objectivec/field.cc index bf4c1f399876..8119be6fdf5b 100644 --- a/src/google/protobuf/compiler/objectivec/field.cc +++ b/src/google/protobuf/compiler/objectivec/field.cc @@ -36,6 +36,8 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/objectivec/enum_field.h" #include "google/protobuf/compiler/objectivec/helpers.h" @@ -167,7 +169,7 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return false; } @@ -476,7 +478,7 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor) const FieldGenerator& FieldGeneratorMap::get( const FieldDescriptor* field) const { - GOOGLE_CHECK_EQ(field->containing_type(), descriptor_); + GOOGLE_ABSL_CHECK_EQ(field->containing_type(), descriptor_); return *field_generators_[field->index()]; } diff --git a/src/google/protobuf/compiler/objectivec/helpers.cc b/src/google/protobuf/compiler/objectivec/helpers.cc index 2c376d73555a..e7081ee1d18b 100644 --- a/src/google/protobuf/compiler/objectivec/helpers.cc +++ b/src/google/protobuf/compiler/objectivec/helpers.cc @@ -34,6 +34,7 @@ #include #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" @@ -66,7 +67,7 @@ std::string GetZeroEnumNameForFlagType(const FlagType flag_type) { case FLAGTYPE_FIELD: return "GPBFieldNone"; default: - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return "0"; } } @@ -80,7 +81,7 @@ std::string GetEnumNameForFlagType(const FlagType flag_type) { case FLAGTYPE_FIELD: return "GPBFieldFlags"; default: - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } } @@ -147,7 +148,7 @@ std::string GetCapitalizedType(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } @@ -196,7 +197,7 @@ ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return OBJECTIVECTYPE_INT32; } @@ -235,7 +236,7 @@ std::string GPBGenericValueFieldName(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } @@ -306,7 +307,7 @@ std::string DefaultValue(const FieldDescriptor* field) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return std::string(); } diff --git a/src/google/protobuf/compiler/objectivec/import_writer.cc b/src/google/protobuf/compiler/objectivec/import_writer.cc index 63a8a043b214..3bbf62d119b4 100644 --- a/src/google/protobuf/compiler/objectivec/import_writer.cc +++ b/src/google/protobuf/compiler/objectivec/import_writer.cc @@ -36,6 +36,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "google/protobuf/compiler/objectivec/line_consumer.h" @@ -197,7 +198,7 @@ void ImportWriter::PrintRuntimeImports(io::Printer* p, // If bundled, no need to do the framework support below. if (for_bundled_proto_) { - GOOGLE_DCHECK(!default_cpp_symbol); + GOOGLE_ABSL_DCHECK(!default_cpp_symbol); for (const auto& header : protobuf_imports_) { p->Print("#import \"$header$\"\n", "header", header); } diff --git a/src/google/protobuf/compiler/objectivec/map_field.cc b/src/google/protobuf/compiler/objectivec/map_field.cc index a9c73fd6546f..be76323bdb56 100644 --- a/src/google/protobuf/compiler/objectivec/map_field.cc +++ b/src/google/protobuf/compiler/objectivec/map_field.cc @@ -34,6 +34,7 @@ #include #include "absl/container/btree_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/match.h" #include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/compiler/objectivec/names.h" @@ -78,7 +79,7 @@ const char* MapEntryTypeName(const FieldDescriptor* descriptor, bool isKey) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } diff --git a/src/google/protobuf/compiler/objectivec/message.cc b/src/google/protobuf/compiler/objectivec/message.cc index 7a52b40b55e3..51a404737bf1 100644 --- a/src/google/protobuf/compiler/objectivec/message.cc +++ b/src/google/protobuf/compiler/objectivec/message.cc @@ -38,6 +38,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/objectivec/extension.h" @@ -127,7 +128,7 @@ int OrderGroupForFieldDescriptor(const FieldDescriptor* descriptor) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return 0; } diff --git a/src/google/protobuf/compiler/objectivec/primitive_field.cc b/src/google/protobuf/compiler/objectivec/primitive_field.cc index fa89d2cfa25a..24c85b34a56e 100644 --- a/src/google/protobuf/compiler/objectivec/primitive_field.cc +++ b/src/google/protobuf/compiler/objectivec/primitive_field.cc @@ -33,6 +33,7 @@ #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_cat.h" #include "google/protobuf/compiler/objectivec/helpers.h" #include "google/protobuf/io/printer.h" @@ -73,7 +74,7 @@ const char* PrimitiveTypeName(const FieldDescriptor* descriptor) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } @@ -107,7 +108,7 @@ const char* PrimitiveArrayTypeName(const FieldDescriptor* descriptor) { // Some compilers report reaching end of function even though all cases of // the enum are handed in the switch. - GOOGLE_LOG(FATAL) << "Can't get here."; + GOOGLE_ABSL_LOG(FATAL) << "Can't get here."; return nullptr; } diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc index 98e4bca539ce..f0e103fe2520 100644 --- a/src/google/protobuf/compiler/parser.cc +++ b/src/google/protobuf/compiler/parser.cc @@ -44,10 +44,11 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "absl/base/casts.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" @@ -516,8 +517,8 @@ int Parser::LocationRecorder::CurrentPathSize() const { void Parser::LocationRecorder::AttachComments( std::string* leading, std::string* trailing, std::vector* detached_comments) const { - GOOGLE_CHECK(!location_->has_leading_comments()); - GOOGLE_CHECK(!location_->has_trailing_comments()); + GOOGLE_ABSL_CHECK(!location_->has_leading_comments()); + GOOGLE_ABSL_CHECK(!location_->has_trailing_comments()); if (!leading->empty()) { location_->mutable_leading_comments()->swap(*leading); @@ -671,10 +672,11 @@ bool Parser::Parse(io::Tokenizer* input, FileDescriptorProto* file) { file->set_syntax(syntax_identifier_); } } else if (!stop_after_syntax_identifier_) { - GOOGLE_LOG(WARNING) << "No syntax specified for the proto file: " << file->name() - << ". Please use 'syntax = \"proto2\";' " - << "or 'syntax = \"proto3\";' to specify a syntax " - << "version. (Defaulted to proto2 syntax.)"; + GOOGLE_ABSL_LOG(WARNING) << "No syntax specified for the proto file: " + << file->name() + << ". Please use 'syntax = \"proto2\";' " + << "or 'syntax = \"proto3\";' to specify a syntax " + << "version. (Defaulted to proto2 syntax.)"; syntax_identifier_ = "proto2"; } @@ -1488,7 +1490,7 @@ bool Parser::ParseOption(Message* options, // Create an entry in the uninterpreted_option field. const FieldDescriptor* uninterpreted_option_field = options->GetDescriptor()->FindFieldByName("uninterpreted_option"); - GOOGLE_CHECK(uninterpreted_option_field != nullptr) + GOOGLE_ABSL_CHECK(uninterpreted_option_field != nullptr) << "No field named \"uninterpreted_option\" in the Options proto."; const Reflection* reflection = options->GetReflection(); @@ -1541,7 +1543,8 @@ bool Parser::ParseOption(Message* options, switch (input_->current().type) { case io::Tokenizer::TYPE_START: - GOOGLE_LOG(FATAL) << "Trying to read value before any tokens have been read."; + GOOGLE_ABSL_LOG(FATAL) + << "Trying to read value before any tokens have been read."; return false; case io::Tokenizer::TYPE_END: @@ -1550,9 +1553,9 @@ bool Parser::ParseOption(Message* options, case io::Tokenizer::TYPE_WHITESPACE: case io::Tokenizer::TYPE_NEWLINE: - GOOGLE_CHECK(!input_->report_whitespace() && !input_->report_newlines()) + GOOGLE_ABSL_CHECK(!input_->report_whitespace() && !input_->report_newlines()) << "Whitespace tokens were not requested."; - GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace."; + GOOGLE_ABSL_LOG(FATAL) << "Tokenizer reported whitespace."; return false; case io::Tokenizer::TYPE_IDENTIFIER: { diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc index 91789f70f827..2628f89ae4cc 100644 --- a/src/google/protobuf/compiler/parser_unittest.cc +++ b/src/google/protobuf/compiler/parser_unittest.cc @@ -45,6 +45,7 @@ #include "google/protobuf/testing/googletest.h" #include #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_join.h" #include "absl/strings/substitute.h" #include "google/protobuf/test_util2.h" @@ -2855,14 +2856,14 @@ class SourceInfoTest : public ParserTest { while (*text != '\0') { if (*text == '$') { ++text; - GOOGLE_CHECK_NE('\0', *text); + GOOGLE_ABSL_CHECK_NE('\0', *text); if (*text == '$') { text_without_markers_ += '$'; ++column; } else { markers_[*text] = std::make_pair(line, column); ++text; - GOOGLE_CHECK_EQ('$', *text); + GOOGLE_ABSL_CHECK_EQ('$', *text); } } else if (*text == '\n') { ++line; diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index 5501c98f2be6..956fe0b80098 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -36,6 +36,7 @@ #include "google/protobuf/compiler/code_generator.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_replace.h" @@ -2309,14 +2310,14 @@ bool Generator::GenerateAll(const std::vector& files, options.aggregate_metadata = true; for (const auto& prefix : absl::StrSplit(option_pair[1], "#", absl::AllowEmpty())) { options.aggregate_metadata_prefixes.emplace(prefix); - GOOGLE_LOG(INFO) << prefix; + GOOGLE_ABSL_LOG(INFO) << prefix; } } else if (option_pair[0] == "internal") { options.is_descriptor = true; } else if (option_pair[0] == "internal_generate_c_wkt") { GenerateCWellKnownTypes(files, generator_context); } else { - GOOGLE_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; + GOOGLE_ABSL_LOG(FATAL) << "Unknown codegen option: " << option_pair[0]; } } diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc index 082e0a852a06..df0916f7fbe0 100644 --- a/src/google/protobuf/compiler/plugin.cc +++ b/src/google/protobuf/compiler/plugin.cc @@ -39,7 +39,6 @@ #include #endif -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/plugin.pb.h" #include "google/protobuf/compiler/code_generator.h" #include "google/protobuf/descriptor.h" diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.cc b/src/google/protobuf/compiler/ruby/ruby_generator.cc index be643d88b6e8..47a621eefdf9 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -34,6 +34,7 @@ #include #include "google/protobuf/compiler/code_generator.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/compiler/plugin.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" @@ -121,8 +122,8 @@ std::string StringifySyntax(FileDescriptor::Syntax syntax) { return "proto3"; case FileDescriptor::SYNTAX_UNKNOWN: default: - GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports " - "proto2 and proto3 syntax."; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported syntax; this generator only supports " + "proto2 and proto3 syntax."; return ""; } } @@ -247,7 +248,8 @@ void GenerateOneof(const OneofDescriptor* oneof, io::Printer* printer) { bool GenerateMessage(const Descriptor* message, io::Printer* printer, std::string* error) { if (message->extension_range_count() > 0 || message->extension_count() > 0) { - GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; + GOOGLE_ABSL_LOG(WARNING) + << "Extensions are not yet supported for proto2 .proto files."; } // Don't generate MapEntry messages -- we use the Ruby extension's native @@ -422,8 +424,8 @@ int GeneratePackageModules(const FileDescriptor* file, io::Printer* printer) { if (package_name.find("::") != std::string::npos) { need_change_to_module = false; } else if (package_name.find('.') != std::string::npos) { - GOOGLE_LOG(WARNING) << "ruby_package option should be in the form of:" - << " 'A::B::C' and not 'A.B.C'"; + GOOGLE_ABSL_LOG(WARNING) << "ruby_package option should be in the form of:" + << " 'A::B::C' and not 'A.B.C'"; } } else { package_name = file->package(); @@ -519,7 +521,8 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, // TODO: Remove this when ruby supports extensions for proto2 syntax. if (file->syntax() == FileDescriptor::SYNTAX_PROTO2 && file->extension_count() > 0) { - GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; + GOOGLE_ABSL_LOG(WARNING) + << "Extensions are not yet supported for proto2 .proto files."; } bool use_raw_descriptor = file->name() == "google/protobuf/descriptor.proto"; diff --git a/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc b/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc index 31d3770cee8d..729f370cb167 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc @@ -68,26 +68,18 @@ void RubyTest(std::string proto_file, std::string import_proto_file = "") { // Copy generated_code.proto to the temporary test directory. std::string test_input; - GOOGLE_CHECK_OK(File::GetContents( - ruby_tests + proto_file + ".proto", - &test_input, - true)); - GOOGLE_CHECK_OK(File::SetContents( - TestTempDir() + proto_file + ".proto", - test_input, - true)); + GOOGLE_ABSL_CHECK_OK( + File::GetContents(ruby_tests + proto_file + ".proto", &test_input, true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + proto_file + ".proto", + test_input, true)); // Copy generated_code_import.proto to the temporary test directory. std::string test_import; if (!import_proto_file.empty()) { - GOOGLE_CHECK_OK(File::GetContents( - ruby_tests + import_proto_file + ".proto", - &test_import, - true)); - GOOGLE_CHECK_OK(File::SetContents( - TestTempDir() + import_proto_file + ".proto", - test_import, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(ruby_tests + import_proto_file + ".proto", + &test_import, true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents( + TestTempDir() + import_proto_file + ".proto", test_import, true)); } // Invoke the proto compiler (we will be inside TestTempDir() at this point). @@ -106,15 +98,11 @@ void RubyTest(std::string proto_file, std::string import_proto_file = "") { // Load the generated output and compare to the expected result. std::string output; - GOOGLE_CHECK_OK(File::GetContentsAsText( - TestTempDir() + proto_file + "_pb.rb", - &output, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(TestTempDir() + proto_file + "_pb.rb", + &output, true)); std::string expected_output; - GOOGLE_CHECK_OK(File::GetContentsAsText( - ruby_tests + proto_file + "_pb.rb", - &expected_output, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContentsAsText(ruby_tests + proto_file + "_pb.rb", + &expected_output, true)); EXPECT_EQ(expected_output, output); } diff --git a/src/google/protobuf/compiler/scc.h b/src/google/protobuf/compiler/scc.h index b9768bca369e..df5bb4a5e2b7 100644 --- a/src/google/protobuf/compiler/scc.h +++ b/src/google/protobuf/compiler/scc.h @@ -33,9 +33,9 @@ #include -#include "google/protobuf/stubs/logging.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" #include "absl/memory/memory.h" #include "google/protobuf/descriptor.h" @@ -99,7 +99,7 @@ class PROTOC_EXPORT SCCAnalyzer { // Mark visited by inserting in map. auto ins = cache_.try_emplace(descriptor, absl::make_unique()); // Must not have visited already. - GOOGLE_DCHECK(ins.second); + GOOGLE_ABSL_DCHECK(ins.second); NodeData& result = *ins.first->second; // Initialize data structures. result.index = result.lowlink = index_++; @@ -107,7 +107,7 @@ class PROTOC_EXPORT SCCAnalyzer { // Recurse the fields / nodes in graph for (const auto* dep : DepsGenerator()(descriptor)) { - GOOGLE_CHECK(dep); + GOOGLE_ABSL_CHECK(dep); auto it = cache_.find(dep); if (it == cache_.end()) { // unexplored node @@ -150,7 +150,7 @@ class PROTOC_EXPORT SCCAnalyzer { absl::flat_hash_set seen; for (auto descriptor : scc->descriptors) { for (auto child_msg : DepsGenerator()(descriptor)) { - GOOGLE_CHECK(child_msg); + GOOGLE_ABSL_CHECK(child_msg); const SCC* child = GetSCC(child_msg); if (child == scc) continue; if (seen.insert(child).second) { diff --git a/src/google/protobuf/compiler/subprocess.cc b/src/google/protobuf/compiler/subprocess.cc index 7b48c49fcbf8..12f7849fdb7e 100644 --- a/src/google/protobuf/compiler/subprocess.cc +++ b/src/google/protobuf/compiler/subprocess.cc @@ -43,6 +43,7 @@ #include #endif +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/substitute.h" @@ -57,8 +58,8 @@ namespace compiler { static void CloseHandleOrDie(HANDLE handle) { if (!CloseHandle(handle)) { - GOOGLE_LOG(FATAL) << "CloseHandle: " - << Subprocess::Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "CloseHandle: " + << Subprocess::Win32ErrorMessage(GetLastError()); } } @@ -85,22 +86,22 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { HANDLE stdout_pipe_write; if (!CreatePipe(&stdin_pipe_read, &stdin_pipe_write, nullptr, 0)) { - GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); } if (!CreatePipe(&stdout_pipe_read, &stdout_pipe_write, nullptr, 0)) { - GOOGLE_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "CreatePipe: " << Win32ErrorMessage(GetLastError()); } // Make child side of the pipes inheritable. if (!SetHandleInformation(stdin_pipe_read, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { - GOOGLE_LOG(FATAL) << "SetHandleInformation: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "SetHandleInformation: " + << Win32ErrorMessage(GetLastError()); } if (!SetHandleInformation(stdout_pipe_write, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) { - GOOGLE_LOG(FATAL) << "SetHandleInformation: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "SetHandleInformation: " + << Win32ErrorMessage(GetLastError()); } // Setup STARTUPINFO to redirect handles. @@ -113,13 +114,13 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { startup_info.hStdError = GetStdHandle(STD_ERROR_HANDLE); if (startup_info.hStdError == INVALID_HANDLE_VALUE) { - GOOGLE_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "GetStdHandle: " << Win32ErrorMessage(GetLastError()); } // get wide string version of program as the path may contain non-ascii characters std::wstring wprogram; if (!io::win32::strings::utf8_to_wcs(program.c_str(), &wprogram)) { - GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); } // Invoking cmd.exe allows for '.bat' files from the path as well as '.exe'. @@ -128,7 +129,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { // get wide string version of command line as the path may contain non-ascii characters std::wstring wcommand_line; if (!io::win32::strings::utf8_to_wcs(command_line.c_str(), &wcommand_line)) { - GOOGLE_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "utf8_to_wcs: " << Win32ErrorMessage(GetLastError()); } // Using a malloc'ed string because CreateProcess() can mutate its second @@ -169,7 +170,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, return false; } - GOOGLE_CHECK(child_handle_ != nullptr) << "Must call Start() first."; + GOOGLE_ABSL_CHECK(child_handle_ != nullptr) << "Must call Start() first."; std::string input_data; if (!input.SerializeToString(&input_data)) { @@ -199,11 +200,11 @@ bool Subprocess::Communicate(const Message& input, Message* output, wait_result < WAIT_OBJECT_0 + handle_count) { signaled_handle = handles[wait_result - WAIT_OBJECT_0]; } else if (wait_result == WAIT_FAILED) { - GOOGLE_LOG(FATAL) << "WaitForMultipleObjects: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "WaitForMultipleObjects: " + << Win32ErrorMessage(GetLastError()); } else { - GOOGLE_LOG(FATAL) << "WaitForMultipleObjects: Unexpected return code: " - << wait_result; + GOOGLE_ABSL_LOG(FATAL) << "WaitForMultipleObjects: Unexpected return code: " + << wait_result; } if (signaled_handle == child_stdin_) { @@ -246,17 +247,17 @@ bool Subprocess::Communicate(const Message& input, Message* output, DWORD wait_result = WaitForSingleObject(child_handle_, INFINITE); if (wait_result == WAIT_FAILED) { - GOOGLE_LOG(FATAL) << "WaitForSingleObject: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "WaitForSingleObject: " + << Win32ErrorMessage(GetLastError()); } else if (wait_result != WAIT_OBJECT_0) { - GOOGLE_LOG(FATAL) << "WaitForSingleObject: Unexpected return code: " - << wait_result; + GOOGLE_ABSL_LOG(FATAL) << "WaitForSingleObject: Unexpected return code: " + << wait_result; } DWORD exit_code; if (!GetExitCodeProcess(child_handle_, &exit_code)) { - GOOGLE_LOG(FATAL) << "GetExitCodeProcess: " - << Win32ErrorMessage(GetLastError()); + GOOGLE_ABSL_LOG(FATAL) << "GetExitCodeProcess: " + << Win32ErrorMessage(GetLastError()); } CloseHandleOrDie(child_handle_); @@ -325,14 +326,14 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { int stdin_pipe[2]; int stdout_pipe[2]; - GOOGLE_CHECK(pipe(stdin_pipe) != -1); - GOOGLE_CHECK(pipe(stdout_pipe) != -1); + GOOGLE_ABSL_CHECK(pipe(stdin_pipe) != -1); + GOOGLE_ABSL_CHECK(pipe(stdout_pipe) != -1); char* argv[2] = {portable_strdup(program.c_str()), nullptr}; child_pid_ = fork(); if (child_pid_ == -1) { - GOOGLE_LOG(FATAL) << "fork: " << strerror(errno); + GOOGLE_ABSL_LOG(FATAL) << "fork: " << strerror(errno); } else if (child_pid_ == 0) { // We are the child. dup2(stdin_pipe[0], STDIN_FILENO); @@ -379,7 +380,7 @@ void Subprocess::Start(const std::string& program, SearchMode search_mode) { bool Subprocess::Communicate(const Message& input, Message* output, std::string* error) { - GOOGLE_CHECK_NE(child_stdin_, -1) << "Must call Start() first."; + GOOGLE_ABSL_CHECK_NE(child_stdin_, -1) << "Must call Start() first."; // The "sighandler_t" typedef is GNU-specific, so define our own. typedef void SignalHandler(int); @@ -414,7 +415,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, // Interrupted by signal. Try again. continue; } else { - GOOGLE_LOG(FATAL) << "select: " << strerror(errno); + GOOGLE_ABSL_LOG(FATAL) << "select: " << strerror(errno); } } @@ -460,7 +461,7 @@ bool Subprocess::Communicate(const Message& input, Message* output, int status; while (waitpid(child_pid_, &status, 0) == -1) { if (errno != EINTR) { - GOOGLE_LOG(FATAL) << "waitpid: " << strerror(errno); + GOOGLE_ABSL_LOG(FATAL) << "waitpid: " << strerror(errno); } } From 2e0145b2402d033a3d90a4341baa4e2905a53b8e Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 12 Dec 2022 17:34:47 -0800 Subject: [PATCH 08/43] Internal changes PiperOrigin-RevId: 494875036 --- .../protobuf/compiler/python/generator.cc | 18 ++++++----- .../protobuf/compiler/python/helpers.cc | 1 + .../compiler/python/plugin_unittest.cc | 31 ++++++++++--------- .../protobuf/compiler/python/pyi_generator.cc | 6 ++-- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/google/protobuf/compiler/python/generator.cc b/src/google/protobuf/compiler/python/generator.cc index 151f81c95c7d..91f17626ebb6 100644 --- a/src/google/protobuf/compiler/python/generator.cc +++ b/src/google/protobuf/compiler/python/generator.cc @@ -51,8 +51,9 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "absl/container/flat_hash_map.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" @@ -167,7 +168,7 @@ std::string StringifyDefaultValue(const FieldDescriptor& field) { } // (We could add a default case above but then we wouldn't get the nice // compiler warning when a new type is added.) - GOOGLE_LOG(FATAL) << "Not reached."; + GOOGLE_ABSL_LOG(FATAL) << "Not reached."; return ""; } @@ -179,8 +180,9 @@ std::string StringifySyntax(FileDescriptor::Syntax syntax) { return "proto3"; case FileDescriptor::SYNTAX_UNKNOWN: default: - GOOGLE_LOG(FATAL) << "Unsupported syntax; this generator only supports proto2 " - "and proto3 syntax."; + GOOGLE_ABSL_LOG(FATAL) + << "Unsupported syntax; this generator only supports proto2 " + "and proto3 syntax."; return ""; } } @@ -290,7 +292,7 @@ bool Generator::Generate(const FileDescriptor* file, } std::unique_ptr output(context->Open(filename)); - GOOGLE_CHECK(output.get()); + GOOGLE_ABSL_CHECK(output.get()); io::Printer printer(output.get(), '$'); printer_ = &printer; @@ -947,7 +949,7 @@ std::string Generator::FieldReferencingExpression( const std::string& python_dict_name) const { // We should only ever be looking up fields in the current file. // The only things we refer to from other files are message descriptors. - GOOGLE_CHECK_EQ(field.file(), file_) + GOOGLE_ABSL_CHECK_EQ(field.file(), file_) << field.file()->name() << " vs. " << file_->name(); if (!containing_type) { return ResolveKeyword(field.name()); @@ -1013,7 +1015,7 @@ void Generator::FixForeignFieldsInExtensions() const { void Generator::FixForeignFieldsInExtension( const FieldDescriptor& extension_field) const { - GOOGLE_CHECK(extension_field.is_extension()); + GOOGLE_ABSL_CHECK(extension_field.is_extension()); absl::flat_hash_map m; // Confusingly, for FieldDescriptors that happen to be extensions, @@ -1228,7 +1230,7 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, std::string sp; proto.SerializeToString(&sp); int offset = file_descriptor_serialized_.find(sp); - GOOGLE_CHECK_GE(offset, 0); + GOOGLE_ABSL_CHECK_GE(offset, 0); printer_->Print( "_globals['$name$']._serialized_start=$serialized_start$\n" diff --git a/src/google/protobuf/compiler/python/helpers.cc b/src/google/protobuf/compiler/python/helpers.cc index e58ed9ccc815..2a129f1a7fd3 100644 --- a/src/google/protobuf/compiler/python/helpers.cc +++ b/src/google/protobuf/compiler/python/helpers.cc @@ -32,6 +32,7 @@ #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" #include "absl/strings/str_replace.h" diff --git a/src/google/protobuf/compiler/python/plugin_unittest.cc b/src/google/protobuf/compiler/python/plugin_unittest.cc index b613f2df7ef4..54cad05f8ce1 100644 --- a/src/google/protobuf/compiler/python/plugin_unittest.cc +++ b/src/google/protobuf/compiler/python/plugin_unittest.cc @@ -39,6 +39,7 @@ #include "google/protobuf/compiler/python/generator.h" #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/str_split.h" #include "google/protobuf/io/printer.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -78,19 +79,19 @@ class TestGenerator : public CodeGenerator { TEST(PythonPluginTest, ImportTest) { // Create files test1.proto and test2.proto with the former importing the // latter. - GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto", - "syntax = \"proto3\";\n" - "package foo;\n" - "import \"test2.proto\";" - "message Message1 {\n" - " Message2 message_2 = 1;\n" - "}\n", - true)); - GOOGLE_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto", - "syntax = \"proto3\";\n" - "package foo;\n" - "message Message2 {}\n", - true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test1.proto", + "syntax = \"proto3\";\n" + "package foo;\n" + "import \"test2.proto\";" + "message Message1 {\n" + " Message2 message_2 = 1;\n" + "}\n", + true)); + GOOGLE_ABSL_CHECK_OK(File::SetContents(TestTempDir() + "/test2.proto", + "syntax = \"proto3\";\n" + "package foo;\n" + "message Message2 {}\n", + true)); compiler::CommandLineInterface cli; cli.SetInputsAreProtoPathRelative(true); @@ -105,8 +106,8 @@ TEST(PythonPluginTest, ImportTest) { // Loop over the lines of the generated code and verify that we find an // ordinary Python import but do not find the string "importlib". std::string output; - GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output, - true)); + GOOGLE_ABSL_CHECK_OK(File::GetContents(TestTempDir() + "/test1_pb2.py", &output, + true)); std::vector lines = absl::StrSplit(output, "\n"); std::string expected_import = "import test2_pb2"; bool found_expected_import = false; diff --git a/src/google/protobuf/compiler/python/pyi_generator.cc b/src/google/protobuf/compiler/python/pyi_generator.cc index 607a05453485..a239a7840f28 100644 --- a/src/google/protobuf/compiler/python/pyi_generator.cc +++ b/src/google/protobuf/compiler/python/pyi_generator.cc @@ -34,6 +34,8 @@ #include #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "absl/strings/str_split.h" @@ -384,7 +386,7 @@ std::string PyiGenerator::GetFieldType( return name; } default: - GOOGLE_LOG(FATAL) << "Unsupported field type."; + GOOGLE_ABSL_LOG(FATAL) << "Unsupported field type."; } return ""; } @@ -599,7 +601,7 @@ bool PyiGenerator::Generate(const FileDescriptor* file, } std::unique_ptr output(context->Open(filename)); - GOOGLE_CHECK(output.get()); + GOOGLE_ABSL_CHECK(output.get()); GeneratedCodeInfo annotations; io::AnnotationProtoCollector annotation_collector( &annotations); From 5e2a4a73ed12d95c20fd8e339cf7d1aeb7007102 Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Mon, 12 Dec 2022 17:49:09 -0800 Subject: [PATCH 09/43] Unify alignment logic This change implements the existing 'Align*' logic in terms of `arena_align.h` enabling further cleanups and a long needed split of arena_impl.h into serial_arena.h and thread_safe_arena.h. The latter reduces the cost of adding new features or optimizations to arena. PiperOrigin-RevId: 494877304 --- src/google/protobuf/BUILD.bazel | 1 + src/google/protobuf/arena.h | 15 ++-- src/google/protobuf/arena_align.h | 106 +++++++++++++++++++----- src/google/protobuf/arena_align_test.cc | 22 +++++ src/google/protobuf/arena_impl.h | 55 ++++++------ 5 files changed, 140 insertions(+), 59 deletions(-) diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 48a8115ad78a..4902ce2d70f7 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -253,6 +253,7 @@ cc_library( "//src/google/protobuf:__subpackages__", ], deps = [ + ":arena_align", ":arena_allocation_policy", ":arena_cleanup", ":arena_config", diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 29c5a106f528..b60b7d0fc901 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -49,6 +49,7 @@ using type_info = ::type_info; #endif #include +#include "google/protobuf/arena_align.h" #include "google/protobuf/arena_config.h" #include "google/protobuf/arena_impl.h" #include "google/protobuf/port.h" @@ -291,15 +292,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { // Allocates memory with the specific size and alignment. void* AllocateAligned(size_t size, size_t align = 8) { - if (align <= 8) { - return Allocate(internal::AlignUpTo8(size)); + if (align <= internal::ArenaAlignDefault::align) { + return Allocate(internal::ArenaAlignDefault::Ceil(size)); } else { // We are wasting space by over allocating align - 8 bytes. Compared // to a dedicated function that takes current alignment in consideration. // Such a scheme would only waste (align - 8)/2 bytes on average, but // requires a dedicated function in the outline arena allocation // functions. Possibly re-evaluate tradeoffs later. - return internal::AlignTo(Allocate(size + align - 8), align); + auto align_as = internal::ArenaAlignAs(align); + return align_as.Ceil(Allocate(align_as.Padded(size))); } } @@ -662,15 +664,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { } void* AllocateAlignedForArray(size_t n, size_t align) { - if (align <= 8) { - return AllocateForArray(internal::AlignUpTo8(n)); + if (align <= internal::ArenaAlignDefault::align) { + return AllocateForArray(internal::ArenaAlignDefault::Ceil(n)); } else { // We are wasting space by over allocating align - 8 bytes. Compared // to a dedicated function that takes current alignment in consideration. // Such a scheme would only waste (align - 8)/2 bytes on average, but // requires a dedicated function in the outline arena allocation // functions. Possibly re-evaluate tradeoffs later. - return internal::AlignTo(AllocateForArray(n + align - 8), align); + auto align_as = internal::ArenaAlignAs(align); + return align_as.Ceil(AllocateForArray(align_as.Padded(n))); } } diff --git a/src/google/protobuf/arena_align.h b/src/google/protobuf/arena_align.h index 8881a93a7120..573caf3a9637 100644 --- a/src/google/protobuf/arena_align.h +++ b/src/google/protobuf/arena_align.h @@ -35,14 +35,21 @@ // // Ceil(size_t n) - rounds `n` up to the nearest `align` boundary. // Floor(size_t n) - rounds `n` down to the nearest `align` boundary. -// Ceil(T* P) - rounds `p` up to the nearest `align` boundary. +// Padded(size_t n) - returns the unaligned size to align 'n' bytes. (1) + +// Ceil(T* P) - rounds `p` up to the nearest `align` boundary. (2) // IsAligned(size_t n) - returns true if `n` is aligned to `align` // IsAligned(T* p) - returns true if `p` is aligned to `align` // CheckAligned(T* p) - returns `p`. Checks alignment of `p` in debug. // -// Additionally there is an optimized `CeilDefaultAligned(T*)` method which is -// equivalent to `Ceil(ArenaAlignDefault().CheckAlign(p))` but more efficiently -// implemented as a 'check only' for ArenaAlignDefault. +// 1) `Padded(n)` returns the minimum size needed to align an object of size 'n' +// into a memory area that is default aligned. For example, allocating 'n' +// bytes aligned at 32 bytes requires a size of 'n + 32 - 8' to align at 32 +// bytes for any 8 byte boundary. +// +// 2) There is an optimized `CeilDefaultAligned(T*)` method which is equivalent +// to `Ceil(ArenaAlignDefault::CheckAlign(p))` but more efficiently +// implemented as a 'check only' for ArenaAlignDefault. // // These classes allow for generic arena logic using 'alignment policies'. // @@ -50,10 +57,14 @@ // // template // void* NaiveAlloc(size_t n, Align align) { -// align.CheckAligned(n); -// uint8_t* ptr = align.CeilDefaultAligned(ptr_); -// ptr_ += n; -// return ptr; +// ABSL_ASSERT(align.IsAligned(n)); +// const size_t required = align.Padded(n); +// if (required <= static_cast(ptr_ - limit_)) { +// uint8_t* ptr = align.CeilDefaultAligned(ptr_); +// ptr_ = ptr + n; +// return ptr; +// } +// return nullptr; // } // // void CallSites() { @@ -80,31 +91,41 @@ namespace internal { struct ArenaAlignDefault { PROTOBUF_EXPORT static constexpr size_t align = 8; // NOLINT - static constexpr bool IsAligned(size_t n) { return (n & (align - 1)) == 0; } + static constexpr bool IsAligned(size_t n) { return (n & (align - 1)) == 0U; } template - static bool IsAligned(T* ptr) { - return (reinterpret_cast(ptr) & (align - 1)) == 0; + static inline PROTOBUF_ALWAYS_INLINE bool IsAligned(T* ptr) { + return (reinterpret_cast(ptr) & (align - 1)) == 0U; + } + + static inline PROTOBUF_ALWAYS_INLINE constexpr size_t Ceil(size_t n) { + return (n + align - 1) & -align; + } + static inline PROTOBUF_ALWAYS_INLINE constexpr size_t Floor(size_t n) { + return (n & ~(align - 1)); } - static constexpr size_t Ceil(size_t n) { return (n + align - 1) & -align; } - static constexpr size_t Floor(size_t n) { return (n & ~(align - 1)); } + static inline PROTOBUF_ALWAYS_INLINE size_t Padded(size_t n) { + ABSL_ASSERT(IsAligned(n)); + return n; + } template - T* Ceil(T* ptr) const { + static inline PROTOBUF_ALWAYS_INLINE T* Ceil(T* ptr) { uintptr_t intptr = reinterpret_cast(ptr); return reinterpret_cast((intptr + align - 1) & -align); } template - T* CeilDefaultAligned(T* ptr) const { - return ArenaAlignDefault().CheckAligned(ptr); + static inline PROTOBUF_ALWAYS_INLINE T* CeilDefaultAligned(T* ptr) { + ABSL_ASSERT(IsAligned(ptr)); + return ptr; } // Address sanitizer enabled alignment check template - static T* CheckAligned(T* ptr) { - GOOGLE_ABSL_DCHECK(IsAligned(ptr)) << static_cast(ptr); + static inline PROTOBUF_ALWAYS_INLINE T* CheckAligned(T* ptr) { + ABSL_ASSERT(IsAligned(ptr)); return ptr; } }; @@ -114,16 +135,24 @@ struct ArenaAlign { size_t align; - constexpr bool IsAligned(size_t n) const { return (n & (align - 1)) == 0; } + constexpr bool IsAligned(size_t n) const { return (n & (align - 1)) == 0U; } template bool IsAligned(T* ptr) const { - return (reinterpret_cast(ptr) & (align - 1)) == 0; + return (reinterpret_cast(ptr) & (align - 1)) == 0U; } constexpr size_t Ceil(size_t n) const { return (n + align - 1) & -align; } constexpr size_t Floor(size_t n) const { return (n & ~(align - 1)); } + constexpr size_t Padded(size_t n) const { + // TODO(mvels): there are direct callers of AllocateAligned() that violate + // `size` being a multiple of `align`: that should be an error / assert. + // ABSL_ASSERT(IsAligned(n)); + ABSL_ASSERT(ArenaAlignDefault::IsAligned(align)); + return n + align - ArenaAlignDefault::align; + } + template T* Ceil(T* ptr) const { uintptr_t intptr = reinterpret_cast(ptr); @@ -132,24 +161,55 @@ struct ArenaAlign { template T* CeilDefaultAligned(T* ptr) const { - return Ceil(ArenaAlignDefault().CheckAligned(ptr)); + ABSL_ASSERT(ArenaAlignDefault::IsAligned(ptr)); + return Ceil(ptr); } // Address sanitizer enabled alignment check template T* CheckAligned(T* ptr) const { - GOOGLE_ABSL_DCHECK(IsAligned(ptr)) << static_cast(ptr); + ABSL_ASSERT(IsAligned(ptr)); return ptr; } }; inline ArenaAlign ArenaAlignAs(size_t align) { // align must be a non zero power of 2 >= 8 - GOOGLE_ABSL_DCHECK_NE(align, 0); + GOOGLE_ABSL_DCHECK_NE(align, 0U); GOOGLE_ABSL_DCHECK(absl::has_single_bit(align)) << "Invalid alignment " << align; return ArenaAlign{align}; } +template +struct AlignFactory { + static_assert(align > ArenaAlignDefault::align, "Not over-aligned"); + static_assert((align & (align - 1)) == 0U, "Not power of 2"); + static constexpr ArenaAlign Create() { return ArenaAlign{align}; } +}; + +template +struct AlignFactory { + static_assert(align <= ArenaAlignDefault::align, "Over-aligned"); + static_assert((align & (align - 1)) == 0U, "Not power of 2"); + static constexpr ArenaAlignDefault Create() { return ArenaAlignDefault{}; } +}; + +// Returns an `ArenaAlignDefault` instance for `align` less than or equal to the +// default alignment, and `AlignAs(align)` for over-aligned values of `align`. +// The purpose is to take advantage of invoking functions accepting a template +// overloaded 'Align align` argument reducing the alignment operations on +// `ArenaAlignDefault` implementations to no-ops. +template +inline constexpr auto ArenaAlignAs() { + return AlignFactory::Create(); +} + +// Returns ArenaAlignAs +template +inline constexpr auto ArenaAlignOf() { + return ArenaAlignAs(); +} + } // namespace internal } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/arena_align_test.cc b/src/google/protobuf/arena_align_test.cc index e17cb33209a4..f594e2236b8c 100644 --- a/src/google/protobuf/arena_align_test.cc +++ b/src/google/protobuf/arena_align_test.cc @@ -67,6 +67,16 @@ TEST(ArenaAlignDefault, Ceil) { EXPECT_THAT(align_default.Ceil(16), Eq(16)); } +TEST(ArenaAlignDefault, Padded) { + auto align_default = ArenaAlignDefault(); + EXPECT_THAT(align_default.Padded(0), Eq(0)); + EXPECT_THAT(align_default.Padded(8), Eq(8)); + EXPECT_THAT(align_default.Padded(64), Eq(64)); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH(align_default.Padded(1), ".*"); +#endif // PROTOBUF_HAS_DEATH_TEST +} + TEST(ArenaAlignDefault, CeilPtr) { alignas(8) char p[17] = {0}; auto align_default = ArenaAlignDefault(); @@ -147,6 +157,18 @@ TEST(ArenaAlign, Ceil) { EXPECT_THAT(align_64.Ceil(128), Eq(128)); } +TEST(ArenaAlign, Padded) { + auto align_64 = ArenaAlignAs(64); + EXPECT_THAT(align_64.Padded(64), Eq(64 + 64 - ArenaAlignDefault::align)); + EXPECT_THAT(align_64.Padded(128), Eq(128 + 64 - ArenaAlignDefault::align)); +#ifdef PROTOBUF_HAS_DEATH_TEST + // TODO(mvels): there are direct callers of AllocateAligned() that violate + // `size` being a multiple of `align`: that should be an error / assert. + // EXPECT_DEBUG_DEATH(align_64.Padded(16), ".*"); + EXPECT_DEBUG_DEATH(ArenaAlignAs(2).Padded(8), ".*"); +#endif // PROTOBUF_HAS_DEATH_TEST +} + TEST(ArenaAlign, CeilPtr) { alignas(64) char p[129] = {0}; auto align_64 = ArenaAlignAs(64); diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/arena_impl.h index 043f21f67fdf..0d39c19c889e 100644 --- a/src/google/protobuf/arena_impl.h +++ b/src/google/protobuf/arena_impl.h @@ -41,10 +41,11 @@ #include #include "google/protobuf/stubs/common.h" -#include "absl/base/attributes.h" #include "google/protobuf/stubs/logging.h" #include "absl/numeric/bits.h" +#include "absl/strings/cord.h" #include "absl/synchronization/mutex.h" +#include "google/protobuf/arena_align.h" #include "google/protobuf/arena_allocation_policy.h" #include "google/protobuf/arena_cleanup.h" #include "google/protobuf/arena_config.h" @@ -59,29 +60,6 @@ namespace google { namespace protobuf { namespace internal { -inline PROTOBUF_ALWAYS_INLINE constexpr size_t AlignUpTo8(size_t n) { - // Align n to next multiple of 8 (from Hacker's Delight, Chapter 3.) - return (n + 7) & static_cast(-8); -} - -inline PROTOBUF_ALWAYS_INLINE constexpr size_t AlignUpTo(size_t n, size_t a) { - // We are wasting space by over allocating align - 8 bytes. Compared to a - // dedicated function that takes current alignment in consideration. Such a - // scheme would only waste (align - 8)/2 bytes on average, but requires a - // dedicated function in the outline arena allocation functions. Possibly - // re-evaluate tradeoffs later. - return a <= 8 ? AlignUpTo8(n) : n + a - 8; -} - -inline PROTOBUF_ALWAYS_INLINE void* AlignTo(void* p, size_t a) { - if (a <= 8) { - return p; - } else { - auto u = reinterpret_cast(p); - return reinterpret_cast((u + a - 1) & (~a + 1)); - } -} - // Arena blocks are variable length malloc-ed objects. The following structure // describes the common header for all blocks. struct ArenaBlock { @@ -172,7 +150,7 @@ class PROTOBUF_EXPORT SerialArena { // from it. template void* AllocateAligned(size_t n) { - GOOGLE_ABSL_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + GOOGLE_ABSL_DCHECK(internal::ArenaAlignDefault::IsAligned(n)); GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); if (alloc_client == AllocationClient::kArray) { @@ -188,6 +166,22 @@ class PROTOBUF_EXPORT SerialArena { } private: + static inline PROTOBUF_ALWAYS_INLINE constexpr size_t AlignUpTo(size_t n, + size_t a) { + // We are wasting space by over allocating align - 8 bytes. Compared to a + // dedicated function that takes current alignment in consideration. Such a + // scheme would only waste (align - 8)/2 bytes on average, but requires a + // dedicated function in the outline arena allocation functions. Possibly + // re-evaluate tradeoffs later. + return a <= 8 ? ArenaAlignDefault::Ceil(n) : ArenaAlignAs(a).Padded(n); + } + + static inline PROTOBUF_ALWAYS_INLINE void* AlignTo(void* p, size_t a) { + return (a <= ArenaAlignDefault::align) + ? ArenaAlignDefault::CeilDefaultAligned(p) + : ArenaAlignAs(a).CeilDefaultAligned(p); + } + void* AllocateFromExisting(size_t n) { PROTOBUF_UNPOISON_MEMORY_REGION(ptr(), n); void* ret = ptr(); @@ -248,7 +242,7 @@ class PROTOBUF_EXPORT SerialArena { public: // Allocate space if the current region provides enough space. bool MaybeAllocateAligned(size_t n, void** out) { - GOOGLE_ABSL_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. + GOOGLE_ABSL_DCHECK(internal::ArenaAlignDefault::IsAligned(n)); GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; *out = AllocateFromExisting(n); @@ -264,7 +258,7 @@ class PROTOBUF_EXPORT SerialArena { static_assert(!std::is_trivially_destructible::value, "This function is only for non-trivial types."); - constexpr int aligned_size = AlignUpTo8(sizeof(T)); + constexpr int aligned_size = ArenaAlignDefault::Ceil(sizeof(T)); constexpr auto destructor = cleanup::arena_destruct_object; size_t required = aligned_size + cleanup::Size(destructor); if (PROTOBUF_PREDICT_FALSE(!HasSpace(required))) { @@ -300,7 +294,7 @@ class PROTOBUF_EXPORT SerialArena { void (*destructor)(void*)) { n = AlignUpTo(n, align); PROTOBUF_UNPOISON_MEMORY_REGION(ptr(), n); - void* ret = internal::AlignTo(ptr(), align); + void* ret = ArenaAlignAs(align).CeilDefaultAligned(ptr()); set_ptr(ptr() + n); GOOGLE_ABSL_DCHECK_GE(limit_, ptr()); AddCleanupFromExisting(ret, destructor); @@ -384,7 +378,8 @@ class PROTOBUF_EXPORT SerialArena { inline void Init(ArenaBlock* b, size_t offset); public: - static constexpr size_t kBlockHeaderSize = AlignUpTo8(sizeof(ArenaBlock)); + static constexpr size_t kBlockHeaderSize = + ArenaAlignDefault::Ceil(sizeof(ArenaBlock)); }; // This class provides the core Arena memory allocation library. Different @@ -603,7 +598,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { static constexpr size_t kSerialArenaSize = (sizeof(SerialArena) + 7) & static_cast(-8); static constexpr size_t kAllocPolicySize = - AlignUpTo8(sizeof(AllocationPolicy)); + ArenaAlignDefault::Ceil(sizeof(AllocationPolicy)); static constexpr size_t kMaxCleanupNodeSize = 16; static_assert(kBlockHeaderSize % 8 == 0, "kBlockHeaderSize must be a multiple of 8."); From ddde013bd899702a1e78dd9e31a3e703bbb173b7 Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Mon, 12 Dec 2022 18:40:32 -0800 Subject: [PATCH 10/43] Add Cord based Parse and Serialize logic to MessageLite PiperOrigin-RevId: 494887062 --- src/google/protobuf/lite_unittest.cc | 363 ++++++++++++++------------- src/google/protobuf/message_lite.cc | 115 +++++++++ src/google/protobuf/message_lite.h | 31 +++ 3 files changed, 334 insertions(+), 175 deletions(-) diff --git a/src/google/protobuf/lite_unittest.cc b/src/google/protobuf/lite_unittest.cc index 75f5446bccd0..c4a1f15ce225 100644 --- a/src/google/protobuf/lite_unittest.cc +++ b/src/google/protobuf/lite_unittest.cc @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -56,6 +57,7 @@ namespace google { namespace protobuf { +namespace { // Helper methods to test parsing merge behavior. void ExpectMessageMerged(const unittest::TestAllTypesLite& message) { @@ -73,13 +75,39 @@ void AssignParsingMergeMessages(unittest::TestAllTypesLite* msg1, msg3->set_optional_string("hello"); } +// Declare and define the template `T SerializeAs()` function which we +// specialize for the typed tests serializing to a string or Cord. +template +T SerializeAs(const MessageLite& msg); + +template <> +std::string SerializeAs(const MessageLite& msg) { + return msg.SerializeAsString(); +} + +template <> +absl::Cord SerializeAs(const MessageLite& msg) { + return msg.SerializeAsCord(); +} + +// `ParseFrom()` is overloaded for string and Cord and used in the +// typed tests parsing from string and Cord values. +bool ParseFrom(const std::string& data, MessageLite& msg) { + return msg.ParseFromString(data); +} + +bool ParseFrom(const absl::Cord& data, MessageLite& msg) { + return msg.ParseFromCord(data); +} + +template void SetAllTypesInEmptyMessageUnknownFields( unittest::TestEmptyMessageLite* empty_message) { protobuf_unittest::TestAllTypesLite message; TestUtilLite::ExpectClear(message); TestUtilLite::SetAllFields(&message); - std::string data = message.SerializeAsString(); - empty_message->ParseFromString(data); + T data = SerializeAs(message); + ParseFrom(data, *empty_message); } void SetSomeTypesInEmptyMessageUnknownFields( @@ -149,16 +177,27 @@ TEST(ParseVarintTest, Varint64) { test_value(std::numeric_limits::max(), 10); } -TEST(Lite, AllLite1) { - std::string data; +template +class LiteTest : public ::testing::Test {}; + +struct TypedTestName { + template + static std::string GetName(int /*i*/) { + return std::is_same::value ? "Cord" : "String"; + } +}; + +using SerializedDataTypes = ::testing::Types; +TYPED_TEST_SUITE(LiteTest, SerializedDataTypes, TypedTestName); +TYPED_TEST(LiteTest, AllLite1) { { protobuf_unittest::TestAllTypesLite message, message2, message3; TestUtilLite::ExpectClear(message); TestUtilLite::SetAllFields(&message); - message2.CopyFrom(message); - data = message.SerializeAsString(); - message3.ParseFromString(data); + message2 = message; + TypeParam data = SerializeAs(message2); + ParseFrom(data, message3); TestUtilLite::ExpectAllFieldsSet(message); TestUtilLite::ExpectAllFieldsSet(message2); TestUtilLite::ExpectAllFieldsSet(message3); @@ -169,15 +208,14 @@ TEST(Lite, AllLite1) { } } -TEST(Lite, AllLite2) { - std::string data; +TYPED_TEST(LiteTest, AllLite2) { { protobuf_unittest::TestAllExtensionsLite message, message2, message3; TestUtilLite::ExpectExtensionsClear(message); TestUtilLite::SetAllExtensions(&message); - message2.CopyFrom(message); - std::string extensions_data = message.SerializeAsString(); - message3.ParseFromString(extensions_data); + message2 = message; + TypeParam extensions_data = SerializeAs(message); + ParseFrom(extensions_data, message3); TestUtilLite::ExpectAllExtensionsSet(message); TestUtilLite::ExpectAllExtensionsSet(message2); TestUtilLite::ExpectAllExtensionsSet(message3); @@ -188,16 +226,16 @@ TEST(Lite, AllLite2) { } } -TEST(Lite, AllLite3) { - std::string data, packed_data; +TYPED_TEST(LiteTest, AllLite3) { + TypeParam data, packed_data; { protobuf_unittest::TestPackedTypesLite message, message2, message3; TestUtilLite::ExpectPackedClear(message); TestUtilLite::SetPackedFields(&message); - message2.CopyFrom(message); - packed_data = message.SerializeAsString(); - message3.ParseFromString(packed_data); + message2 = message; + packed_data = SerializeAs(message); + ParseFrom(packed_data, message3); TestUtilLite::ExpectPackedFieldsSet(message); TestUtilLite::ExpectPackedFieldsSet(message2); TestUtilLite::ExpectPackedFieldsSet(message3); @@ -211,10 +249,10 @@ TEST(Lite, AllLite3) { protobuf_unittest::TestPackedExtensionsLite message, message2, message3; TestUtilLite::ExpectPackedExtensionsClear(message); TestUtilLite::SetPackedExtensions(&message); - message2.CopyFrom(message); - std::string packed_extensions_data = message.SerializeAsString(); + message2 = message; + TypeParam packed_extensions_data = SerializeAs(message); EXPECT_EQ(packed_extensions_data, packed_data); - message3.ParseFromString(packed_extensions_data); + ParseFrom(packed_extensions_data, message3); TestUtilLite::ExpectPackedExtensionsSet(message); TestUtilLite::ExpectPackedExtensionsSet(message2); TestUtilLite::ExpectPackedExtensionsSet(message3); @@ -225,8 +263,8 @@ TEST(Lite, AllLite3) { } } -TEST(Lite, AllLite5) { - std::string data; +TYPED_TEST(LiteTest, AllLite5) { + TypeParam data; { // Test that if an optional or required message/group field appears multiple @@ -260,10 +298,11 @@ TEST(Lite, AllLite5) { #undef ASSIGN_REPEATED_GROUP - std::string buffer; - generator.SerializeToString(&buffer); + TypeParam buffer; + buffer = SerializeAs(generator); + // generator.SerializeToString(&buffer); unittest::TestParsingMergeLite parsing_merge; - parsing_merge.ParseFromString(buffer); + ParseFrom(buffer, parsing_merge); // Required and optional fields should be merged. ExpectMessageMerged(parsing_merge.required_all_types()); @@ -282,8 +321,8 @@ TEST(Lite, AllLite5) { } } -TEST(Lite, AllLite6) { - std::string data; +TYPED_TEST(LiteTest, AllLite6) { + TypeParam data; // Test unknown fields support for lite messages. { @@ -291,51 +330,48 @@ TEST(Lite, AllLite6) { protobuf_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectClear(message); TestUtilLite::SetAllFields(&message); - data = message.SerializeAsString(); - ASSERT_TRUE(empty_message.ParseFromString(data)); - data.clear(); - data = empty_message.SerializeAsString(); - EXPECT_TRUE(message2.ParseFromString(data)); - data = message2.SerializeAsString(); + data = SerializeAs(message); + ASSERT_TRUE(ParseFrom(data, empty_message)); + data = SerializeAs(empty_message); + EXPECT_TRUE(ParseFrom(data, message2)); + data = SerializeAs(message2); TestUtilLite::ExpectAllFieldsSet(message2); message.Clear(); TestUtilLite::ExpectClear(message); } } -TEST(Lite, AllLite7) { - std::string data; +TYPED_TEST(LiteTest, AllLite7) { + TypeParam data; { protobuf_unittest::TestAllExtensionsLite message, message2; protobuf_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectExtensionsClear(message); TestUtilLite::SetAllExtensions(&message); - data = message.SerializeAsString(); - empty_message.ParseFromString(data); - data.clear(); + data = SerializeAs(message); + ParseFrom(data, empty_message); data = empty_message.SerializeAsString(); - message2.ParseFromString(data); - data = message2.SerializeAsString(); + ParseFrom(data, message2); + data = SerializeAs(message2); TestUtilLite::ExpectAllExtensionsSet(message2); message.Clear(); TestUtilLite::ExpectExtensionsClear(message); } } -TEST(Lite, AllLite8) { - std::string data; +TYPED_TEST(LiteTest, AllLite8) { + TypeParam data; { protobuf_unittest::TestPackedTypesLite message, message2; protobuf_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectPackedClear(message); TestUtilLite::SetPackedFields(&message); - data = message.SerializeAsString(); - empty_message.ParseFromString(data); - data.clear(); - data = empty_message.SerializeAsString(); - message2.ParseFromString(data); + data = SerializeAs(message); + ParseFrom(data, empty_message); + data = SerializeAs(empty_message); + ParseFrom(data, message2); data = message2.SerializeAsString(); TestUtilLite::ExpectPackedFieldsSet(message2); message.Clear(); @@ -343,57 +379,56 @@ TEST(Lite, AllLite8) { } } -TEST(Lite, AllLite9) { - std::string data; +TYPED_TEST(LiteTest, AllLite9) { + TypeParam data; { protobuf_unittest::TestPackedExtensionsLite message, message2; protobuf_unittest::TestEmptyMessageLite empty_message; TestUtilLite::ExpectPackedExtensionsClear(message); TestUtilLite::SetPackedExtensions(&message); - data = message.SerializeAsString(); - empty_message.ParseFromString(data); - data.clear(); - data = empty_message.SerializeAsString(); - message2.ParseFromString(data); - data = message2.SerializeAsString(); + data = SerializeAs(message); + ParseFrom(data, empty_message); + data = SerializeAs(empty_message); + ParseFrom(data, message2); + data = SerializeAs(message2); TestUtilLite::ExpectPackedExtensionsSet(message2); message.Clear(); TestUtilLite::ExpectPackedExtensionsClear(message); } } -TEST(Lite, AllLite10) { - std::string data; +TYPED_TEST(LiteTest, AllLite10) { + TypeParam data; { // Test Unknown fields swap protobuf_unittest::TestEmptyMessageLite empty_message, empty_message2; - SetAllTypesInEmptyMessageUnknownFields(&empty_message); + SetAllTypesInEmptyMessageUnknownFields(&empty_message); SetSomeTypesInEmptyMessageUnknownFields(&empty_message2); - data = empty_message.SerializeAsString(); - std::string data2 = empty_message2.SerializeAsString(); + data = SerializeAs(empty_message); + auto data2 = SerializeAs(empty_message2); empty_message.Swap(&empty_message2); - EXPECT_EQ(data, empty_message2.SerializeAsString()); - EXPECT_EQ(data2, empty_message.SerializeAsString()); + EXPECT_EQ(data, SerializeAs(empty_message2)); + EXPECT_EQ(data2, SerializeAs(empty_message)); } } -TEST(Lite, AllLite11) { - std::string data; +TYPED_TEST(LiteTest, AllLite11) { + TypeParam data; { // Test unknown fields swap with self protobuf_unittest::TestEmptyMessageLite empty_message; - SetAllTypesInEmptyMessageUnknownFields(&empty_message); - data = empty_message.SerializeAsString(); + SetAllTypesInEmptyMessageUnknownFields(&empty_message); + data = SerializeAs(empty_message); empty_message.Swap(&empty_message); EXPECT_EQ(data, empty_message.SerializeAsString()); } } -TEST(Lite, AllLite12) { - std::string data; +TYPED_TEST(LiteTest, AllLite12) { + TypeParam data; { // Test MergeFrom with unknown fields @@ -406,24 +441,25 @@ TEST(Lite, AllLite12) { message2.add_repeated_int64(202); message2.set_optional_foreign_enum(unittest::FOREIGN_LITE_BAZ); - data = message.SerializeAsString(); - empty_message.ParseFromString(data); + data = SerializeAs(message); + ParseFrom(data, empty_message); data = message2.SerializeAsString(); - empty_message2.ParseFromString(data); + ParseFrom(data, empty_message2); message.MergeFrom(message2); empty_message.MergeFrom(empty_message2); - data = empty_message.SerializeAsString(); - message2.ParseFromString(data); + data = SerializeAs(empty_message); + ParseFrom(data, message2); // We do not compare the serialized output of a normal message and a lite // message because the order of fields do not match. We convert lite message // back into normal message, then compare. - EXPECT_EQ(message.SerializeAsString(), message2.SerializeAsString()); + EXPECT_EQ(SerializeAs(message), + SerializeAs(message2)); } } -TEST(Lite, AllLite13) { - std::string data; +TYPED_TEST(LiteTest, AllLite13StringStream) { + TypeParam data; { // Test unknown enum value @@ -442,18 +478,41 @@ TEST(Lite, AllLite13) { coded_output.WriteVarint32(20); } message.ParseFromString(buffer); - data = message.SerializeAsString(); + data = SerializeAs(message); EXPECT_EQ(data, buffer); } } -TEST(Lite, AllLite14) { - std::string data; +TYPED_TEST(LiteTest, AllLite13CordStream) { + TypeParam data; + + { + // Test unknown enum value + protobuf_unittest::TestAllTypesLite message; + io::CordOutputStream output_stream; + { + io::CodedOutputStream coded_output(&output_stream); + internal::WireFormatLite::WriteTag( + protobuf_unittest::TestAllTypesLite::kOptionalNestedEnumFieldNumber, + internal::WireFormatLite::WIRETYPE_VARINT, &coded_output); + coded_output.WriteVarint32(10); + internal::WireFormatLite::WriteTag( + protobuf_unittest::TestAllTypesLite::kRepeatedNestedEnumFieldNumber, + internal::WireFormatLite::WIRETYPE_VARINT, &coded_output); + coded_output.WriteVarint32(20); + } + absl::Cord buffer = output_stream.Consume(); + message.ParseFromCord(buffer); + data = SerializeAs(message); + EXPECT_EQ(data, buffer); + } +} +TYPED_TEST(LiteTest, AllLite14) { { // Test Clear with unknown fields protobuf_unittest::TestEmptyMessageLite empty_message; - SetAllTypesInEmptyMessageUnknownFields(&empty_message); + SetAllTypesInEmptyMessageUnknownFields(&empty_message); empty_message.Clear(); EXPECT_EQ(0, empty_message.unknown_fields().size()); } @@ -461,9 +520,7 @@ TEST(Lite, AllLite14) { // Tests for map lite ============================================= -TEST(Lite, AllLite15) { - std::string data; - +TEST(LiteBasicTest, AllLite15) { { // Accessors protobuf_unittest::TestMapLite message; @@ -476,9 +533,7 @@ TEST(Lite, AllLite15) { } } -TEST(Lite, AllLite16) { - std::string data; - +TYPED_TEST(LiteTest, AllLite16) { { // SetMapFieldsInitialized protobuf_unittest::TestMapLite message; @@ -488,9 +543,7 @@ TEST(Lite, AllLite16) { } } -TEST(Lite, AllLite17) { - std::string data; - +TEST(LiteBasicTest, AllLite17) { { // Clear protobuf_unittest::TestMapLite message; @@ -501,9 +554,7 @@ TEST(Lite, AllLite17) { } } -TEST(Lite, AllLite18) { - std::string data; - +TEST(LiteBasicTest, AllLite18) { { // ClearMessageMap protobuf_unittest::TestMessageMapLite message; @@ -513,26 +564,22 @@ TEST(Lite, AllLite18) { } } -TEST(Lite, AllLite19) { - std::string data; - +TEST(LiteBasicTest, AllLite19) { { // CopyFrom protobuf_unittest::TestMapLite message1, message2; MapLiteTestUtil::SetMapFields(&message1); - message2.CopyFrom(message1); + message2.CopyFrom(message1); // NOLINT MapLiteTestUtil::ExpectMapFieldsSet(message2); // Copying from self should be a no-op. - message2.CopyFrom(message2); + message2.CopyFrom(message2); // NOLINT MapLiteTestUtil::ExpectMapFieldsSet(message2); } } -TEST(Lite, AllLite20) { - std::string data; - +TEST(LiteBasicTest, AllLite20) { { // CopyFromMessageMap protobuf_unittest::TestMessageMapLite message1, message2; @@ -540,7 +587,7 @@ TEST(Lite, AllLite20) { (*message1.mutable_map_int32_message())[0].add_repeated_int32(100); (*message2.mutable_map_int32_message())[0].add_repeated_int32(101); - message1.CopyFrom(message2); + message1.CopyFrom(message2); // NOLINT // Checks repeated field is overwritten. EXPECT_EQ(1, message1.map_int32_message().at(0).repeated_int32_size()); @@ -548,9 +595,7 @@ TEST(Lite, AllLite20) { } } -TEST(Lite, AllLite21) { - std::string data; - +TEST(LiteBasicTest, AllLite21) { { // SwapWithEmpty protobuf_unittest::TestMapLite message1, message2; @@ -565,9 +610,7 @@ TEST(Lite, AllLite21) { } } -TEST(Lite, AllLite22) { - std::string data; - +TEST(LiteBasicTest, AllLite22) { { // SwapWithSelf protobuf_unittest::TestMapLite message; @@ -580,9 +623,7 @@ TEST(Lite, AllLite22) { } } -TEST(Lite, AllLite23) { - std::string data; - +TEST(LiteBasicTest, AllLite23) { { // SwapWithOther protobuf_unittest::TestMapLite message1, message2; @@ -597,9 +638,7 @@ TEST(Lite, AllLite23) { } } -TEST(Lite, AllLite24) { - std::string data; - +TEST(LiteBasicTest, AllLite24) { { // CopyConstructor protobuf_unittest::TestMapLite message1; @@ -610,9 +649,7 @@ TEST(Lite, AllLite24) { } } -TEST(Lite, AllLite25) { - std::string data; - +TEST(LiteBasicTest, AllLite25) { { // CopyAssignmentOperator protobuf_unittest::TestMapLite message1; @@ -628,9 +665,7 @@ TEST(Lite, AllLite25) { } } -TEST(Lite, AllLite26) { - std::string data; - +TEST(LiteBasicTest, AllLite26) { { // NonEmptyMergeFrom protobuf_unittest::TestMapLite message1, message2; @@ -650,9 +685,7 @@ TEST(Lite, AllLite26) { } } -TEST(Lite, AllLite27) { - std::string data; - +TYPED_TEST(LiteTest, AllLite27) { { // MergeFromMessageMap protobuf_unittest::TestMessageMapLite message1, message2; @@ -668,9 +701,7 @@ TEST(Lite, AllLite27) { } } -TEST(Lite, AllLite28) { - std::string data; - +TEST(LiteStringTest, AllLite28) { { // Test the generated SerializeWithCachedSizesToArray() protobuf_unittest::TestMapLite message1, message2; @@ -686,9 +717,7 @@ TEST(Lite, AllLite28) { } } -TEST(Lite, AllLite29) { - std::string data; - +TEST(LiteStreamTest, AllLite29) { { // Test the generated SerializeWithCachedSizes() protobuf_unittest::TestMapLite message1, message2; @@ -710,9 +739,7 @@ TEST(Lite, AllLite29) { } -TEST(Lite, AllLite32) { - std::string data; - +TYPED_TEST(LiteTest, AllLite32) { { // Proto2UnknownEnum protobuf_unittest::TestEnumMapPlusExtraLite from; @@ -720,21 +747,20 @@ TEST(Lite, AllLite32) { protobuf_unittest::E_PROTO2_MAP_ENUM_FOO_LITE; (*from.mutable_unknown_map_field())[0] = protobuf_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE; - std::string data; - from.SerializeToString(&data); + TypeParam data; + data = SerializeAs(from); protobuf_unittest::TestEnumMapLite to; - EXPECT_TRUE(to.ParseFromString(data)); + EXPECT_TRUE(ParseFrom(data, to)); EXPECT_EQ(0, to.unknown_map_field().size()); EXPECT_FALSE(to.mutable_unknown_fields()->empty()); ASSERT_EQ(1, to.known_map_field().size()); EXPECT_EQ(protobuf_unittest::PROTO2_MAP_ENUM_FOO_LITE, to.known_map_field().at(0)); - data.clear(); from.Clear(); - to.SerializeToString(&data); - EXPECT_TRUE(from.ParseFromString(data)); + data = SerializeAs(to); + EXPECT_TRUE(ParseFrom(data, from)); ASSERT_EQ(1, from.known_map_field().size()); EXPECT_EQ(protobuf_unittest::E_PROTO2_MAP_ENUM_FOO_LITE, from.known_map_field().at(0)); @@ -744,9 +770,7 @@ TEST(Lite, AllLite32) { } } -TEST(Lite, AllLite33) { - std::string data; - +TYPED_TEST(LiteTest, AllLite33) { { // StandardWireFormat protobuf_unittest::TestMapLite message; @@ -758,9 +782,7 @@ TEST(Lite, AllLite33) { } } -TEST(Lite, AllLite34) { - std::string data; - +TYPED_TEST(LiteTest, AllLite34) { { // UnorderedWireFormat protobuf_unittest::TestMapLite message; @@ -776,7 +798,7 @@ TEST(Lite, AllLite34) { } } -TEST(Lite, AllLite35) { +TYPED_TEST(LiteTest, AllLite35) { std::string data; { @@ -792,7 +814,7 @@ TEST(Lite, AllLite35) { } } -TEST(Lite, AllLite36) { +TYPED_TEST(LiteTest, AllLite36) { std::string data; { @@ -808,9 +830,7 @@ TEST(Lite, AllLite36) { } } -TEST(Lite, AllLite37) { - std::string data; - +TYPED_TEST(LiteTest, AllLite37) { { // MissedKeyWireFormat protobuf_unittest::TestMapLite message; @@ -826,7 +846,7 @@ TEST(Lite, AllLite37) { } } -TEST(Lite, AllLite38) { +TYPED_TEST(LiteTest, AllLite38) { std::string data; { @@ -844,9 +864,7 @@ TEST(Lite, AllLite38) { } } -TEST(Lite, AllLite39) { - std::string data; - +TYPED_TEST(LiteTest, AllLite39) { { // UnknownFieldWireFormat protobuf_unittest::TestMapLite message; @@ -860,9 +878,7 @@ TEST(Lite, AllLite39) { } } -TEST(Lite, AllLite40) { - std::string data; - +TYPED_TEST(LiteTest, AllLite40) { { // CorruptedWireFormat protobuf_unittest::TestMapLite message; @@ -874,9 +890,7 @@ TEST(Lite, AllLite40) { } } -TEST(Lite, AllLite41) { - std::string data; - +TYPED_TEST(LiteTest, AllLite41) { { // IsInitialized protobuf_unittest::TestRequiredMessageMapLite map_message; @@ -893,9 +907,7 @@ TEST(Lite, AllLite41) { } } -TEST(Lite, AllLite42) { - std::string data; - +TYPED_TEST(LiteTest, AllLite42) { { // Check that adding more values to enum does not corrupt message // when passed through an old client. @@ -926,7 +938,7 @@ TEST(Lite, AllLite42) { // Test that when parsing a oneof, we can successfully clear whatever already // happened to be stored in the oneof. -TEST(Lite, AllLite43) { +TYPED_TEST(LiteTest, AllLite43) { protobuf_unittest::TestOneofParsingLite message1; message1.set_oneof_int32(17); @@ -970,7 +982,7 @@ TEST(Lite, AllLite43) { // Verify that we can successfully parse fields of various types within oneof // fields. We also verify that we can parse the same data twice into the same // message. -TEST(Lite, AllLite44) { +TYPED_TEST(LiteTest, AllLite44) { // Int32 { protobuf_unittest::TestOneofParsingLite original; @@ -1054,7 +1066,7 @@ TEST(Lite, AllLite44) { std::cout << "PASS" << std::endl; } -TEST(Lite, AllLite45) { +TYPED_TEST(LiteTest, AllLite45) { // Test unknown fields are not discarded upon parsing. std::string data = "\20\1"; // varint 1 with field number 2 @@ -1076,7 +1088,7 @@ TEST(Lite, AllLite45) { // unpacked) state we expect. These tests specifically check for that issue by // making sure we can parse repeated fields when the tag is higher than we would // expect. -TEST(Lite, AllLite46) { +TYPED_TEST(LiteTest, AllLite46) { protobuf_unittest::PackedInt32 packed; packed.add_repeated_int32(42); std::string serialized; @@ -1088,7 +1100,7 @@ TEST(Lite, AllLite46) { EXPECT_EQ(42, non_packed.repeated_int32(0)); } -TEST(Lite, AllLite47) { +TYPED_TEST(LiteTest, AllLite47) { protobuf_unittest::NonPackedFixed32 non_packed; non_packed.add_repeated_fixed32(42); std::string serialized; @@ -1100,7 +1112,7 @@ TEST(Lite, AllLite47) { EXPECT_EQ(42, packed.repeated_fixed32(0)); } -TEST(Lite, MapCrash) { +TYPED_TEST(LiteTest, MapCrash) { // See b/113635730 Arena arena; auto msg = Arena::CreateMessage(&arena); @@ -1114,7 +1126,7 @@ TEST(Lite, MapCrash) { "\202\1\15\10\1\200\200\200\200\200\200\200\200\200\200\1")); } -TEST(Lite, CorrectEnding) { +TYPED_TEST(LiteTest, CorrectEnding) { protobuf_unittest::TestAllTypesLite msg; { // All proto wireformat parsers should act the same on parsing data in as @@ -1144,7 +1156,7 @@ TEST(Lite, CorrectEnding) { } } -TEST(Lite, DebugString) { +TYPED_TEST(LiteTest, DebugString) { protobuf_unittest::TestAllTypesLite message1, message2; EXPECT_TRUE(absl::StartsWith(message1.DebugString(), "MessageLite at 0x")); EXPECT_TRUE(absl::StartsWith(message2.DebugString(), "MessageLite at 0x")); @@ -1159,7 +1171,7 @@ TEST(Lite, DebugString) { EXPECT_NE(message1.DebugString(), message2.DebugString()); } -TEST(Lite, EnumValueToName) { +TYPED_TEST(LiteTest, EnumValueToName) { EXPECT_EQ("FOREIGN_LITE_FOO", protobuf_unittest::ForeignEnumLite_Name( protobuf_unittest::FOREIGN_LITE_FOO)); EXPECT_EQ("FOREIGN_LITE_BAR", protobuf_unittest::ForeignEnumLite_Name( @@ -1170,7 +1182,7 @@ TEST(Lite, EnumValueToName) { EXPECT_EQ("", protobuf_unittest::ForeignEnumLite_Name(999)); } -TEST(Lite, NestedEnumValueToName) { +TYPED_TEST(LiteTest, NestedEnumValueToName) { EXPECT_EQ("FOO", protobuf_unittest::TestAllTypesLite::NestedEnum_Name( protobuf_unittest::TestAllTypesLite::FOO)); EXPECT_EQ("BAR", protobuf_unittest::TestAllTypesLite::NestedEnum_Name( @@ -1181,7 +1193,7 @@ TEST(Lite, NestedEnumValueToName) { EXPECT_EQ("", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(999)); } -TEST(Lite, EnumNameToValue) { +TYPED_TEST(LiteTest, EnumNameToValue) { protobuf_unittest::ForeignEnumLite value; ASSERT_TRUE( @@ -1203,7 +1215,7 @@ TEST(Lite, EnumNameToValue) { EXPECT_FALSE(protobuf_unittest::ForeignEnumLite_Parse("G", &value)); } -TEST(Lite, NestedEnumNameToValue) { +TYPED_TEST(LiteTest, NestedEnumNameToValue) { protobuf_unittest::TestAllTypesLite::NestedEnum value; ASSERT_TRUE( @@ -1227,7 +1239,7 @@ TEST(Lite, NestedEnumNameToValue) { protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("G", &value)); } -TEST(Lite, AliasedEnum) { +TYPED_TEST(LiteTest, AliasedEnum) { // Enums with allow_alias = true can have multiple entries with the same // value. EXPECT_EQ("FOO1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name( @@ -1254,7 +1266,7 @@ TEST(Lite, AliasedEnum) { } -TEST(Lite, CodedInputStreamRollback) { +TEST(LiteBasicTest, CodedInputStreamRollback) { { protobuf_unittest::TestAllTypesLite m; m.set_optional_bytes(std::string(30, 'a')); @@ -1332,5 +1344,6 @@ TEST(Lite, CodedInputStreamRollback) { } } +} // namespace } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 5e0ab8a3832a..fc0f56ac546f 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -36,6 +36,7 @@ #include "google/protobuf/message_lite.h" #include +#include #include #include #include @@ -47,10 +48,12 @@ #include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" +#include "absl/strings/cord_buffer.h" #include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" +#include "absl/types/optional.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" @@ -200,6 +203,9 @@ class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream { bool aliasing_enabled() { return cis_->aliasing_enabled_; } + bool ReadCord(absl::Cord* cord, int count) final { + return cis_->ReadCord(cord, count); + } private: io::CodedInputStream* cis_; }; @@ -317,6 +323,43 @@ bool MessageLite::MergeFromString(absl::string_view data) { } +namespace internal { + +template <> +struct SourceWrapper { + explicit SourceWrapper(const absl::Cord* c) : cord(c) {} + template + bool MergeInto(MessageLite* msg, MessageLite::ParseFlags parse_flags) const { + absl::optional flat = cord->TryFlat(); + if (flat && flat->size() <= ParseContext::kMaxCordBytesToCopy) { + return MergeFromImpl(*flat, msg, parse_flags); + } else { + io::CordInputStream input(cord); + return MergeFromImpl(&input, msg, parse_flags); + } + } + + const absl::Cord* const cord; +}; + +} // namespace internal + +bool MessageLite::MergeFromCord(const absl::Cord& cord) { + return ParseFrom(internal::SourceWrapper(&cord)); +} + +bool MessageLite::MergePartialFromCord(const absl::Cord& cord) { + return ParseFrom(internal::SourceWrapper(&cord)); +} + +bool MessageLite::ParseFromCord(const absl::Cord& cord) { + return ParseFrom(internal::SourceWrapper(&cord)); +} + +bool MessageLite::ParsePartialFromCord(const absl::Cord& cord) { + return ParseFrom(internal::SourceWrapper(&cord)); +} + // =================================================================== inline uint8_t* SerializeToArrayImpl(const MessageLite& msg, uint8_t* target, @@ -498,6 +541,78 @@ std::string MessageLite::SerializePartialAsString() const { return output; } +bool MessageLite::AppendToCord(absl::Cord* output) const { + GOOGLE_ABSL_DCHECK(IsInitialized()) + << InitializationErrorMessage("serialize", *this); + return AppendPartialToCord(output); +} + +bool MessageLite::AppendPartialToCord(absl::Cord* output) const { + // For efficiency, we'd like to pass a size hint to CordOutputStream with + // the exact total size expected. + const size_t size = ByteSizeLong(); + const size_t total_size = size + output->size(); + if (size > INT_MAX) { + GOOGLE_ABSL_LOG(ERROR) << "Exceeded maximum protobuf size of 2GB."; + return false; + } + + + // Allocate a CordBuffer (which may utilize private capacity in 'output'). + absl::CordBuffer buffer = output->GetAppendBuffer(size); + absl::Span available = buffer.available(); + auto target = reinterpret_cast(available.data()); + if (available.size() >= size) { + // Use EpsCopyOutputStream with full available capacity, as serialization + // may in the future use the extra slop bytes if available. + io::EpsCopyOutputStream out( + target, static_cast(available.size()), + io::CodedOutputStream::IsDefaultSerializationDeterministic()); + auto res = _InternalSerialize(target, &out); + GOOGLE_ABSL_DCHECK_EQ(res, target + size); + buffer.IncreaseLengthBy(size); + output->Append(std::move(buffer)); + GOOGLE_ABSL_DCHECK_EQ(output->size(), total_size); + return true; + } + + // Donate the buffer to the CordOutputStream with length := capacity. + // This follows the eager `EpsCopyOutputStream` initialization logic. + buffer.SetLength(buffer.capacity()); + io::CordOutputStream output_stream(std::move(*output), std::move(buffer), + total_size); + io::EpsCopyOutputStream out( + target, static_cast(available.size()), &output_stream, + io::CodedOutputStream::IsDefaultSerializationDeterministic(), &target); + target = _InternalSerialize(target, &out); + out.Trim(target); + if (out.HadError()) return false; + *output = output_stream.Consume(); + GOOGLE_ABSL_DCHECK_EQ(output->size(), total_size); + return true; +} + +bool MessageLite::SerializeToCord(absl::Cord* output) const { + output->Clear(); + return AppendToCord(output); +} + +bool MessageLite::SerializePartialToCord(absl::Cord* output) const { + output->Clear(); + return AppendPartialToCord(output); +} + +absl::Cord MessageLite::SerializeAsCord() const { + absl::Cord output; + if (!AppendToCord(&output)) output.Clear(); + return output; +} + +absl::Cord MessageLite::SerializePartialAsCord() const { + absl::Cord output; + if (!AppendPartialToCord(&output)) output.Clear(); + return output; +} namespace internal { diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index 7f266b3d649c..fade4bbaf814 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -49,6 +49,7 @@ #include "google/protobuf/port.h" #include "absl/base/call_once.h" #include "google/protobuf/stubs/logging.h" +#include "absl/strings/cord.h" #include "absl/strings/string_view.h" #include "google/protobuf/explicitly_constructed.h" #include "google/protobuf/io/coded_stream.h" @@ -371,6 +372,36 @@ class PROTOBUF_EXPORT MessageLite { // Like AppendToString(), but allows missing required fields. bool AppendPartialToString(std::string* output) const; + // Reads a protocol buffer from a Cord and merges it into this message. + bool MergeFromCord(const absl::Cord& cord); + // Like MergeFromCord(), but accepts messages that are missing + // required fields. + bool MergePartialFromCord(const absl::Cord& cord); + // Parse a protocol buffer contained in a Cord. + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromCord(const absl::Cord& cord); + // Like ParseFromCord(), but accepts messages that are missing + // required fields. + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCord( + const absl::Cord& cord); + + // Serialize the message and store it in the given Cord. All required + // fields must be set. + bool SerializeToCord(absl::Cord* output) const; + // Like SerializeToCord(), but allows missing required fields. + bool SerializePartialToCord(absl::Cord* output) const; + + // Make a Cord encoding the message. Is equivalent to calling + // SerializeToCord() on a Cord and using that. Returns an empty + // Cord if SerializeToCord() would have returned an error. + absl::Cord SerializeAsCord() const; + // Like SerializeAsCord(), but allows missing required fields. + absl::Cord SerializePartialAsCord() const; + + // Like SerializeToCord(), but appends to the data to the Cord's existing + // contents. All required fields must be set. + bool AppendToCord(absl::Cord* output) const; + // Like AppendToCord(), but allows missing required fields. + bool AppendPartialToCord(absl::Cord* output) const; // Computes the serialized size of the message. This recursively calls // ByteSizeLong() on all embedded messages. From 025258525ce5029ef1bfcfa0210d8890dff708dc Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 12 Dec 2022 21:55:07 -0800 Subject: [PATCH 11/43] Aggressively pipeline branches that have Arenas for performance. PiperOrigin-RevId: 494917475 --- src/google/protobuf/arena.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index b60b7d0fc901..8a7d1b4804c3 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -271,7 +271,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { // is obtained from the arena). template PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { - if (arena == nullptr) { + if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { return new T(std::forward(args)...); } auto destructor = @@ -320,10 +320,13 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { "CreateArray requires a trivially destructible type"); GOOGLE_ABSL_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) << "Requested size is too large to fit into size_t."; - if (arena == nullptr) { + if (PROTOBUF_PREDICT_FALSE(arena == nullptr)) { return static_cast(::operator new[](num_elements * sizeof(T))); } else { - return arena->CreateInternalRawArray(num_elements); + // We count on compiler to realize that if sizeof(T) is a multiple of + // 8 AlignUpTo can be elided. + return static_cast( + arena->AllocateAlignedForArray(sizeof(T) * num_elements, alignof(T))); } } @@ -598,18 +601,6 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { std::forward(args)...); } - // Just allocate the required size for the given type assuming the - // type has a trivial constructor. - template - PROTOBUF_NDEBUG_INLINE T* CreateInternalRawArray(size_t num_elements) { - GOOGLE_ABSL_CHECK_LE(num_elements, std::numeric_limits::max() / sizeof(T)) - << "Requested size is too large to fit into size_t."; - // We count on compiler to realize that if sizeof(T) is a multiple of - // 8 AlignUpTo can be elided. - const size_t n = sizeof(T) * num_elements; - return static_cast(AllocateAlignedForArray(n, alignof(T))); - } - template PROTOBUF_NDEBUG_INLINE T* DoCreateMessage(Args&&... args) { return InternalHelper::Construct( From e4116700b5e5741ef1b2ca041e8c13af0c71cd89 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 08:34:50 -0800 Subject: [PATCH 12/43] Clean up the interface of io::Printer. This CL kicks any definition longer than three or so lines out of the class body and defines them out of line. The number of private definitions at the head of the class was getting completely out of control. Ideally we would not kick Printer::Sub out, since its API is important, but there's no way to do this while also moving ValueImpl out of the class, which was taking on a whole lot of space. Today I learned that an out-of-line template definition can have multiple template <> declarations, which is necessary to be able to utter the signature of those symbols out of line. PiperOrigin-RevId: 495030857 --- src/google/protobuf/io/printer.cc | 27 +- src/google/protobuf/io/printer.h | 700 ++++++++++++++++-------------- 2 files changed, 390 insertions(+), 337 deletions(-) diff --git a/src/google/protobuf/io/printer.cc b/src/google/protobuf/io/printer.cc index 1320b71cdc60..2fc7b6be3c23 100644 --- a/src/google/protobuf/io/printer.cc +++ b/src/google/protobuf/io/printer.cc @@ -77,6 +77,30 @@ absl::optional LookupInFrameStack( } } // namespace +struct Printer::Format { + struct Chunk { + // The chunk's text; if this is a variable, it does not include the $...$. + absl::string_view text; + + // Whether or not this is a variable name, i.e., a $...$. + bool is_var; + }; + + struct Line { + // Chunks to emit, split along $ and annotates as to whether it is a + // variable name. + std::vector chunks; + + // The indentation for this chunk. + size_t indent; + }; + + std::vector lines; + + // Whether this is a multiline raw string, according to internal heuristics. + bool is_raw_string = false; +}; + Printer::Format Printer::TokenizeFormat(absl::string_view format_string, const PrintOptions& options) { Format format; @@ -668,7 +692,8 @@ void Printer::PrintImpl(absl::string_view format, "substitution that resolves to callback cannot contain whitespace"); range_start = sink_.bytes_written(); - (*fnc)(); + GOOGLE_ABSL_CHECK((*fnc)()) + << "recursive call encountered while evaluating \"" << var << "\""; range_end = sink_.bytes_written(); } diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h index 31deaa533903..4281d1493163 100644 --- a/src/google/protobuf/io/printer.h +++ b/src/google/protobuf/io/printer.h @@ -417,159 +417,7 @@ class PROTOBUF_EXPORT Printer { int line() { return 0; } }; - struct AnnotationRecord { - std::vector path; - std::string file_path; - - // AnnotationRecord's constructors are *not* marked as explicit, - // specifically so that it is possible to construct a - // map by writing - // - // {{"foo", my_cool_descriptor}, {"bar", "file.proto"}} - - template < - typename String, - std::enable_if_t::value, - int> = 0> - AnnotationRecord( // NOLINT(google-explicit-constructor) - const String& file_path) - : file_path(file_path) {} - - template ::value, int> = 0> - AnnotationRecord(const Desc* desc) // NOLINT(google-explicit-constructor) - : file_path(desc->file()->name()) { - desc->GetLocationPath(&path); - } - }; - - // Helper type for wrapping a variable substitution expansion result. - template - struct ValueImpl { - private: - template - struct IsSubImpl : std::false_type {}; - template - struct IsSubImpl> : std::true_type {}; - - public: - using StringType = - std::conditional_t; - // These callbacks return false if this is a recursive call. - using Callback = std::function; - using StringOrCallback = absl::variant; - - ValueImpl() = default; - - // This is a template to avoid colliding with the copy constructor below. - template >::value, - int> = 0> - ValueImpl(Value&& value) // NOLINT - : value(ToStringOrCallback(std::forward(value), Rank2{})) { - if (absl::holds_alternative(this->value)) { - consume_after = ";,"; - } - } - - // Copy ctor/assign allow interconversion of the two template parameters. - template - ValueImpl(const ValueImpl& that) { // NOLINT - *this = that; - } - - template - ValueImpl& operator=(const ValueImpl& that) { - // Cast to void* is required, since this and that may potentially be of - // different types (due to the `that_owned` parameter). - if (static_cast(this) == static_cast(&that)) { - return *this; - } - - using ThatStringType = typename ValueImpl::StringType; - - if (auto* str = absl::get_if(&that.value)) { - value = StringType(*str); - } else { - value = absl::get(that.value); - } - - consume_after = that.consume_after; - return *this; - } - - const StringType* AsString() const { - return absl::get_if(&value); - } - - const Callback* AsCallback() const { - return absl::get_if(&value); - } - - StringOrCallback value; - std::string consume_after; - - private: - // go/ranked-overloads - struct Rank0 {}; - struct Rank1 : Rank0 {}; - struct Rank2 : Rank1 {}; - - // Dummy template for delayed instantiation, which is required for the - // static assert below to kick in only when this function is called when it - // shouldn't. - // - // This is done to produce a better error message than the "candidate does - // not match" SFINAE errors. - template ()())> - StringOrCallback ToStringOrCallback(Cb&& cb, Rank2) { - return Callback( - [cb = std::forward(cb), is_called = false]() mutable -> bool { - if (is_called) { - // Catch whether or not this function is being called recursively. - return false; - } - is_called = true; - cb(); - is_called = false; - return true; - }); - } - - // Separate from the AlphaNum overload to avoid copies when taking strings - // by value when in `owned` mode. - StringOrCallback ToStringOrCallback(StringType s, Rank1) { return s; } - - StringOrCallback ToStringOrCallback(const absl::AlphaNum& s, Rank0) { - return StringType(s.Piece()); - } - }; - - using ValueView = ValueImpl; - using Value = ValueImpl; - - // Provide a helper to use heterogeneous lookup when it's available. - template - using void_t = void; - template - struct has_heterogeneous_lookup : std::false_type {}; - template - struct has_heterogeneous_lookup().find( - std::declval()))>> - : std::true_type {}; - - template ::value, int> = 0> - static absl::string_view ToStringKey(absl::string_view x) { - return x; - } - template ::value, int> = 0> - static std::string ToStringKey(absl::string_view x) { - return std::string(x); - } + struct AnnotationRecord; public: static constexpr char kDefaultVariableDelimiter = '$'; @@ -577,42 +425,7 @@ class PROTOBUF_EXPORT Printer { "PROTOC_CODEGEN_TRACE"; // Sink type for constructing substitutions to pass to WithVars() and Emit(). - class Sub { - public: - template - Sub(std::string key, Value&& value) - : key_(std::move(key)), - value_(std::forward(value)), - annotation_(absl::nullopt) {} - - // NOTE: This is an overload rather than taking optional - // with a default argument of nullopt, because we want to pick up - // AnnotationRecord's user-defined conversions. Because going from - // e.g. Descriptor* -> optional requires two user-defined - // conversions, this does not work. - template - Sub(Key&& key, Value&& value, AnnotationRecord annotation) - : key_(std::forward(key)), - value_(std::forward(value)), - annotation_(std::move(annotation)) {} - - Sub Annotate(AnnotationRecord annotation) && { - annotation_ = std::move(annotation); - return std::move(*this); - } - - Sub WithSuffix(std::string sub_suffix) && { - value_.consume_after = std::move(sub_suffix); - return std::move(*this); - } - - private: - friend class Printer; - - std::string key_; - Value value_; - absl::optional annotation_; - }; + class Sub; // Options for controlling how the output of a Printer is formatted. struct Options { @@ -666,39 +479,18 @@ class PROTOBUF_EXPORT Printer { // // Returns an RAII object that pops the lookup frame. template - auto WithVars(const Map* vars) { - var_lookups_.emplace_back( - [vars](absl::string_view var) -> absl::optional { - auto it = vars->find(ToStringKey(var)); - if (it == vars->end()) { - return absl::nullopt; - } - return ValueView(it->second); - }); - return absl::MakeCleanup([this] { var_lookups_.pop_back(); }); - } + auto WithVars(const Map* vars); // Pushes a new variable lookup frame that stores `vars` by value. // - // When writing `WithVars({...})`, this is the overload that will be called, - // and it will synthesize an `absl::flat_hash_map`. - // // Returns an RAII object that pops the lookup frame. template , - std::enable_if_t::value, int> = 0> - auto WithVars(Map&& vars) { - var_lookups_.emplace_back( - [vars = std::forward(vars)]( - absl::string_view var) -> absl::optional { - auto it = vars.find(ToStringKey(var)); - if (it == vars.end()) { - return absl::nullopt; - } - return ValueView(it->second); - }); - return absl::MakeCleanup([this] { var_lookups_.pop_back(); }); - } + typename = std::enable_if_t::value>> + auto WithVars(Map&& vars); + // Pushes a new variable lookup frame that stores `vars` by value. + // + // Returns an RAII object that pops the lookup frame. auto WithVars(std::initializer_list vars); // Looks up a variable set with WithVars(). @@ -712,17 +504,7 @@ class PROTOBUF_EXPORT Printer { // // Returns an RAII object that pops the lookup frame. template - auto WithAnnotations(const Map* vars) { - annotation_lookups_.emplace_back( - [vars](absl::string_view var) -> absl::optional { - auto it = vars->find(ToStringKey(var)); - if (it == vars->end()) { - return absl::nullopt; - } - return AnnotationRecord(it->second); - }); - return absl::MakeCleanup([this] { annotation_lookups_.pop_back(); }); - } + auto WithAnnotations(const Map* vars); // Pushes a new variable lookup frame that stores `vars` by value. // @@ -731,18 +513,7 @@ class PROTOBUF_EXPORT Printer { // // Returns an RAII object that pops the lookup frame. template > - auto WithAnnotations(Map&& vars) { - annotation_lookups_.emplace_back( - [vars = std::forward(vars)]( - absl::string_view var) -> absl::optional { - auto it = vars.find(ToStringKey(var)); - if (it == vars.end()) { - return absl::nullopt; - } - return AnnotationRecord(it->second); - }); - return absl::MakeCleanup([this] { annotation_lookups_.pop_back(); }); - } + auto WithAnnotations(Map&& vars); // Increases the indentation by `indent` spaces; when nullopt, increments // indentation by the configured default spaces_per_indent. @@ -759,9 +530,7 @@ class PROTOBUF_EXPORT Printer { // // `format` MUST be a string constant. void Emit(absl::string_view format, - SourceLocation loc = SourceLocation::current()) { - Emit({}, format, loc); - } + SourceLocation loc = SourceLocation::current()); // Emits formatted source code to the underlying output, injecting // additional variables as a lookup frame for just this call. See the class @@ -788,31 +557,10 @@ class PROTOBUF_EXPORT Printer { // TODO(b/242326974): Deprecate these APIs. template > - void Print(const Map& vars, absl::string_view text) { - PrintOptions opts; - opts.checks_are_debug_only = true; - opts.use_substitution_map = true; - opts.allow_digit_substitutions = false; - - auto pop = WithVars(&vars); - PrintImpl(text, {}, opts); - } + void Print(const Map& vars, absl::string_view text); template - void Print(absl::string_view text, const Args&... args) { - static_assert(sizeof...(args) % 2 == 0, ""); - - // Include an extra arg, since a zero-length array is ill-formed, and - // MSVC complains. - absl::string_view vars[] = {args..., ""}; - absl::flat_hash_map map; - map.reserve(sizeof...(args) / 2); - for (size_t i = 0; i < sizeof...(args); i += 2) { - map.emplace(vars[i], vars[i + 1]); - } - - Print(map, text); - } + void Print(absl::string_view text, const Args&... args); // Link a substitution variable emitted by the last call to Print to the // object described by descriptor. @@ -825,17 +573,9 @@ class PROTOBUF_EXPORT Printer { // the last call to Print to the object described by descriptor. The range // begins at begin_varname's value and ends after the last character of the // value substituted for end_varname. - template + template void Annotate(absl::string_view begin_varname, absl::string_view end_varname, - const SomeDescriptor* descriptor) { - if (options_.annotation_collector == nullptr) { - return; - } - - std::vector path; - descriptor->GetLocationPath(&path); - Annotate(begin_varname, end_varname, descriptor->file()->name(), path); - } + const Desc* descriptor); // Link a substitution variable emitted by the last call to Print to the file // with path file_name. @@ -866,75 +606,41 @@ class PROTOBUF_EXPORT Printer { // compiler::cpp::Formatter instead. template > void FormatInternal(absl::Span args, const Map& vars, - absl::string_view format) { - PrintOptions opts; - opts.use_curly_brace_substitutions = true; - opts.strip_spaces_around_vars = true; - - auto pop = WithVars(&vars); - PrintImpl(format, args, opts); - } + absl::string_view format); private: - // Options for PrintImpl(). - struct PrintOptions { - // The callsite of the public entry-point. Only Emit() sets this. - absl::optional loc; - // If set, Validate() calls will not crash the program. - bool checks_are_debug_only = false; - // If set, the `substitutions_` map will be populated as variables are - // substituted. - bool use_substitution_map = false; - // If set, the ${1$ and $}$ forms will be substituted. These are used for - // a slightly janky annotation-insertion mechanism in FormatInternal, that - // requires that passed-in substitution variables be serialized protos. - bool use_curly_brace_substitutions = false; - // If set, the $n$ forms will be substituted, pulling from the `args` - // argument to PrintImpl(). - bool allow_digit_substitutions = true; - // If set, when a variable substitution with spaces in it, such as $ var$, - // is encountered, the spaces are stripped, so that it is as if it was - // $var$. If $var$ substitutes to a non-empty string, the removed spaces are - // printed around the substituted value. - // - // See the class documentation for more information on this behavior. - bool strip_spaces_around_vars = true; - // If set, leading whitespace will be stripped from the format string to - // determine the "extraneous indentation" that is produced when the format - // string is a C++ raw string. This is used to remove leading spaces from - // a raw string that would otherwise result in erratic indentation in the - // output. - bool strip_raw_string_indentation = false; - // If set, the annotation lookup frames are searched, per the annotation - // semantics of Emit() described in the class documentation. - bool use_annotation_frames = true; - }; - - friend class FormatIterator; + struct PrintOptions; + struct Format; - struct Format { - struct Chunk { - // The chunk's text; if this is a variable, it does not include the $...$. - absl::string_view text; + // Helper type for wrapping a variable substitution expansion result. + template + struct ValueImpl; - // Whether or not this is a variable name, i.e., a $...$. - bool is_var; - }; + using ValueView = ValueImpl; + using Value = ValueImpl; - struct Line { - // Chunks to emit, split along $ and annotates as to whether it is a - // variable name. - std::vector chunks; + // Provide a helper to use heterogeneous lookup when it's available. + template + using Void = void; - // The indentation for this chunk. - size_t indent; - }; + template + struct HasHeteroLookup : std::false_type {}; + template + struct HasHeteroLookup().find( + std::declval()))>> + : std::true_type {}; - std::vector lines; + template ::value>> + static absl::string_view ToStringKey(absl::string_view x) { + return x; + } - // Whether this is a multiline raw string, according to internal heuristics. - bool is_raw_string = false; - }; + template ::value>> + static std::string ToStringKey(absl::string_view x) { + return std::string(x); + } Format TokenizeFormat(absl::string_view format_string, const PrintOptions& options); @@ -1006,6 +712,328 @@ class PROTOBUF_EXPORT Printer { std::vector line_start_variables_; }; +// Options for PrintImpl(). +struct Printer::PrintOptions { + // The callsite of the public entry-point. Only Emit() sets this. + absl::optional loc; + // If set, Validate() calls will not crash the program. + bool checks_are_debug_only = false; + // If set, the `substitutions_` map will be populated as variables are + // substituted. + bool use_substitution_map = false; + // If set, the ${1$ and $}$ forms will be substituted. These are used for + // a slightly janky annotation-insertion mechanism in FormatInternal, that + // requires that passed-in substitution variables be serialized protos. + bool use_curly_brace_substitutions = false; + // If set, the $n$ forms will be substituted, pulling from the `args` + // argument to PrintImpl(). + bool allow_digit_substitutions = true; + // If set, when a variable substitution with spaces in it, such as $ var$, + // is encountered, the spaces are stripped, so that it is as if it was + // $var$. If $var$ substitutes to a non-empty string, the removed spaces are + // printed around the substituted value. + // + // See the class documentation for more information on this behavior. + bool strip_spaces_around_vars = true; + // If set, leading whitespace will be stripped from the format string to + // determine the "extraneous indentation" that is produced when the format + // string is a C++ raw string. This is used to remove leading spaces from + // a raw string that would otherwise result in erratic indentation in the + // output. + bool strip_raw_string_indentation = false; + // If set, the annotation lookup frames are searched, per the annotation + // semantics of Emit() described in the class documentation. + bool use_annotation_frames = true; +}; + +// Helper type for wrapping a variable substitution expansion result. +template +struct Printer::ValueImpl { + private: + template + struct IsSubImpl : std::false_type {}; + template + struct IsSubImpl> : std::true_type {}; + + public: + using StringType = std::conditional_t; + // These callbacks return false if this is a recursive call. + using Callback = std::function; + using StringOrCallback = absl::variant; + + ValueImpl() = default; + + // This is a template to avoid colliding with the copy constructor below. + template >::value>> + ValueImpl(Value&& value) // NOLINT + : value(ToStringOrCallback(std::forward(value), Rank2{})) { + if (absl::holds_alternative(this->value)) { + consume_after = ";,"; + } + } + + // Copy ctor/assign allow interconversion of the two template parameters. + template + ValueImpl(const ValueImpl& that) { // NOLINT + *this = that; + } + + template + ValueImpl& operator=(const ValueImpl& that); + + const StringType* AsString() const { + return absl::get_if(&value); + } + + const Callback* AsCallback() const { return absl::get_if(&value); } + + StringOrCallback value; + std::string consume_after; + + private: + // go/ranked-overloads + struct Rank0 {}; + struct Rank1 : Rank0 {}; + struct Rank2 : Rank1 {}; + + // Dummy template for delayed instantiation, which is required for the + // static assert below to kick in only when this function is called when it + // shouldn't. + // + // This is done to produce a better error message than the "candidate does + // not match" SFINAE errors. + template ()())> + StringOrCallback ToStringOrCallback(Cb&& cb, Rank2); + + // Separate from the AlphaNum overload to avoid copies when taking strings + // by value when in `owned` mode. + StringOrCallback ToStringOrCallback(StringType s, Rank1) { return s; } + + StringOrCallback ToStringOrCallback(const absl::AlphaNum& s, Rank0) { + return StringType(s.Piece()); + } +}; + +template +template +Printer::ValueImpl& Printer::ValueImpl::operator=( + const ValueImpl& that) { + // Cast to void* is required, since this and that may potentially be of + // different types (due to the `that_owned` parameter). + if (static_cast(this) == static_cast(&that)) { + return *this; + } + + using ThatStringType = typename ValueImpl::StringType; + + if (auto* str = absl::get_if(&that.value)) { + value = StringType(*str); + } else { + value = absl::get(that.value); + } + + consume_after = that.consume_after; + return *this; +} + +template +template +auto Printer::ValueImpl::ToStringOrCallback(Cb&& cb, Rank2) + -> StringOrCallback { + return Callback( + [cb = std::forward(cb), is_called = false]() mutable -> bool { + if (is_called) { + // Catch whether or not this function is being called recursively. + return false; + } + is_called = true; + cb(); + is_called = false; + return true; + }); +} + +struct Printer::AnnotationRecord { + std::vector path; + std::string file_path; + + // AnnotationRecord's constructors are *not* marked as explicit, + // specifically so that it is possible to construct a + // map by writing + // + // {{"foo", my_cool_descriptor}, {"bar", "file.proto"}} + + template < + typename String, + std::enable_if_t::value, + int> = 0> + AnnotationRecord( // NOLINT(google-explicit-constructor) + const String& file_path) + : file_path(file_path) {} + + template ::value, int> = 0> + AnnotationRecord(const Desc* desc) // NOLINT(google-explicit-constructor) + : file_path(desc->file()->name()) { + desc->GetLocationPath(&path); + } +}; + +class Printer::Sub { + public: + template + Sub(std::string key, Value&& value) + : key_(std::move(key)), + value_(std::forward(value)), + annotation_(absl::nullopt) {} + + // NOTE: This is an overload rather than taking optional + // with a default argument of nullopt, because we want to pick up + // AnnotationRecord's user-defined conversions. Because going from + // e.g. Descriptor* -> optional requires two user-defined + // conversions, this does not work. + template + Sub(Key&& key, Value&& value, AnnotationRecord annotation) + : key_(std::forward(key)), + value_(std::forward(value)), + annotation_(std::move(annotation)) {} + + Sub Annotate(AnnotationRecord annotation) && { + annotation_ = std::move(annotation); + return std::move(*this); + } + + Sub WithSuffix(std::string sub_suffix) && { + value_.consume_after = std::move(sub_suffix); + return std::move(*this); + } + + private: + friend class Printer; + + std::string key_; + Value value_; + absl::optional annotation_; +}; + +template +auto Printer::WithVars(const Map* vars) { + var_lookups_.emplace_back( + [vars](absl::string_view var) -> absl::optional { + auto it = vars->find(ToStringKey(var)); + if (it == vars->end()) { + return absl::nullopt; + } + return ValueView(it->second); + }); + return absl::MakeCleanup([this] { var_lookups_.pop_back(); }); +} + +template +auto Printer::WithVars(Map&& vars) { + var_lookups_.emplace_back( + [vars = std::forward(vars)]( + absl::string_view var) -> absl::optional { + auto it = vars.find(ToStringKey(var)); + if (it == vars.end()) { + return absl::nullopt; + } + return ValueView(it->second); + }); + return absl::MakeCleanup([this] { var_lookups_.pop_back(); }); +} + +template +auto Printer::WithAnnotations(const Map* vars) { + annotation_lookups_.emplace_back( + [vars](absl::string_view var) -> absl::optional { + auto it = vars->find(ToStringKey(var)); + if (it == vars->end()) { + return absl::nullopt; + } + return AnnotationRecord(it->second); + }); + return absl::MakeCleanup([this] { annotation_lookups_.pop_back(); }); +} + +template +auto Printer::WithAnnotations(Map&& vars) { + annotation_lookups_.emplace_back( + [vars = std::forward(vars)]( + absl::string_view var) -> absl::optional { + auto it = vars.find(ToStringKey(var)); + if (it == vars.end()) { + return absl::nullopt; + } + return AnnotationRecord(it->second); + }); + return absl::MakeCleanup([this] { annotation_lookups_.pop_back(); }); +} + +// In GCC older than GCC 9, this code (which constructs an empty +// std::initializer_list) incorrectly fails to compile if it does not +// follow the definition of the type Sub; this is the only reason it is +// out-of-line. +// +// See https://godbolt.org/z/e4KnM3PE7. +inline void Printer::Emit(absl::string_view format, SourceLocation loc) { + Emit({}, format, loc); +} + +template +void Printer::Print(const Map& vars, absl::string_view text) { + PrintOptions opts; + opts.checks_are_debug_only = true; + opts.use_substitution_map = true; + opts.allow_digit_substitutions = false; + + auto pop = WithVars(&vars); + PrintImpl(text, {}, opts); +} + +template +void Printer::Print(absl::string_view text, const Args&... args) { + static_assert(sizeof...(args) % 2 == 0, ""); + + // Include an extra arg, since a zero-length array is ill-formed, and + // MSVC complains. + absl::string_view vars[] = {args..., ""}; + absl::flat_hash_map map; + map.reserve(sizeof...(args) / 2); + for (size_t i = 0; i < sizeof...(args); i += 2) { + map.emplace(vars[i], vars[i + 1]); + } + + Print(map, text); +} + +template +void Printer::Annotate(absl::string_view begin_varname, + absl::string_view end_varname, const Desc* descriptor) { + if (options_.annotation_collector == nullptr) { + return; + } + + std::vector path; + descriptor->GetLocationPath(&path); + Annotate(begin_varname, end_varname, descriptor->file()->name(), path); +} + +template +void Printer::FormatInternal(absl::Span args, + const Map& vars, absl::string_view format) { + PrintOptions opts; + opts.use_curly_brace_substitutions = true; + opts.strip_spaces_around_vars = true; + + auto pop = WithVars(&vars); + PrintImpl(format, args, opts); +} + inline auto Printer::WithDefs(std::initializer_list vars, bool allow_callbacks) { absl::flat_hash_map var_map; From 680881def1a95b60d25fe240248f50a6b42d2d40 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 09:49:35 -0800 Subject: [PATCH 13/43] Internal change PiperOrigin-RevId: 495049673 --- python/google/protobuf/text_format.py | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py index 367523c1ee5c..b9683d4bd7c6 100644 --- a/python/google/protobuf/text_format.py +++ b/python/google/protobuf/text_format.py @@ -883,7 +883,7 @@ def _MergeField(self, tokenizer, message): type_url_prefix, packed_type_name = self._ConsumeAnyTypeUrl(tokenizer) tokenizer.Consume(']') tokenizer.TryConsume(':') - self._DetectSilentMarker(tokenizer, + self._DetectSilentMarker(tokenizer, message_descriptor.full_name, type_url_prefix + '/' + packed_type_name) if tokenizer.TryConsume('<'): expanded_any_end_token = '>' @@ -982,11 +982,13 @@ def _MergeField(self, tokenizer, message): if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: tokenizer.TryConsume(':') - self._DetectSilentMarker(tokenizer, field.full_name) + self._DetectSilentMarker(tokenizer, message_descriptor.full_name, + field.full_name) merger = self._MergeMessageField else: tokenizer.Consume(':') - self._DetectSilentMarker(tokenizer, field.full_name) + self._DetectSilentMarker(tokenizer, message_descriptor.full_name, + field.full_name) merger = self._MergeScalarField if (field.label == descriptor.FieldDescriptor.LABEL_REPEATED and @@ -1004,19 +1006,19 @@ def _MergeField(self, tokenizer, message): else: # Proto field is unknown. assert (self.allow_unknown_extension or self.allow_unknown_field) - self._SkipFieldContents(tokenizer, name) + self._SkipFieldContents(tokenizer, name, message_descriptor.full_name) # For historical reasons, fields may optionally be separated by commas or # semicolons. if not tokenizer.TryConsume(','): tokenizer.TryConsume(';') - def _LogSilentMarker(self, field_name): + def _LogSilentMarker(self, immediate_message_type, field_name): pass - def _DetectSilentMarker(self, tokenizer, field_name): + def _DetectSilentMarker(self, tokenizer, immediate_message_type, field_name): if tokenizer.contains_silent_marker_before_current_token: - self._LogSilentMarker(field_name) + self._LogSilentMarker(immediate_message_type, field_name) def _ConsumeAnyTypeUrl(self, tokenizer): """Consumes a google.protobuf.Any type URL and returns the type name.""" @@ -1166,12 +1168,14 @@ def _MergeScalarField(self, tokenizer, message, field): else: setattr(message, field.name, value) - def _SkipFieldContents(self, tokenizer, field_name): + def _SkipFieldContents(self, tokenizer, field_name, immediate_message_type): """Skips over contents (value or message) of a field. Args: tokenizer: A tokenizer to parse the field name and values. field_name: The field name currently being parsed. + immediate_message_type: The type of the message immediately containing + the silent marker. """ # Try to guess the type of this field. # If this field is not a message, there should be a ":" between the @@ -1181,20 +1185,22 @@ def _SkipFieldContents(self, tokenizer, field_name): # to be a message or the input is ill-formed. if tokenizer.TryConsume( ':') and not tokenizer.LookingAt('{') and not tokenizer.LookingAt('<'): - self._DetectSilentMarker(tokenizer, field_name) + self._DetectSilentMarker(tokenizer, immediate_message_type, field_name) if tokenizer.LookingAt('['): self._SkipRepeatedFieldValue(tokenizer) else: self._SkipFieldValue(tokenizer) else: - self._DetectSilentMarker(tokenizer, field_name) - self._SkipFieldMessage(tokenizer) + self._DetectSilentMarker(tokenizer, immediate_message_type, field_name) + self._SkipFieldMessage(tokenizer, immediate_message_type) - def _SkipField(self, tokenizer): + def _SkipField(self, tokenizer, immediate_message_type): """Skips over a complete field (name and value/message). Args: tokenizer: A tokenizer to parse the field name and values. + immediate_message_type: The type of the message immediately containing + the silent marker. """ field_name = '' if tokenizer.TryConsume('['): @@ -1214,18 +1220,20 @@ def _SkipField(self, tokenizer): else: field_name += tokenizer.ConsumeIdentifierOrNumber() - self._SkipFieldContents(tokenizer, field_name) + self._SkipFieldContents(tokenizer, field_name, immediate_message_type) # For historical reasons, fields may optionally be separated by commas or # semicolons. if not tokenizer.TryConsume(','): tokenizer.TryConsume(';') - def _SkipFieldMessage(self, tokenizer): + def _SkipFieldMessage(self, tokenizer, immediate_message_type): """Skips over a field message. Args: tokenizer: A tokenizer to parse the field name and values. + immediate_message_type: The type of the message immediately containing + the silent marker """ if tokenizer.TryConsume('<'): delimiter = '>' @@ -1234,7 +1242,7 @@ def _SkipFieldMessage(self, tokenizer): delimiter = '}' while not tokenizer.LookingAt('>') and not tokenizer.LookingAt('}'): - self._SkipField(tokenizer) + self._SkipField(tokenizer, immediate_message_type) tokenizer.Consume(delimiter) From 2433d6088fd0a29b5b583aaf8cfd95dd902d6401 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 10:22:22 -0800 Subject: [PATCH 14/43] Add a mechanism for placing comments in Emit() calls that are not reproduced in the output. PiperOrigin-RevId: 495059212 --- src/google/protobuf/io/printer.cc | 14 ++++++++++---- src/google/protobuf/io/printer.h | 14 ++++++++++++++ src/google/protobuf/io/printer_unittest.cc | 16 +++++++++++++--- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/google/protobuf/io/printer.cc b/src/google/protobuf/io/printer.cc index 2fc7b6be3c23..ace56b124431 100644 --- a/src/google/protobuf/io/printer.cc +++ b/src/google/protobuf/io/printer.cc @@ -49,7 +49,6 @@ #include "google/protobuf/stubs/logging.h" #include "absl/strings/ascii.h" #include "absl/strings/escaping.h" -#include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/str_split.h" @@ -156,22 +155,29 @@ Printer::Format Printer::TokenizeFormat(absl::string_view format_string, } // We now split the remaining format string into lines and discard: - // 1. All leading spaces to compute that line's indent. + // 1. A trailing Printer-discarded comment, if this is a raw string. + // + // 2. All leading spaces to compute that line's indent. // We do not do this for the first line, so that Emit(" ") works // correctly. We do this *regardless* of whether we are processing // a raw string, because existing non-raw-string calls to cpp::Formatter // rely on this. There is a test that validates this behavior. // - // 2. Set the indent for that line to max(0, line_indent - + // 3. Set the indent for that line to max(0, line_indent - // raw_string_indent), if this is not a raw string. // - // 3. Trailing empty lines, if we know this is a raw string, except for + // 4. Trailing empty lines, if we know this is a raw string, except for // a single extra newline at the end. // // Each line is itself split into chunks along the variable delimiters, e.g. // $...$. bool is_first = true; for (absl::string_view line_text : absl::StrSplit(format_string, '\n')) { + if (format.is_raw_string) { + size_t comment_index = line_text.find(options_.ignored_comment_start); + line_text = line_text.substr(0, comment_index); + } + size_t line_indent = 0; while (!is_first && absl::ConsumePrefix(&line_text, " ")) { ++line_indent; diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h index 4281d1493163..83c71e8811ee 100644 --- a/src/google/protobuf/io/printer.h +++ b/src/google/protobuf/io/printer.h @@ -224,6 +224,17 @@ class AnnotationProtoCollector : public AnnotationCollector { // } // }; // +// # Comments +// +// It may be desirable to place comments in a raw string that are stripped out +// before printing. The prefix for Printer-ignored comments can be configured +// in Options. By default, this is `//~`. +// +// p.Emit(R"cc( +// // Will be printed in the output. +// //~ Won't be. +// )cc"); +// // # Lookup Frames // // If many calls to Emit() use the same set of variables, they can be stored @@ -445,6 +456,9 @@ class PROTOBUF_EXPORT Printer { // to allow the Printer to emit debugging annotations in the source code // output. absl::string_view comment_start = "//"; + // The token for beginning comments that are discarded by Printer's internal + // formatter. + absl::string_view ignored_comment_start = "//~"; // The number of spaces that a single level of indentation adds by default; // this is the amount that WithIndent() increases indentation by. size_t spaces_per_indent = 2; diff --git a/src/google/protobuf/io/printer_unittest.cc b/src/google/protobuf/io/printer_unittest.cc index 3a8fa22b0951..efcafc870835 100644 --- a/src/google/protobuf/io/printer_unittest.cc +++ b/src/google/protobuf/io/printer_unittest.cc @@ -41,14 +41,12 @@ #include "google/protobuf/descriptor.pb.h" #include -#include "google/protobuf/testing/googletest.h" #include #include "absl/container/flat_hash_map.h" #include "google/protobuf/stubs/logging.h" #include "absl/strings/str_join.h" #include "absl/strings/string_view.h" #include "google/protobuf/io/zero_copy_stream.h" -#include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" namespace google { @@ -56,7 +54,6 @@ namespace protobuf { namespace io { using ::testing::AllOf; using ::testing::ElementsAre; -using ::testing::ExplainMatchResult; using ::testing::Field; using ::testing::IsEmpty; using ::testing::MatchesRegex; @@ -565,6 +562,19 @@ TEST_F(PrinterTest, EmitWithSubs) { "};\n"); } +TEST_F(PrinterTest, EmitComments) { + { + Printer printer(output()); + printer.Emit(R"cc( + // Yes. + //~ No. + )cc"); + printer.Emit("//~ Not a raw string."); + } + + EXPECT_EQ(written(), "// Yes.\n//~ Not a raw string."); +} + TEST_F(PrinterTest, EmitWithVars) { { Printer printer(output()); From ff7ece3bcdf032922dea38b51037b9b7f5b430f5 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 10:39:57 -0800 Subject: [PATCH 15/43] Internal Change PiperOrigin-RevId: 495064902 --- kokoro/release/collect_all_artifacts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kokoro/release/collect_all_artifacts.sh b/kokoro/release/collect_all_artifacts.sh index f6f237195fb0..640c6d424dd0 100755 --- a/kokoro/release/collect_all_artifacts.sh +++ b/kokoro/release/collect_all_artifacts.sh @@ -6,7 +6,7 @@ set -ex cd $(dirname $0)/../.. # Initialize any submodules. -git config --global --add safe.directory ${KOKORO_GFILE_DIR}/github/protobuf +git config --global --add safe.directory * git submodule update --init --recursive # The directory with all resulting artifacts From ce17d70539e1df8b073944d96e55866841901e3d Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 11:23:52 -0800 Subject: [PATCH 16/43] Internal Change PiperOrigin-RevId: 495077928 --- kokoro/release/collect_all_artifacts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kokoro/release/collect_all_artifacts.sh b/kokoro/release/collect_all_artifacts.sh index 640c6d424dd0..330bb693c030 100755 --- a/kokoro/release/collect_all_artifacts.sh +++ b/kokoro/release/collect_all_artifacts.sh @@ -6,7 +6,7 @@ set -ex cd $(dirname $0)/../.. # Initialize any submodules. -git config --global --add safe.directory * +git config --global --add safe.directory '*' git submodule update --init --recursive # The directory with all resulting artifacts From e8449ee90e64a5a850832aa73b6d399c74a2e5a3 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 11:24:26 -0800 Subject: [PATCH 17/43] Remove the three-arg Printer::Sub constructor and switch to the new AnnotatedAt(). PiperOrigin-RevId: 495078112 --- src/google/protobuf/compiler/cpp/enum.cc | 59 ++++++++++++---------- src/google/protobuf/compiler/cpp/file.cc | 6 ++- src/google/protobuf/io/printer.h | 13 +---- src/google/protobuf/io/printer_unittest.cc | 4 +- 4 files changed, 40 insertions(+), 42 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/enum.cc b/src/google/protobuf/compiler/cpp/enum.cc index 7d03aa56e480..fdfcd4a6aa2e 100644 --- a/src/google/protobuf/compiler/cpp/enum.cc +++ b/src/google/protobuf/compiler/cpp/enum.cc @@ -54,6 +54,8 @@ namespace protobuf { namespace compiler { namespace cpp { namespace { +using Sub = ::google::protobuf::io::Printer::Sub; + absl::flat_hash_map EnumVars( const EnumDescriptor* enum_, const Options& options, const EnumValueDescriptor* min, const EnumValueDescriptor* max) { @@ -120,10 +122,12 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { auto v1 = p->WithVars(EnumVars(enum_, options_, limits_.min, limits_.max)); auto v2 = p->WithVars({ - {"Msg_Enum_Enum_MIN", - absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MIN"), enum_}, - {"Msg_Enum_Enum_MAX", - absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MAX"), enum_}, + Sub("Msg_Enum_Enum_MIN", + absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MIN")) + .AnnotatedAs(enum_), + Sub("Msg_Enum_Enum_MAX", + absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_MAX")) + .AnnotatedAs(enum_), }); p->Emit( { @@ -133,12 +137,10 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { const auto* value = enum_->value(i); p->Emit( { - { - "Msg_Enum_VALUE", + Sub("Msg_Enum_VALUE", absl::StrCat(p->LookupVar("Msg_Enum_"), - EnumValueName(value)), - value, - }, + EnumValueName(value))) + .AnnotatedAs(value), {"kNumber", Int32ToString(value->number())}, {"DEPRECATED", value->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM" @@ -151,7 +153,8 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { }}, // Only emit annotations for the $Msg_Enum$ used in the `enum` // definition. - {"Msg_Enum_annotated", p->LookupVar("Msg_Enum"), enum_}, + Sub("Msg_Enum_annotated", p->LookupVar("Msg_Enum")) + .AnnotatedAs(enum_), {"open_enum_sentinels", [&] { if (enum_->is_closed()) { @@ -183,13 +186,13 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { )cc"); if (generate_array_size_) { - p->Emit( - {{"Msg_Enum_Enum_ARRAYSIZE", - absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), "_ARRAYSIZE"), - enum_}}, - R"cc( - constexpr int $Msg_Enum_Enum_ARRAYSIZE$ = $kMax$ + 1; - )cc"); + p->Emit({Sub("Msg_Enum_Enum_ARRAYSIZE", + absl::StrCat(p->LookupVar("Msg_Enum_"), enum_->name(), + "_ARRAYSIZE")) + .AnnotatedAs(enum_)}, + R"cc( + constexpr int $Msg_Enum_Enum_ARRAYSIZE$ = $kMax$ + 1; + )cc"); } if (has_reflection_) { @@ -289,18 +292,15 @@ void EnumGenerator::GenerateGetEnumDescriptorSpecializations(io::Printer* p) { void EnumGenerator::GenerateSymbolImports(io::Printer* p) const { auto v = p->WithVars(EnumVars(enum_, options_, limits_.min, limits_.max)); - { - auto a = p->WithVars({{"Enum_annotated", p->LookupVar("Enum_"), enum_}}); - p->Emit(R"cc( - using $Enum_annotated$ = $Msg_Enum$; - )cc"); - } + p->Emit({Sub("Enum_", p->LookupVar("Enum_")).AnnotatedAs(enum_)}, R"cc( + using $Enum_$ = $Msg_Enum$; + )cc"); for (int j = 0; j < enum_->value_count(); ++j) { const auto* value = enum_->value(j); p->Emit( { - {"VALUE", EnumValueName(enum_->value(j)), value}, + Sub("VALUE", EnumValueName(enum_->value(j))).AnnotatedAs(value), {"DEPRECATED", value->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM" : ""}, }, @@ -311,8 +311,10 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const { p->Emit( { - {"Enum_MIN", absl::StrCat(enum_->name(), "_MIN"), enum_}, - {"Enum_MAX", absl::StrCat(enum_->name(), "_MAX"), enum_}, + Sub("Enum_MIN", absl::StrCat(enum_->name(), "_MIN")) + .AnnotatedAs(enum_), + Sub("Enum_MAX", absl::StrCat(enum_->name(), "_MAX")) + .AnnotatedAs(enum_), }, R"cc( static inline bool $Enum$_IsValid(int value) { @@ -324,7 +326,10 @@ void EnumGenerator::GenerateSymbolImports(io::Printer* p) const { if (generate_array_size_) { p->Emit( - {{"Enum_ARRAYSIZE", absl::StrCat(enum_->name(), "_ARRAYSIZE"), enum_}}, + { + Sub("Enum_ARRAYSIZE", absl::StrCat(enum_->name(), "_ARRAYSIZE")) + .AnnotatedAs(enum_), + }, R"cc( static constexpr int $Enum_ARRAYSIZE$ = $Msg_Enum$_$Enum$_ARRAYSIZE; )cc"); diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc index d566f78f5620..9e5dc18b9cad 100644 --- a/src/google/protobuf/compiler/cpp/file.cc +++ b/src/google/protobuf/compiler/cpp/file.cc @@ -69,6 +69,8 @@ namespace protobuf { namespace compiler { namespace cpp { namespace { +using Sub = ::google::protobuf::io::Printer::Sub; + absl::flat_hash_map FileVars( const FileDescriptor* file, const Options& options) { return { @@ -1121,7 +1123,7 @@ class FileGenerator::ForwardDeclarations { void Print(io::Printer* p, const Options& options) const { for (const auto& e : enums_) { - p->Emit({{"enum", e.first, e.second}}, R"cc( + p->Emit({Sub("enum", e.first).AnnotatedAs(e.second)}, R"cc( enum $enum$ : int; bool $enum$_IsValid(int value); )cc"); @@ -1131,7 +1133,7 @@ class FileGenerator::ForwardDeclarations { const Descriptor* desc = c.second; p->Emit( { - {"class", c.first, desc}, + Sub("class", c.first).AnnotatedAs(desc), {"default_type", DefaultInstanceType(desc, options)}, {"default_name", DefaultInstanceName(desc, options)}, }, diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h index 83c71e8811ee..db692bc09dce 100644 --- a/src/google/protobuf/io/printer.h +++ b/src/google/protobuf/io/printer.h @@ -905,18 +905,7 @@ class Printer::Sub { value_(std::forward(value)), annotation_(absl::nullopt) {} - // NOTE: This is an overload rather than taking optional - // with a default argument of nullopt, because we want to pick up - // AnnotationRecord's user-defined conversions. Because going from - // e.g. Descriptor* -> optional requires two user-defined - // conversions, this does not work. - template - Sub(Key&& key, Value&& value, AnnotationRecord annotation) - : key_(std::forward(key)), - value_(std::forward(value)), - annotation_(std::move(annotation)) {} - - Sub Annotate(AnnotationRecord annotation) && { + Sub AnnotatedAs(AnnotationRecord annotation) && { annotation_ = std::move(annotation); return std::move(*this); } diff --git a/src/google/protobuf/io/printer_unittest.cc b/src/google/protobuf/io/printer_unittest.cc index efcafc870835..4c199a70ea3e 100644 --- a/src/google/protobuf/io/printer_unittest.cc +++ b/src/google/protobuf/io/printer_unittest.cc @@ -717,7 +717,9 @@ TEST_F(PrinterTest, EmitThreeArgWithVars) { FakeAnnotationCollector collector; { Printer printer(output(), '$', &collector); - auto v = printer.WithVars({{"class", "Foo", "file.proto"}}); + auto v = printer.WithVars({ + Printer::Sub("class", "Foo").AnnotatedAs("file.proto"), + }); printer.Emit({{"f1", "x"}, {"f2", "y"}, {"f3", "z"}}, R"cc( class $class$ { From a12d23bcfb6033a182de2bf86db216b8ba81d651 Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Tue, 13 Dec 2022 11:44:28 -0800 Subject: [PATCH 18/43] Remove constexpr for non compliant C++11 builds with ABSL_ASSERT PiperOrigin-RevId: 495083659 --- src/google/protobuf/arena_align.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/arena_align.h b/src/google/protobuf/arena_align.h index 573caf3a9637..6b4718e482bc 100644 --- a/src/google/protobuf/arena_align.h +++ b/src/google/protobuf/arena_align.h @@ -145,7 +145,7 @@ struct ArenaAlign { constexpr size_t Ceil(size_t n) const { return (n + align - 1) & -align; } constexpr size_t Floor(size_t n) const { return (n & ~(align - 1)); } - constexpr size_t Padded(size_t n) const { + size_t Padded(size_t n) const { // TODO(mvels): there are direct callers of AllocateAligned() that violate // `size` being a multiple of `align`: that should be an error / assert. // ABSL_ASSERT(IsAligned(n)); From f483a68e84d953178ad80377c2dc95f391a6d9ea Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 12:48:27 -0800 Subject: [PATCH 19/43] Remove inlined strings from the fallback. The parser can already handle these fields. The fallback was dead code. PiperOrigin-RevId: 495100162 --- .../protobuf/generated_message_tctable_gen.cc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/google/protobuf/generated_message_tctable_gen.cc b/src/google/protobuf/generated_message_tctable_gen.cc index fd39199f1f87..e2c5deb5abab 100644 --- a/src/google/protobuf/generated_message_tctable_gen.cc +++ b/src/google/protobuf/generated_message_tctable_gen.cc @@ -336,8 +336,6 @@ std::vector FilterMiniParsedFields( std::vector generated_fallback_fields; for (const auto* field : fields) { - auto options = option_provider.GetForField(field); - bool handled = false; switch (field->type()) { case FieldDescriptor::TYPE_DOUBLE: @@ -354,20 +352,13 @@ std::vector FilterMiniParsedFields( case FieldDescriptor::TYPE_SINT64: case FieldDescriptor::TYPE_INT64: case FieldDescriptor::TYPE_ENUM: + case FieldDescriptor::TYPE_BYTES: + case FieldDescriptor::TYPE_STRING: // These are handled by MiniParse, so we don't need any generated // fallback code. handled = true; break; - case FieldDescriptor::TYPE_BYTES: - case FieldDescriptor::TYPE_STRING: - if (options.is_string_inlined) { - // TODO(b/198211897): support InilnedStringField. - handled = false; - } else { - handled = true; - } - break; case FieldDescriptor::TYPE_MESSAGE: case FieldDescriptor::TYPE_GROUP: From de28d0b09034cc202e662576b527e44bdcf794f3 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Tue, 13 Dec 2022 14:26:54 -0800 Subject: [PATCH 20/43] Removed python files from file_list and replace it with directory-based renames. PiperOrigin-RevId: 495126987 --- python/google/protobuf/protobuf_test.py | 85 +++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 python/google/protobuf/protobuf_test.py diff --git a/python/google/protobuf/protobuf_test.py b/python/google/protobuf/protobuf_test.py new file mode 100644 index 000000000000..4dd1884c63c6 --- /dev/null +++ b/python/google/protobuf/protobuf_test.py @@ -0,0 +1,85 @@ +# Protocol Buffers - Google's data interchange format +# Copyright 2008 Google Inc. All rights reserved. +# https://developers.google.com/protocol-buffers/ +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Tests for google.protobuf.python.""" +from __future__ import print_function +#from google3.testing.pybase import unittest +import google3 +from google.protobuf.internal import descriptor_database_test +from google.protobuf.internal import descriptor_pool_test +from google.protobuf.internal import descriptor_test +from google.protobuf.internal import generator_test +from google.protobuf.internal import message_factory_test +from google.protobuf.internal import message_test +from google.protobuf.internal import proto_builder_test +from google.protobuf.internal import reflection_test +from google.protobuf.internal import service_reflection_test +from google.protobuf.internal import symbol_database_test +from google.protobuf.internal import text_encoding_test +from google.protobuf.internal import text_format_test +from google.protobuf.internal import unknown_fields_test +from google.protobuf.internal import wire_format_test +from google.protobuf.internal import well_known_types_test +import sys +import unittest + +class ProtobufTests(unittest.TestCase): + + def testAll(self): + testModules = [ + descriptor_database_test, + descriptor_pool_test, + descriptor_test, + generator_test, + message_factory_test, + message_test, + proto_builder_test, + reflection_test, + service_reflection_test, + symbol_database_test, + text_encoding_test, + text_format_test, + unknown_fields_test, + wire_format_test, + well_known_types_test, + ] + testSuite = unittest.TestSuite() + for testModule in testModules: + testSuite.addTests( + unittest.defaultTestLoader.loadTestsFromModule( + testModule)) + testResult = unittest.TestResult() + testSuite.run(testResult) + print(testResult.errors, file=sys.stderr) + print(testResult.failures) + self.assertTrue(testResult.wasSuccessful()) + +if __name__ == '__main__': + unittest.main() From ce46f3e782ce03974446bc96bf44c1d8f80fe5ce Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 15:21:42 -0800 Subject: [PATCH 21/43] Re-format our `.inc` files to clang-format standards PiperOrigin-RevId: 495140846 --- src/google/protobuf/map_test.inc | 65 ++++++++------------ src/google/protobuf/message_unittest.inc | 64 ++++++++++--------- src/google/protobuf/wire_format_unittest.inc | 2 +- 3 files changed, 60 insertions(+), 71 deletions(-) diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc index 78a4808296ed..bf9d29a52d34 100644 --- a/src/google/protobuf/map_test.inc +++ b/src/google/protobuf/map_test.inc @@ -44,8 +44,6 @@ #include #include -#include "google/protobuf/stubs/logging.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/testing/file.h" #include "google/protobuf/descriptor.pb.h" #include @@ -54,6 +52,8 @@ #include "absl/base/casts.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "google/protobuf/stubs/logging.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/substitute.h" #include "google/protobuf/arena_test_util.h" #include "google/protobuf/descriptor.h" @@ -772,7 +772,6 @@ TEST_F(MapImplTest, InsertSingleBraceInitListTypeMismatch) { EXPECT_TRUE(result1.first == result2.first); } - TEST_F(MapImplTest, TryEmplace) { using ::testing::Pair; using ::testing::UnorderedElementsAre; @@ -2856,8 +2855,9 @@ TEST(GeneratedMapFieldTest, KeysValuesUnknownsWireFormat) { for (int k = i, j = 0; j < items; j++, k >>= kBitsOfIPerItem) { bool is_key = k & 0x1; bool is_value = !is_key && (k & 0x2); - wire_format.push_back(is_key ? kKeyTag - : is_value ? kValueTag : kJunkTag); + wire_format.push_back(is_key ? kKeyTag + : is_value ? kValueTag + : kJunkTag); char c = static_cast(k & mask) >> 2; // One char after the tag. wire_format.push_back(c); if (is_key) expected_key = static_cast(c); @@ -3628,41 +3628,26 @@ TEST(WireFormatForMapFieldTest, MapByteSizeDynamicMessage) { EXPECT_EQ(dynamic_message->ByteSizeLong(), duplicate_serialized_data.size()); // Force the map field to mark with map CLEAN - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int32_int32"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int32_int32"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int64_int64"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_uint32_uint32"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_uint64_uint64"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_sint32_sint32"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_sint64_sint64"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_fixed32_fixed32"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_fixed64_fixed64"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_sfixed32_sfixed32"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_sfixed64_sfixed64"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int32_float"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int32_double"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_bool_bool"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_string_string"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int32_bytes"), 2); - EXPECT_EQ(reflection_tester.MapSize( - *dynamic_message, "map_int32_enum"), 2); - EXPECT_EQ(reflection_tester.MapSize(*dynamic_message, "map_int32_foreign_message"), 2); + auto& msg = *dynamic_message; + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_int32"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_int32"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int64_int64"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_uint32_uint32"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_uint64_uint64"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_sint32_sint32"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_sint64_sint64"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_fixed32_fixed32"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_fixed64_fixed64"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_sfixed32_sfixed32"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_sfixed64_sfixed64"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_float"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_double"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_bool_bool"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_string_string"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_bytes"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_enum"), 2); + EXPECT_EQ(reflection_tester.MapSize(msg, "map_int32_foreign_message"), 2); + // The map field is marked as CLEAN, ByteSizeLong() will use map which do not // have duplicate keys to calculate. int size = dynamic_message->ByteSizeLong(); diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc index c3a7eeaecdf5..5595fc898a23 100644 --- a/src/google/protobuf/message_unittest.inc +++ b/src/google/protobuf/message_unittest.inc @@ -44,23 +44,23 @@ #include #include -#include "google/protobuf/message.h" -#include "absl/strings/cord.h" #ifndef _MSC_VER #include #endif #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include #include "google/protobuf/testing/googletest.h" #include +#include "google/protobuf/stubs/logging.h" +#include "absl/strings/cord.h" #include "absl/strings/substitute.h" #include "google/protobuf/arena.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/generated_message_reflection.h" +#include "google/protobuf/message.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/io_win32.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -1036,8 +1036,7 @@ TEST(MESSAGE_TEST_NAME, IsInitializedSplitBytestream) { fab.mutable_optional_message()->set_b(2); fc.mutable_optional_message()->set_c(3); - bytes = - fab.SerializePartialAsString() + fc.SerializePartialAsString(); + bytes = fab.SerializePartialAsString() + fc.SerializePartialAsString(); UNITTEST::TestRequiredForeign fconcatenated; EXPECT_TRUE(fconcatenated.ParsePartialFromString(bytes)); @@ -1150,11 +1149,16 @@ TEST(MESSAGE_TEST_NAME, CheckSerializationWhenInterleavedExtensions) { EXPECT_EQ(3, out_message.foo_three()); EXPECT_EQ(4, out_message.foo_four()); - EXPECT_EQ(1, out_message.GetExtension(UNITTEST::TestExtensionRangeSerialize::bar_one)); - EXPECT_EQ(2, out_message.GetExtension(UNITTEST::TestExtensionRangeSerialize::bar_two)); - EXPECT_EQ(3, out_message.GetExtension(UNITTEST::TestExtensionRangeSerialize::bar_three)); - EXPECT_EQ(4, out_message.GetExtension(UNITTEST::TestExtensionRangeSerialize::bar_four)); - EXPECT_EQ(5, out_message.GetExtension(UNITTEST::TestExtensionRangeSerialize::bar_five)); + EXPECT_EQ(1, out_message.GetExtension( + UNITTEST::TestExtensionRangeSerialize::bar_one)); + EXPECT_EQ(2, out_message.GetExtension( + UNITTEST::TestExtensionRangeSerialize::bar_two)); + EXPECT_EQ(3, out_message.GetExtension( + UNITTEST::TestExtensionRangeSerialize::bar_three)); + EXPECT_EQ(4, out_message.GetExtension( + UNITTEST::TestExtensionRangeSerialize::bar_four)); + EXPECT_EQ(5, out_message.GetExtension( + UNITTEST::TestExtensionRangeSerialize::bar_five)); } TEST(MESSAGE_TEST_NAME, PreservesFloatingPointNegative0) { @@ -1448,26 +1452,26 @@ TEST(MESSAGE_TEST_NAME, TestRepeatedStringParsers) { SCOPED_TRACE(size); const std::string value = sample.substr(0, size); for (int i = 0; i < descriptor->field_count(); ++i) { - const auto* field = descriptor->field(i); - SCOPED_TRACE(field->full_name()); - const auto encoded = EncodeStringValue(field->number(), sample) + - EncodeStringValue(field->number(), value); - // Check for different breaks in the input stream to test cases where - // the payload can be read and can't be read in one go. - for (size_t i = 1; i <= encoded.size(); ++i) { - TestInputStream input_stream(encoded, i); - - auto& obj = *arena.CreateMessage(&arena); - auto* ref = obj.GetReflection(); - EXPECT_TRUE(obj.ParseFromZeroCopyStream(&input_stream)); - if (field->is_repeated()) { - ASSERT_EQ(ref->FieldSize(obj, field), 2); - EXPECT_EQ(ref->GetRepeatedString(obj, field, 0), sample); - EXPECT_EQ(ref->GetRepeatedString(obj, field, 1), value); - } else { - EXPECT_EQ(ref->GetString(obj, field), value); - } + const auto* field = descriptor->field(i); + SCOPED_TRACE(field->full_name()); + const auto encoded = EncodeStringValue(field->number(), sample) + + EncodeStringValue(field->number(), value); + // Check for different breaks in the input stream to test cases where + // the payload can be read and can't be read in one go. + for (size_t i = 1; i <= encoded.size(); ++i) { + TestInputStream input_stream(encoded, i); + + auto& obj = *arena.CreateMessage(&arena); + auto* ref = obj.GetReflection(); + EXPECT_TRUE(obj.ParseFromZeroCopyStream(&input_stream)); + if (field->is_repeated()) { + ASSERT_EQ(ref->FieldSize(obj, field), 2); + EXPECT_EQ(ref->GetRepeatedString(obj, field, 0), sample); + EXPECT_EQ(ref->GetRepeatedString(obj, field, 1), value); + } else { + EXPECT_EQ(ref->GetString(obj, field), value); } + } } } } @@ -1481,7 +1485,7 @@ TEST(MESSAGE_TEST_NAME, TestRegressionOnParseFailureNotSettingHasBits) { message.set_optional_int32(17); single_field = message.SerializeAsString(); } - const auto validate_message = [] (auto& message) { + const auto validate_message = [](auto& message) { if (!message.has_optional_int32()) { EXPECT_EQ(message.optional_int32(), 0); } diff --git a/src/google/protobuf/wire_format_unittest.inc b/src/google/protobuf/wire_format_unittest.inc index 95cfe2564c54..94f34b524345 100644 --- a/src/google/protobuf/wire_format_unittest.inc +++ b/src/google/protobuf/wire_format_unittest.inc @@ -32,11 +32,11 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#include "google/protobuf/stubs/logging.h" #include #include "google/protobuf/testing/googletest.h" #include #include "absl/base/casts.h" +#include "google/protobuf/stubs/logging.h" #include "absl/strings/cord.h" #include "absl/strings/match.h" #include "google/protobuf/descriptor.h" From b97005bda54f7f2a4e9791e0a5750bf39338ce89 Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Tue, 13 Dec 2022 15:25:31 -0800 Subject: [PATCH 22/43] Add support for repeated Cord fields. PiperOrigin-RevId: 495141685 --- src/google/protobuf/repeated_field.cc | 61 +++++++++++++++ src/google/protobuf/repeated_field.h | 49 ++++++++++++ .../protobuf/repeated_field_unittest.cc | 74 +++++++++++++++++++ 3 files changed, 184 insertions(+) diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc index 44513c7fe9c3..3f20db1baa9c 100644 --- a/src/google/protobuf/repeated_field.cc +++ b/src/google/protobuf/repeated_field.cc @@ -48,6 +48,65 @@ namespace google { namespace protobuf { +template <> +PROTOBUF_EXPORT_TEMPLATE_DEFINE void RepeatedField::Clear() { + for (int i = 0; i < current_size_; i++) { + Mutable(i)->Clear(); + } + ExchangeCurrentSize(0); +} + +template <> +PROTOBUF_EXPORT_TEMPLATE_DEFINE size_t +RepeatedField::SpaceUsedExcludingSelfLong() const { + size_t result = current_size_ * sizeof(absl::Cord); + for (int i = 0; i < current_size_; i++) { + // Estimate only. + result += Get(i).size(); + } + return result; +} + +template <> +PROTOBUF_EXPORT_TEMPLATE_DEFINE void RepeatedField::Truncate( + int new_size) { + GOOGLE_ABSL_DCHECK_LE(new_size, current_size_); + while (current_size_ > new_size) { + RemoveLast(); + } +} + +template <> +PROTOBUF_EXPORT_TEMPLATE_DEFINE void RepeatedField::Resize( + int new_size, const absl::Cord& value) { + GOOGLE_ABSL_DCHECK_GE(new_size, 0); + if (new_size > current_size_) { + Reserve(new_size); + std::fill(&rep()->elements()[ExchangeCurrentSize(new_size)], + &rep()->elements()[new_size], value); + } else { + while (current_size_ > new_size) { + RemoveLast(); + } + } +} + +template <> +PROTOBUF_EXPORT_TEMPLATE_DEFINE void RepeatedField::MoveArray( + absl::Cord* to, absl::Cord* from, int size) { + for (int i = 0; i < size; i++) { + swap(to[i], from[i]); + } +} + +template <> +PROTOBUF_EXPORT_TEMPLATE_DEFINE void RepeatedField::CopyArray( + absl::Cord* to, const absl::Cord* from, int size) { + for (int i = 0; i < size; i++) { + to[i] = from[i]; + } +} + template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; @@ -55,6 +114,7 @@ template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField; namespace internal { template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; @@ -64,6 +124,7 @@ template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedIterator; } // namespace internal } // namespace protobuf diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 2f46f2b46e6a..f8a591778ae3 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -55,6 +55,7 @@ #include "google/protobuf/arena.h" #include "google/protobuf/port.h" #include "google/protobuf/stubs/logging.h" +#include "absl/strings/cord.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/port.h" #include "google/protobuf/repeated_ptr_field.h" @@ -139,6 +140,10 @@ class RepeatedIterator; // other words, everything except strings and nested Messages). Most users will // not ever use a RepeatedField directly; they will use the get-by-index, // set-by-index, and add accessors that are generated for all repeated fields. +// Actually, in addition to primitive types, we use RepeatedField for repeated +// Cords, because the Cord class is in fact just a reference-counted pointer. +// We have to specialize several methods in the Cord case to get the memory +// management right; e.g. swapping when appropriate, etc. template class RepeatedField final { static_assert( @@ -207,6 +212,7 @@ class RepeatedField final { void Reserve(int new_size); // Resizes the RepeatedField to a new, smaller size. This is O(1). + // Except for RepeatedField, for which it is O(size-new_size). void Truncate(int new_size); void AddAlreadyReserved(const Element& value); @@ -380,6 +386,7 @@ class RepeatedField final { // Moves the contents of |from| into |to|, possibly clobbering |from| in the // process. For primitive types this is just a memcpy(), but it could be // specialized for non-primitive types to, say, swap each element instead. + // In fact, we do exactly that for Cords. void MoveArray(Element* to, Element* from, int size); // Copies the elements of |from| into |to|. @@ -968,6 +975,10 @@ void RepeatedField::Reserve(int new_size) { // Likewise, we need to invoke destructors on the old array. InternalDeallocate(old_rep, old_total_size, false); + // Note that in the case of Cords, MoveArray() will have conveniently replaced + // all the Cords in the original array with empty values, which means that + // even if the old array was initial_space_, we don't have to worry about + // the old cords sticking around and holding on to memory. } template @@ -1008,6 +1019,40 @@ struct ElementCopier { } // namespace internal +// Cords should be swapped when possible and need explicit clearing, so provide +// some specializations for them. Some definitions are in the .cc file. + +template <> +inline void RepeatedField::RemoveLast() { + GOOGLE_ABSL_DCHECK_GT(current_size_, 0); + Mutable(size() - 1)->Clear(); + ExchangeCurrentSize(current_size_ - 1); +} + +template <> +void RepeatedField::Clear(); + +template <> +inline void RepeatedField::SwapElements(int index1, int index2) { + Mutable(index1)->swap(*Mutable(index2)); +} + +template <> +size_t RepeatedField::SpaceUsedExcludingSelfLong() const; + +template <> +void RepeatedField::Truncate(int new_size); + +template <> +void RepeatedField::Resize(int new_size, const absl::Cord& value); + +template <> +void RepeatedField::MoveArray(absl::Cord* to, absl::Cord* from, + int size); + +template <> +void RepeatedField::CopyArray(absl::Cord* to, + const absl::Cord* from, int size); // ------------------------------------------------------------------- @@ -1190,6 +1235,8 @@ extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE + RepeatedField; namespace internal { extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; @@ -1203,6 +1250,8 @@ extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedIterator; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE + RepeatedIterator; } // namespace internal } // namespace protobuf diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc index dd80e071afcd..ec858cf5a31e 100644 --- a/src/google/protobuf/repeated_field_unittest.cc +++ b/src/google/protobuf/repeated_field_unittest.cc @@ -956,6 +956,80 @@ TEST(RepeatedField, Truncate) { #endif } +TEST(RepeatedField, Cords) { + RepeatedField field; + + field.Add(absl::Cord("foo")); + field.Add(absl::Cord("bar")); + field.Add(absl::Cord("baz")); + field.Add(absl::Cord("moo")); + field.Add(absl::Cord("corge")); + + EXPECT_EQ("foo", std::string(field.Get(0))); + EXPECT_EQ("corge", std::string(field.Get(4))); + + // Test swap. Note: One of the swapped objects is using internal storage, + // the other is not. + RepeatedField field2; + field2.Add(absl::Cord("grault")); + field.Swap(&field2); + EXPECT_EQ(1, field.size()); + EXPECT_EQ("grault", std::string(field.Get(0))); + EXPECT_EQ(5, field2.size()); + EXPECT_EQ("foo", std::string(field2.Get(0))); + EXPECT_EQ("corge", std::string(field2.Get(4))); + + // Test SwapElements(). + field2.SwapElements(1, 3); + EXPECT_EQ("moo", std::string(field2.Get(1))); + EXPECT_EQ("bar", std::string(field2.Get(3))); + + // Make sure cords are cleared correctly. + field2.RemoveLast(); + EXPECT_TRUE(field2.Add()->empty()); + field2.Clear(); + EXPECT_TRUE(field2.Add()->empty()); +} + +TEST(RepeatedField, TruncateCords) { + RepeatedField field; + + field.Add(absl::Cord("foo")); + field.Add(absl::Cord("bar")); + field.Add(absl::Cord("baz")); + field.Add(absl::Cord("moo")); + EXPECT_EQ(4, field.size()); + + field.Truncate(3); + EXPECT_EQ(3, field.size()); + + field.Add(absl::Cord("corge")); + EXPECT_EQ(4, field.size()); + EXPECT_EQ("corge", std::string(field.Get(3))); + + // Truncating to the current size should be fine (no-op), but truncating + // to a larger size should crash. + field.Truncate(field.size()); +#ifdef PROTOBUF_HAS_DEATH_TEST + EXPECT_DEBUG_DEATH(field.Truncate(field.size() + 1), "new_size"); +#endif +} + +TEST(RepeatedField, ResizeCords) { + RepeatedField field; + field.Resize(2, absl::Cord("foo")); + EXPECT_EQ(2, field.size()); + field.Resize(5, absl::Cord("bar")); + EXPECT_EQ(5, field.size()); + field.Resize(4, absl::Cord("baz")); + ASSERT_EQ(4, field.size()); + EXPECT_EQ("foo", std::string(field.Get(0))); + EXPECT_EQ("foo", std::string(field.Get(1))); + EXPECT_EQ("bar", std::string(field.Get(2))); + EXPECT_EQ("bar", std::string(field.Get(3))); + field.Resize(0, absl::Cord("moo")); + EXPECT_TRUE(field.empty()); +} TEST(RepeatedField, ExtractSubrange) { // Exhaustively test every subrange in arrays of all sizes from 0 through 9. From 0dd27f9f93d11747c6e73044747323725fe64e23 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Tue, 13 Dec 2022 15:48:11 -0800 Subject: [PATCH 23/43] delete python/google/protobuf/protobuf_test.py which is dead PiperOrigin-RevId: 495146557 --- python/google/protobuf/protobuf_test.py | 85 ------------------------- 1 file changed, 85 deletions(-) delete mode 100644 python/google/protobuf/protobuf_test.py diff --git a/python/google/protobuf/protobuf_test.py b/python/google/protobuf/protobuf_test.py deleted file mode 100644 index 4dd1884c63c6..000000000000 --- a/python/google/protobuf/protobuf_test.py +++ /dev/null @@ -1,85 +0,0 @@ -# Protocol Buffers - Google's data interchange format -# Copyright 2008 Google Inc. All rights reserved. -# https://developers.google.com/protocol-buffers/ -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Tests for google.protobuf.python.""" -from __future__ import print_function -#from google3.testing.pybase import unittest -import google3 -from google.protobuf.internal import descriptor_database_test -from google.protobuf.internal import descriptor_pool_test -from google.protobuf.internal import descriptor_test -from google.protobuf.internal import generator_test -from google.protobuf.internal import message_factory_test -from google.protobuf.internal import message_test -from google.protobuf.internal import proto_builder_test -from google.protobuf.internal import reflection_test -from google.protobuf.internal import service_reflection_test -from google.protobuf.internal import symbol_database_test -from google.protobuf.internal import text_encoding_test -from google.protobuf.internal import text_format_test -from google.protobuf.internal import unknown_fields_test -from google.protobuf.internal import wire_format_test -from google.protobuf.internal import well_known_types_test -import sys -import unittest - -class ProtobufTests(unittest.TestCase): - - def testAll(self): - testModules = [ - descriptor_database_test, - descriptor_pool_test, - descriptor_test, - generator_test, - message_factory_test, - message_test, - proto_builder_test, - reflection_test, - service_reflection_test, - symbol_database_test, - text_encoding_test, - text_format_test, - unknown_fields_test, - wire_format_test, - well_known_types_test, - ] - testSuite = unittest.TestSuite() - for testModule in testModules: - testSuite.addTests( - unittest.defaultTestLoader.loadTestsFromModule( - testModule)) - testResult = unittest.TestResult() - testSuite.run(testResult) - print(testResult.errors, file=sys.stderr) - print(testResult.failures) - self.assertTrue(testResult.wasSuccessful()) - -if __name__ == '__main__': - unittest.main() From bfed218c71bc6104e9a4cbff901f3bd43f7f1fee Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Tue, 13 Dec 2022 16:12:03 -0800 Subject: [PATCH 24/43] Internal changes PiperOrigin-RevId: 495152163 --- conformance/conformance_test_runner.cc | 24 ++++---- python/google/protobuf/pyext/descriptor.cc | 4 +- .../protobuf/pyext/descriptor_database.cc | 15 +++-- .../google/protobuf/pyext/extension_dict.cc | 1 - python/google/protobuf/pyext/map_container.cc | 27 +++++---- python/google/protobuf/pyext/message.cc | 43 +++++++------- python/google/protobuf/pyext/message.h | 56 +++++++++---------- .../pyext/repeated_composite_container.cc | 1 - .../pyext/repeated_scalar_container.cc | 33 ++++++----- python/google/protobuf/pyext/safe_numerics.h | 2 +- src/google/protobuf/io/coded_stream.cc | 2 +- src/google/protobuf/io/printer.cc | 6 +- 12 files changed, 106 insertions(+), 108 deletions(-) diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc index 9c40b866c086..cb308f74d609 100644 --- a/conformance/conformance_test_runner.cc +++ b/conformance/conformance_test_runner.cc @@ -77,7 +77,7 @@ using std::vector; #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) -#define GOOGLE_CHECK_SYSCALL(call) \ +#define CHECK_SYSCALL(call) \ if (call < 0) { \ perror(#call " " __FILE__ ":" TOSTRING(__LINE__)); \ exit(1); \ @@ -289,22 +289,22 @@ void ForkPipeRunner::SpawnTestProgram() { if (pid) { // Parent. - GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0])); - GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1])); + CHECK_SYSCALL(close(toproc_pipe_fd[0])); + CHECK_SYSCALL(close(fromproc_pipe_fd[1])); write_fd_ = toproc_pipe_fd[1]; read_fd_ = fromproc_pipe_fd[0]; child_pid_ = pid; } else { // Child. - GOOGLE_CHECK_SYSCALL(close(STDIN_FILENO)); - GOOGLE_CHECK_SYSCALL(close(STDOUT_FILENO)); - GOOGLE_CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO)); - GOOGLE_CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO)); + CHECK_SYSCALL(close(STDIN_FILENO)); + CHECK_SYSCALL(close(STDOUT_FILENO)); + CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO)); + CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO)); - GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0])); - GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1])); - GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[1])); - GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[0])); + CHECK_SYSCALL(close(toproc_pipe_fd[0])); + CHECK_SYSCALL(close(fromproc_pipe_fd[1])); + CHECK_SYSCALL(close(toproc_pipe_fd[1])); + CHECK_SYSCALL(close(fromproc_pipe_fd[0])); std::unique_ptr executable(new char[executable_.size() + 1]); memcpy(executable.get(), executable_.c_str(), executable_.size()); @@ -319,7 +319,7 @@ void ForkPipeRunner::SpawnTestProgram() { } argv.push_back(nullptr); // Never returns. - GOOGLE_CHECK_SYSCALL(execv(executable.get(), const_cast(argv.data()))); + CHECK_SYSCALL(execv(executable.get(), const_cast(argv.data()))); } } diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc index f6db77a160fe..aa364744b818 100644 --- a/python/google/protobuf/pyext/descriptor.cc +++ b/python/google/protobuf/pyext/descriptor.cc @@ -32,6 +32,8 @@ #include "google/protobuf/pyext/descriptor.h" +#include "google/protobuf/stubs/logging.h" + #define PY_SSIZE_T_CLEAN #include #include @@ -404,7 +406,7 @@ PyObject* NewInternedDescriptor(PyTypeObject* type, std::unordered_map::iterator it = interned_descriptors->find(descriptor); if (it != interned_descriptors->end()) { - GOOGLE_DCHECK(Py_TYPE(it->second) == type); + GOOGLE_ABSL_DCHECK(Py_TYPE(it->second) == type); Py_INCREF(it->second); return it->second; } diff --git a/python/google/protobuf/pyext/descriptor_database.cc b/python/google/protobuf/pyext/descriptor_database.cc index 24689cdf90bc..f25443842ee5 100644 --- a/python/google/protobuf/pyext/descriptor_database.cc +++ b/python/google/protobuf/pyext/descriptor_database.cc @@ -37,8 +37,8 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/stubs/logging.h" #include "google/protobuf/pyext/message.h" #include "google/protobuf/pyext/scoped_pyobject_ptr.h" @@ -62,7 +62,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor, // Expected error: item was simply not found. PyErr_Clear(); } else { - GOOGLE_LOG(ERROR) << "DescriptorDatabase method raised an error"; + GOOGLE_ABSL_LOG(ERROR) << "DescriptorDatabase method raised an error"; PyErr_Print(); } return false; @@ -86,7 +86,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor, ScopedPyObjectPtr serialized_pb( PyObject_CallMethod(py_descriptor, "SerializeToString", nullptr)); if (serialized_pb == nullptr) { - GOOGLE_LOG(ERROR) + GOOGLE_ABSL_LOG(ERROR) << "DescriptorDatabase method did not return a FileDescriptorProto"; PyErr_Print(); return false; @@ -94,14 +94,14 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor, char* str; Py_ssize_t len; if (PyBytes_AsStringAndSize(serialized_pb.get(), &str, &len) < 0) { - GOOGLE_LOG(ERROR) + GOOGLE_ABSL_LOG(ERROR) << "DescriptorDatabase method did not return a FileDescriptorProto"; PyErr_Print(); return false; } FileDescriptorProto file_proto; if (!file_proto.ParseFromArray(str, len)) { - GOOGLE_LOG(ERROR) + GOOGLE_ABSL_LOG(ERROR) << "DescriptorDatabase method did not return a FileDescriptorProto"; return false; } @@ -172,9 +172,8 @@ bool PyDescriptorDatabase::FindAllExtensionNumbers( ScopedPyObjectPtr item(PySequence_GetItem(py_list.get(), i)); item_value = PyLong_AsLong(item.get()); if (item_value < 0) { - GOOGLE_LOG(ERROR) - << "FindAllExtensionNumbers method did not return " - << "valid extension numbers."; + GOOGLE_ABSL_LOG(ERROR) << "FindAllExtensionNumbers method did not return " + << "valid extension numbers."; PyErr_Print(); return false; } diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc index 287a4656174a..04a3d9131dd0 100644 --- a/python/google/protobuf/pyext/extension_dict.cc +++ b/python/google/protobuf/pyext/extension_dict.cc @@ -37,7 +37,6 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/dynamic_message.h" diff --git a/python/google/protobuf/pyext/map_container.cc b/python/google/protobuf/pyext/map_container.cc index 45c1f05483bb..7d690c1e91ca 100644 --- a/python/google/protobuf/pyext/map_container.cc +++ b/python/google/protobuf/pyext/map_container.cc @@ -36,7 +36,6 @@ #include #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/map.h" #include "google/protobuf/map_field.h" #include "google/protobuf/message.h" @@ -125,27 +124,27 @@ static bool PythonToMapKey(MapContainer* self, PyObject* obj, MapKey* key) { self->parent_field_descriptor->message_type()->map_key(); switch (field_descriptor->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - GOOGLE_CHECK_GET_INT32(obj, value, false); + PROTOBUF_CHECK_GET_INT32(obj, value, false); key->SetInt32Value(value); break; } case FieldDescriptor::CPPTYPE_INT64: { - GOOGLE_CHECK_GET_INT64(obj, value, false); + PROTOBUF_CHECK_GET_INT64(obj, value, false); key->SetInt64Value(value); break; } case FieldDescriptor::CPPTYPE_UINT32: { - GOOGLE_CHECK_GET_UINT32(obj, value, false); + PROTOBUF_CHECK_GET_UINT32(obj, value, false); key->SetUInt32Value(value); break; } case FieldDescriptor::CPPTYPE_UINT64: { - GOOGLE_CHECK_GET_UINT64(obj, value, false); + PROTOBUF_CHECK_GET_UINT64(obj, value, false); key->SetUInt64Value(value); break; } case FieldDescriptor::CPPTYPE_BOOL: { - GOOGLE_CHECK_GET_BOOL(obj, value, false); + PROTOBUF_CHECK_GET_BOOL(obj, value, false); key->SetBoolValue(value); break; } @@ -231,37 +230,37 @@ static bool PythonToMapValueRef(MapContainer* self, PyObject* obj, self->parent_field_descriptor->message_type()->map_value(); switch (field_descriptor->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - GOOGLE_CHECK_GET_INT32(obj, value, false); + PROTOBUF_CHECK_GET_INT32(obj, value, false); value_ref->SetInt32Value(value); return true; } case FieldDescriptor::CPPTYPE_INT64: { - GOOGLE_CHECK_GET_INT64(obj, value, false); + PROTOBUF_CHECK_GET_INT64(obj, value, false); value_ref->SetInt64Value(value); return true; } case FieldDescriptor::CPPTYPE_UINT32: { - GOOGLE_CHECK_GET_UINT32(obj, value, false); + PROTOBUF_CHECK_GET_UINT32(obj, value, false); value_ref->SetUInt32Value(value); return true; } case FieldDescriptor::CPPTYPE_UINT64: { - GOOGLE_CHECK_GET_UINT64(obj, value, false); + PROTOBUF_CHECK_GET_UINT64(obj, value, false); value_ref->SetUInt64Value(value); return true; } case FieldDescriptor::CPPTYPE_FLOAT: { - GOOGLE_CHECK_GET_FLOAT(obj, value, false); + PROTOBUF_CHECK_GET_FLOAT(obj, value, false); value_ref->SetFloatValue(value); return true; } case FieldDescriptor::CPPTYPE_DOUBLE: { - GOOGLE_CHECK_GET_DOUBLE(obj, value, false); + PROTOBUF_CHECK_GET_DOUBLE(obj, value, false); value_ref->SetDoubleValue(value); return true; } case FieldDescriptor::CPPTYPE_BOOL: { - GOOGLE_CHECK_GET_BOOL(obj, value, false); + PROTOBUF_CHECK_GET_BOOL(obj, value, false); value_ref->SetBoolValue(value); return true; } @@ -274,7 +273,7 @@ static bool PythonToMapValueRef(MapContainer* self, PyObject* obj, return true; } case FieldDescriptor::CPPTYPE_ENUM: { - GOOGLE_CHECK_GET_INT32(obj, value, false); + PROTOBUF_CHECK_GET_INT32(obj, value, false); if (allow_unknown_enum_values) { value_ref->SetEnumValue(value); return true; diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc index 108dd52ff266..ab9e9433ae84 100644 --- a/python/google/protobuf/pyext/message.cc +++ b/python/google/protobuf/pyext/message.cc @@ -42,6 +42,7 @@ #include #include +#include "google/protobuf/stubs/logging.h" #include "absl/strings/match.h" #ifndef PyVarObject_HEAD_INIT @@ -51,7 +52,6 @@ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #endif #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/message.h" @@ -252,10 +252,10 @@ static PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) { if (WKT_classes == nullptr) { ScopedPyObjectPtr well_known_types( PyImport_ImportModule(PROTOBUF_PYTHON_INTERNAL ".well_known_types")); - GOOGLE_DCHECK(well_known_types != nullptr); + GOOGLE_ABSL_DCHECK(well_known_types != nullptr); WKT_classes = PyObject_GetAttrString(well_known_types.get(), "WKTBASES"); - GOOGLE_DCHECK(WKT_classes != nullptr); + GOOGLE_ABSL_DCHECK(WKT_classes != nullptr); } PyObject* well_known_class = PyDict_GetItemString( @@ -680,8 +680,8 @@ bool IsValidUTF8(PyObject* obj) { bool AllowInvalidUTF8(const FieldDescriptor* field) { return false; } PyObject* CheckString(PyObject* arg, const FieldDescriptor* descriptor) { - GOOGLE_DCHECK(descriptor->type() == FieldDescriptor::TYPE_STRING || - descriptor->type() == FieldDescriptor::TYPE_BYTES); + GOOGLE_ABSL_DCHECK(descriptor->type() == FieldDescriptor::TYPE_STRING || + descriptor->type() == FieldDescriptor::TYPE_BYTES); if (descriptor->type() == FieldDescriptor::TYPE_STRING) { if (!PyBytes_Check(arg) && !PyUnicode_Check(arg)) { FormatTypeError(arg, "bytes, unicode"); @@ -784,7 +784,7 @@ bool CheckFieldBelongsToMessage(const FieldDescriptor* field_descriptor, namespace cmessage { PyMessageFactory* GetFactoryForMessage(CMessage* message) { - GOOGLE_DCHECK(PyObject_TypeCheck(message, CMessage_Type)); + GOOGLE_ABSL_DCHECK(PyObject_TypeCheck(message, CMessage_Type)); return reinterpret_cast(Py_TYPE(message))->py_message_factory; } @@ -856,7 +856,7 @@ int AssureWritable(CMessage* self) { } // Toplevel messages are always mutable. - GOOGLE_DCHECK(self->parent); + GOOGLE_ABSL_DCHECK(self->parent); if (AssureWritable(self->parent) == -1) { return -1; @@ -988,7 +988,7 @@ int DeleteRepeatedField( } Arena* arena = Arena::InternalGetArenaForAllocation(message); - GOOGLE_DCHECK_EQ(arena, nullptr) + GOOGLE_ABSL_DCHECK_EQ(arena, nullptr) << "python protobuf is expected to be allocated from heap"; // Remove items, starting from the end. for (; length > to; length--) { @@ -1001,9 +1001,10 @@ int DeleteRepeatedField( // // To work around a debug hardening (PROTOBUF_FORCE_COPY_IN_RELEASE), // explicitly use UnsafeArenaReleaseLast. To not break rare use cases where - // arena is used, we fallback to ReleaseLast (but GOOGLE_DCHECK to find/fix it). + // arena is used, we fallback to ReleaseLast (but GOOGLE_ABSL_DCHECK to find/fix + // it). // - // Note that arena is likely null and GOOGLE_DCHECK and ReleaesLast might be + // Note that arena is likely null and GOOGLE_ABSL_DCHECK and ReleaesLast might be // redundant. The current approach takes extra cautious path not to disrupt // production. Message* sub_message = @@ -1268,8 +1269,8 @@ static void Dealloc(CMessage* self) { PyObject_ClearWeakRefs(reinterpret_cast(self)); } // At this point all dependent objects have been removed. - GOOGLE_DCHECK(!self->child_submessages || self->child_submessages->empty()); - GOOGLE_DCHECK(!self->composite_fields || self->composite_fields->empty()); + GOOGLE_ABSL_DCHECK(!self->child_submessages || self->child_submessages->empty()); + GOOGLE_ABSL_DCHECK(!self->composite_fields || self->composite_fields->empty()); delete self->child_submessages; delete self->composite_fields; if (self->unknown_field_set) { @@ -1714,7 +1715,7 @@ static PyObject* InternalSerializeToString( coded_out.SetSerializationDeterministic(deterministic); } self->message->SerializeWithCachedSizes(&coded_out); - GOOGLE_CHECK(!coded_out.HadError()); + GOOGLE_ABSL_CHECK(!coded_out.HadError()); return result; } @@ -2256,37 +2257,37 @@ int InternalSetNonOneofScalar( switch (field_descriptor->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - GOOGLE_CHECK_GET_INT32(arg, value, -1); + PROTOBUF_CHECK_GET_INT32(arg, value, -1); reflection->SetInt32(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_INT64: { - GOOGLE_CHECK_GET_INT64(arg, value, -1); + PROTOBUF_CHECK_GET_INT64(arg, value, -1); reflection->SetInt64(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_UINT32: { - GOOGLE_CHECK_GET_UINT32(arg, value, -1); + PROTOBUF_CHECK_GET_UINT32(arg, value, -1); reflection->SetUInt32(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_UINT64: { - GOOGLE_CHECK_GET_UINT64(arg, value, -1); + PROTOBUF_CHECK_GET_UINT64(arg, value, -1); reflection->SetUInt64(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_FLOAT: { - GOOGLE_CHECK_GET_FLOAT(arg, value, -1); + PROTOBUF_CHECK_GET_FLOAT(arg, value, -1); reflection->SetFloat(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_DOUBLE: { - GOOGLE_CHECK_GET_DOUBLE(arg, value, -1); + PROTOBUF_CHECK_GET_DOUBLE(arg, value, -1); reflection->SetDouble(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_BOOL: { - GOOGLE_CHECK_GET_BOOL(arg, value, -1); + PROTOBUF_CHECK_GET_BOOL(arg, value, -1); reflection->SetBool(message, field_descriptor, value); break; } @@ -2298,7 +2299,7 @@ int InternalSetNonOneofScalar( break; } case FieldDescriptor::CPPTYPE_ENUM: { - GOOGLE_CHECK_GET_INT32(arg, value, -1); + PROTOBUF_CHECK_GET_INT32(arg, value, -1); if (reflection->SupportsUnknownEnumValues()) { reflection->SetEnumValue(message, field_descriptor, value); } else { diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h index 1b0172f9a4c9..7da52df75eba 100644 --- a/python/google/protobuf/pyext/message.h +++ b/python/google/protobuf/pyext/message.h @@ -287,46 +287,46 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg); #define FIELD_IS_REPEATED(field_descriptor) \ ((field_descriptor)->label() == FieldDescriptor::LABEL_REPEATED) -#define GOOGLE_CHECK_GET_INT32(arg, value, err) \ - int32_t value; \ - if (!CheckAndGetInteger(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_INT32(arg, value, err) \ + int32_t value; \ + if (!CheckAndGetInteger(arg, &value)) { \ + return err; \ } -#define GOOGLE_CHECK_GET_INT64(arg, value, err) \ - int64_t value; \ - if (!CheckAndGetInteger(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_INT64(arg, value, err) \ + int64_t value; \ + if (!CheckAndGetInteger(arg, &value)) { \ + return err; \ } -#define GOOGLE_CHECK_GET_UINT32(arg, value, err) \ - uint32_t value; \ - if (!CheckAndGetInteger(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_UINT32(arg, value, err) \ + uint32_t value; \ + if (!CheckAndGetInteger(arg, &value)) { \ + return err; \ } -#define GOOGLE_CHECK_GET_UINT64(arg, value, err) \ - uint64_t value; \ - if (!CheckAndGetInteger(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_UINT64(arg, value, err) \ + uint64_t value; \ + if (!CheckAndGetInteger(arg, &value)) { \ + return err; \ } -#define GOOGLE_CHECK_GET_FLOAT(arg, value, err) \ - float value; \ - if (!CheckAndGetFloat(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_FLOAT(arg, value, err) \ + float value; \ + if (!CheckAndGetFloat(arg, &value)) { \ + return err; \ } -#define GOOGLE_CHECK_GET_DOUBLE(arg, value, err) \ - double value; \ - if (!CheckAndGetDouble(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_DOUBLE(arg, value, err) \ + double value; \ + if (!CheckAndGetDouble(arg, &value)) { \ + return err; \ } -#define GOOGLE_CHECK_GET_BOOL(arg, value, err) \ - bool value; \ - if (!CheckAndGetBool(arg, &value)) { \ - return err; \ +#define PROTOBUF_CHECK_GET_BOOL(arg, value, err) \ + bool value; \ + if (!CheckAndGetBool(arg, &value)) { \ + return err; \ } #define FULL_MODULE_NAME "google.protobuf.pyext._message" diff --git a/python/google/protobuf/pyext/repeated_composite_container.cc b/python/google/protobuf/pyext/repeated_composite_container.cc index e9a479469b45..cac8f1af6965 100644 --- a/python/google/protobuf/pyext/repeated_composite_container.cc +++ b/python/google/protobuf/pyext/repeated_composite_container.cc @@ -35,7 +35,6 @@ #include -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/message.h" diff --git a/python/google/protobuf/pyext/repeated_scalar_container.cc b/python/google/protobuf/pyext/repeated_scalar_container.cc index 57746dcf7705..b19f00491db4 100644 --- a/python/google/protobuf/pyext/repeated_scalar_container.cc +++ b/python/google/protobuf/pyext/repeated_scalar_container.cc @@ -38,7 +38,6 @@ #include #include "google/protobuf/stubs/common.h" -#include "google/protobuf/stubs/logging.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/dynamic_message.h" #include "google/protobuf/message.h" @@ -109,37 +108,37 @@ static int AssignItem(PyObject* pself, Py_ssize_t index, PyObject* arg) { switch (field_descriptor->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - GOOGLE_CHECK_GET_INT32(arg, value, -1); + PROTOBUF_CHECK_GET_INT32(arg, value, -1); reflection->SetRepeatedInt32(message, field_descriptor, index, value); break; } case FieldDescriptor::CPPTYPE_INT64: { - GOOGLE_CHECK_GET_INT64(arg, value, -1); + PROTOBUF_CHECK_GET_INT64(arg, value, -1); reflection->SetRepeatedInt64(message, field_descriptor, index, value); break; } case FieldDescriptor::CPPTYPE_UINT32: { - GOOGLE_CHECK_GET_UINT32(arg, value, -1); + PROTOBUF_CHECK_GET_UINT32(arg, value, -1); reflection->SetRepeatedUInt32(message, field_descriptor, index, value); break; } case FieldDescriptor::CPPTYPE_UINT64: { - GOOGLE_CHECK_GET_UINT64(arg, value, -1); + PROTOBUF_CHECK_GET_UINT64(arg, value, -1); reflection->SetRepeatedUInt64(message, field_descriptor, index, value); break; } case FieldDescriptor::CPPTYPE_FLOAT: { - GOOGLE_CHECK_GET_FLOAT(arg, value, -1); + PROTOBUF_CHECK_GET_FLOAT(arg, value, -1); reflection->SetRepeatedFloat(message, field_descriptor, index, value); break; } case FieldDescriptor::CPPTYPE_DOUBLE: { - GOOGLE_CHECK_GET_DOUBLE(arg, value, -1); + PROTOBUF_CHECK_GET_DOUBLE(arg, value, -1); reflection->SetRepeatedDouble(message, field_descriptor, index, value); break; } case FieldDescriptor::CPPTYPE_BOOL: { - GOOGLE_CHECK_GET_BOOL(arg, value, -1); + PROTOBUF_CHECK_GET_BOOL(arg, value, -1); reflection->SetRepeatedBool(message, field_descriptor, index, value); break; } @@ -151,7 +150,7 @@ static int AssignItem(PyObject* pself, Py_ssize_t index, PyObject* arg) { break; } case FieldDescriptor::CPPTYPE_ENUM: { - GOOGLE_CHECK_GET_INT32(arg, value, -1); + PROTOBUF_CHECK_GET_INT32(arg, value, -1); if (reflection->SupportsUnknownEnumValues()) { reflection->SetRepeatedEnumValue(message, field_descriptor, index, value); @@ -334,37 +333,37 @@ PyObject* Append(RepeatedScalarContainer* self, PyObject* item) { const Reflection* reflection = message->GetReflection(); switch (field_descriptor->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - GOOGLE_CHECK_GET_INT32(item, value, nullptr); + PROTOBUF_CHECK_GET_INT32(item, value, nullptr); reflection->AddInt32(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_INT64: { - GOOGLE_CHECK_GET_INT64(item, value, nullptr); + PROTOBUF_CHECK_GET_INT64(item, value, nullptr); reflection->AddInt64(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_UINT32: { - GOOGLE_CHECK_GET_UINT32(item, value, nullptr); + PROTOBUF_CHECK_GET_UINT32(item, value, nullptr); reflection->AddUInt32(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_UINT64: { - GOOGLE_CHECK_GET_UINT64(item, value, nullptr); + PROTOBUF_CHECK_GET_UINT64(item, value, nullptr); reflection->AddUInt64(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_FLOAT: { - GOOGLE_CHECK_GET_FLOAT(item, value, nullptr); + PROTOBUF_CHECK_GET_FLOAT(item, value, nullptr); reflection->AddFloat(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_DOUBLE: { - GOOGLE_CHECK_GET_DOUBLE(item, value, nullptr); + PROTOBUF_CHECK_GET_DOUBLE(item, value, nullptr); reflection->AddDouble(message, field_descriptor, value); break; } case FieldDescriptor::CPPTYPE_BOOL: { - GOOGLE_CHECK_GET_BOOL(item, value, nullptr); + PROTOBUF_CHECK_GET_BOOL(item, value, nullptr); reflection->AddBool(message, field_descriptor, value); break; } @@ -376,7 +375,7 @@ PyObject* Append(RepeatedScalarContainer* self, PyObject* item) { break; } case FieldDescriptor::CPPTYPE_ENUM: { - GOOGLE_CHECK_GET_INT32(item, value, nullptr); + PROTOBUF_CHECK_GET_INT32(item, value, nullptr); if (reflection->SupportsUnknownEnumValues()) { reflection->AddEnumValue(message, field_descriptor, value); } else { diff --git a/python/google/protobuf/pyext/safe_numerics.h b/python/google/protobuf/pyext/safe_numerics.h index a3bcfc370d20..418473bf28cd 100644 --- a/python/google/protobuf/pyext/safe_numerics.h +++ b/python/google/protobuf/pyext/safe_numerics.h @@ -152,7 +152,7 @@ inline bool IsValidNumericCast(Source source) { // (this is static_asserted), though this could be supported if necessary. template inline Dest checked_numeric_cast(Source source) { - GOOGLE_CHECK(IsValidNumericCast(source)); + GOOGLE_ABSL_CHECK(IsValidNumericCast(source)); return static_cast(source); } diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc index f47c3fd09b42..ef623ea281c1 100644 --- a/src/google/protobuf/io/coded_stream.cc +++ b/src/google/protobuf/io/coded_stream.cc @@ -324,7 +324,7 @@ bool CodedInputStream::ReadStringFallback(std::string* buffer, int size) { } bool CodedInputStream::ReadCord(absl::Cord* output, int size) { - GOOGLE_DCHECK_NE(output, nullptr); + GOOGLE_ABSL_DCHECK_NE(output, nullptr); // security: size is often user-supplied if (size < 0) { diff --git a/src/google/protobuf/io/printer.cc b/src/google/protobuf/io/printer.cc index ace56b124431..5ec2fafdb0ba 100644 --- a/src/google/protobuf/io/printer.cc +++ b/src/google/protobuf/io/printer.cc @@ -254,7 +254,7 @@ Printer::Format Printer::TokenizeFormat(absl::string_view format_string, } #if 0 // Use this to aid debugging tokenization. - GOOGLE_LOG(INFO) << "--- " << format.lines.size() << " lines"; + LOG(INFO) << "--- " << format.lines.size() << " lines"; for (size_t i = 0; i < format.lines.size(); ++i) { const auto& line = format.lines[i]; @@ -263,9 +263,9 @@ Printer::Format Printer::TokenizeFormat(absl::string_view format_string, absl::StrAppendFormat(&log_line, " %s\"%s\"", chunk.is_var ? "$" : "", absl::CHexEscape(chunk.text)); } - GOOGLE_LOG(INFO) << log_line; + LOG(INFO) << log_line; } - GOOGLE_LOG(INFO) << "---"; + LOG(INFO) << "---"; #endif return format; From c658e27529ccf4a000724ab3622f1b807c85449b Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 13 Dec 2022 16:22:46 -0800 Subject: [PATCH 25/43] Make emptyList public and mark the public EMPTY field as deprecated. PiperOrigin-RevId: 495154966 --- .../java/com/google/protobuf/LazyStringArrayList.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java b/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java index a2de6f9cfeb0..fdf39e3498ac 100644 --- a/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java +++ b/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java @@ -67,12 +67,17 @@ public class LazyStringArrayList extends AbstractProtobufList EMPTY_LIST.makeImmutable(); } - static LazyStringArrayList emptyList() { + /** Returns an empty immutable {@code LazyStringArrayList} instance */ + public static LazyStringArrayList emptyList() { return EMPTY_LIST; } - // For compatibility with older runtimes. - public static final LazyStringList EMPTY = EMPTY_LIST; + /** + * For compatibility with older runtimes. + * + * @deprecated use {@link emptyList()} instead + */ + @Deprecated public static final LazyStringList EMPTY = EMPTY_LIST; private final List list; From 8661e45075427162a962998279959bbabd11e0c8 Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Tue, 13 Dec 2022 17:04:53 -0800 Subject: [PATCH 26/43] Add UnknownFieldSet::SerializeToCord() PiperOrigin-RevId: 495164471 --- src/google/protobuf/unknown_field_set.cc | 13 ++++ src/google/protobuf/unknown_field_set.h | 1 + .../protobuf/unknown_field_set_unittest.cc | 75 +++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc index c155bca6210f..129476bb8eaf 100644 --- a/src/google/protobuf/unknown_field_set.cc +++ b/src/google/protobuf/unknown_field_set.cc @@ -255,6 +255,19 @@ bool UnknownFieldSet::SerializeToCodedStream( google::protobuf::internal::WireFormat::SerializeUnknownFields(*this, output); return !output->HadError(); } + +bool UnknownFieldSet::SerializeToCord(absl::Cord* output) const { + const size_t size = + google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(*this); + io::CordOutputStream cord_output_stream(size); + { + io::CodedOutputStream coded_output_stream(&cord_output_stream); + if (!SerializeToCodedStream(&coded_output_stream)) return false; + } + *output = cord_output_stream.Consume(); + return true; +} + void UnknownField::Delete() { switch (type()) { case UnknownField::TYPE_LENGTH_DELIMITED: diff --git a/src/google/protobuf/unknown_field_set.h b/src/google/protobuf/unknown_field_set.h index e914e78b889e..e5d8a9579aa0 100644 --- a/src/google/protobuf/unknown_field_set.h +++ b/src/google/protobuf/unknown_field_set.h @@ -179,6 +179,7 @@ class PROTOBUF_EXPORT UnknownFieldSet { // Serialization. bool SerializeToString(std::string* output) const; + bool SerializeToCord(absl::Cord* output) const; bool SerializeToCodedStream(io::CodedOutputStream* output) const; static const UnknownFieldSet& default_instance(); diff --git a/src/google/protobuf/unknown_field_set_unittest.cc b/src/google/protobuf/unknown_field_set_unittest.cc index 3a04b6b31e03..e7233947f52a 100644 --- a/src/google/protobuf/unknown_field_set_unittest.cc +++ b/src/google/protobuf/unknown_field_set_unittest.cc @@ -64,6 +64,7 @@ namespace google { namespace protobuf { using internal::WireFormat; +using ::testing::ElementsAre; class UnknownFieldSetTest : public testing::Test { protected: @@ -678,6 +679,80 @@ TEST_F(UnknownFieldSetTest, DeleteByNumber) { } #undef MAKE_VECTOR +TEST_F(UnknownFieldSetTest, SerializeToString) { + UnknownFieldSet field_set; + field_set.AddVarint(3, 3); + field_set.AddVarint(4, 4); + field_set.AddVarint(1, -1); + field_set.AddVarint(2, -2); + field_set.AddLengthDelimited(44, "str"); + field_set.AddLengthDelimited(44, "byv"); + field_set.AddFixed32(7, 7); + field_set.AddFixed64(8, 8); + + UnknownFieldSet* group_field_set = field_set.AddGroup(46); + group_field_set->AddVarint(47, 1024); + group_field_set = field_set.AddGroup(46); + group_field_set->AddVarint(47, 2048); + + unittest::TestAllTypes message; + std::string serialized_message; + ASSERT_TRUE(field_set.SerializeToString(&serialized_message)); + ASSERT_TRUE(message.ParseFromString(serialized_message)); + + EXPECT_EQ(message.optional_int32(), -1); + EXPECT_EQ(message.optional_int64(), -2); + EXPECT_EQ(message.optional_uint32(), 3); + EXPECT_EQ(message.optional_uint64(), 4); + EXPECT_EQ(message.optional_fixed32(), 7); + EXPECT_EQ(message.optional_fixed64(), 8); + EXPECT_EQ(message.repeated_string(0), "str"); + EXPECT_EQ(message.repeated_string(1), "byv"); + EXPECT_EQ(message.repeatedgroup(0).a(), 1024); + EXPECT_EQ(message.repeatedgroup(1).a(), 2048); +} + +TEST_F(UnknownFieldSetTest, SerializeToCodedStream_TestPackedTypes) { + UnknownFieldSet field_set; + field_set.AddVarint(90, -1); + field_set.AddVarint(90, -2); + field_set.AddVarint(90, -3); + field_set.AddVarint(90, -4); + field_set.AddVarint(93, 5); + field_set.AddVarint(93, 6); + field_set.AddVarint(93, 7); + + unittest::TestPackedTypes message; + std::string serialized_message; + { + io::StringOutputStream string_output(&serialized_message); + io::CodedOutputStream coded_output(&string_output); + ASSERT_TRUE(field_set.SerializeToCodedStream(&coded_output)); + } + ASSERT_TRUE(message.ParseFromString(serialized_message)); + EXPECT_THAT(message.packed_int32(), ElementsAre(-1, -2, -3, -4)); + EXPECT_THAT(message.packed_uint64(), ElementsAre(5, 6, 7)); +} + +TEST_F(UnknownFieldSetTest, SerializeToCord_TestPackedTypes) { + UnknownFieldSet field_set; + field_set.AddVarint(90, -1); + field_set.AddVarint(90, -2); + field_set.AddVarint(90, -3); + field_set.AddVarint(90, -4); + field_set.AddVarint(93, 5); + field_set.AddVarint(93, 6); + field_set.AddVarint(93, 7); + + absl::Cord cord; + ASSERT_TRUE(field_set.SerializeToCord(&cord)); + + unittest::TestPackedTypes message; + ASSERT_TRUE(message.ParseFromCord(cord)); + EXPECT_THAT(message.packed_int32(), ElementsAre(-1, -2, -3, -4)); + EXPECT_THAT(message.packed_uint64(), ElementsAre(5, 6, 7)); +} + } // namespace } // namespace protobuf From 14e579436fb53d0e8271c4d26d3d88c394d96454 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 06:55:02 -0800 Subject: [PATCH 27/43] Internal change PiperOrigin-RevId: 495302416 --- src/google/protobuf/text_format.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc index 16ac146aab79..6fa11d9ea027 100644 --- a/src/google/protobuf/text_format.cc +++ b/src/google/protobuf/text_format.cc @@ -174,7 +174,6 @@ void PerformAbslStringify(const Message& message, // TODO(b/249835002): consider using the single line version for short TextFormat::Printer printer; printer.SetExpandAny(true); - printer.SetInsertSilentMarker(true); printer.SetRedactDebugString(true); printer.SetRandomizeDebugString(true); std::string result; From edcbebaf8a89d3cf08026965a1f8fb169ed5b78e Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Wed, 14 Dec 2022 09:47:21 -0800 Subject: [PATCH 28/43] Split arena_impl.h into serial_arena.h and thread_safe_arena.h PiperOrigin-RevId: 495340630 --- src/file_lists.cmake | 6 +- src/google/protobuf/BUILD.bazel | 7 +- src/google/protobuf/arena.cc | 3 +- src/google/protobuf/arena.h | 3 +- .../protobuf/{arena_impl.h => serial_arena.h} | 243 +------------- src/google/protobuf/thread_safe_arena.h | 308 ++++++++++++++++++ 6 files changed, 328 insertions(+), 242 deletions(-) rename src/google/protobuf/{arena_impl.h => serial_arena.h} (60%) create mode 100644 src/google/protobuf/thread_safe_arena.h diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 1e326bcc8a33..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -103,7 +103,6 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_config.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.h @@ -170,6 +169,7 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h @@ -178,6 +178,7 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h @@ -227,7 +228,6 @@ set(libprotobuf_lite_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_allocation_policy.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_cleanup.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_config.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h ${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h @@ -258,6 +258,7 @@ set(libprotobuf_lite_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/port_undef.inc ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h @@ -265,6 +266,7 @@ set(libprotobuf_lite_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_macros.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/thread_safe_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h ) diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel index 4902ce2d70f7..9581b911ed75 100644 --- a/src/google/protobuf/BUILD.bazel +++ b/src/google/protobuf/BUILD.bazel @@ -244,8 +244,9 @@ cc_library( hdrs = [ "arena.h", "arena_config.h", - "arena_impl.h", "arenaz_sampler.h", + "serial_arena.h", + "thread_safe_arena.h", ], include_prefix = "google/protobuf", visibility = [ @@ -284,7 +285,6 @@ cc_library( hdrs = [ "any.h", "arena.h", - "arena_impl.h", "arenastring.h", "arenaz_sampler.h", "endian.h", @@ -308,6 +308,8 @@ cc_library( "port.h", "repeated_field.h", "repeated_ptr_field.h", + "serial_arena.h", + "thread_safe_arena.h", "wire_format_lite.h", ], copts = COPTS + select({ @@ -326,6 +328,7 @@ cc_library( # In Bazel 6.0+, these will be `interface_deps`: deps = [ ":arena", + ":arena_align", ":arena_config", "//src/google/protobuf/io", "//src/google/protobuf/stubs:lite", diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index 2a624145c582..2ba9ff820d6f 100644 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -40,9 +40,10 @@ #include "absl/base/attributes.h" #include "absl/synchronization/mutex.h" #include "google/protobuf/arena_allocation_policy.h" -#include "google/protobuf/arena_impl.h" #include "google/protobuf/arenaz_sampler.h" #include "google/protobuf/port.h" +#include "google/protobuf/serial_arena.h" +#include "google/protobuf/thread_safe_arena.h" #ifdef ADDRESS_SANITIZER diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index 8a7d1b4804c3..06acc3d1b47a 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -51,8 +51,9 @@ using type_info = ::type_info; #include #include "google/protobuf/arena_align.h" #include "google/protobuf/arena_config.h" -#include "google/protobuf/arena_impl.h" #include "google/protobuf/port.h" +#include "google/protobuf/serial_arena.h" +#include "google/protobuf/thread_safe_arena.h" // Must be included last. #include "google/protobuf/port_def.inc" diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/serial_arena.h similarity index 60% rename from src/google/protobuf/arena_impl.h rename to src/google/protobuf/serial_arena.h index 0d39c19c889e..171483b72d66 100644 --- a/src/google/protobuf/arena_impl.h +++ b/src/google/protobuf/serial_arena.h @@ -1,5 +1,5 @@ // Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. +// Copyright 2022 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without @@ -27,32 +27,27 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// This file defines the internal class SerialArena -// This file defines an Arena allocator for better allocation performance. - -#ifndef GOOGLE_PROTOBUF_ARENA_IMPL_H__ -#define GOOGLE_PROTOBUF_ARENA_IMPL_H__ +#ifndef GOOGLE_PROTOBUF_SERIAL_ARENA_H__ +#define GOOGLE_PROTOBUF_SERIAL_ARENA_H__ #include #include -#include -#include #include #include +#include #include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/logging.h" #include "absl/numeric/bits.h" -#include "absl/strings/cord.h" -#include "absl/synchronization/mutex.h" #include "google/protobuf/arena_align.h" -#include "google/protobuf/arena_allocation_policy.h" #include "google/protobuf/arena_cleanup.h" #include "google/protobuf/arena_config.h" #include "google/protobuf/arenaz_sampler.h" #include "google/protobuf/port.h" - // Must be included last. #include "google/protobuf/port_def.inc" @@ -382,234 +377,10 @@ class PROTOBUF_EXPORT SerialArena { ArenaAlignDefault::Ceil(sizeof(ArenaBlock)); }; -// This class provides the core Arena memory allocation library. Different -// implementations only need to implement the public interface below. -// Arena is not a template type as that would only be useful if all protos -// in turn would be templates, which will/cannot happen. However separating -// the memory allocation part from the cruft of the API users expect we can -// use #ifdef the select the best implementation based on hardware / OS. -class PROTOBUF_EXPORT ThreadSafeArena { - public: - ThreadSafeArena(); - - ThreadSafeArena(char* mem, size_t size); - - explicit ThreadSafeArena(void* mem, size_t size, - const AllocationPolicy& policy); - - // All protos have pointers back to the arena hence Arena must have - // pointer stability. - ThreadSafeArena(const ThreadSafeArena&) = delete; - ThreadSafeArena& operator=(const ThreadSafeArena&) = delete; - ThreadSafeArena(ThreadSafeArena&&) = delete; - ThreadSafeArena& operator=(ThreadSafeArena&&) = delete; - - // Destructor deletes all owned heap allocated objects, and destructs objects - // that have non-trivial destructors, except for proto2 message objects whose - // destructors can be skipped. Also, frees all blocks except the initial block - // if it was passed in. - ~ThreadSafeArena(); - - uint64_t Reset(); - - uint64_t SpaceAllocated() const; - uint64_t SpaceUsed() const; - - template - void* AllocateAligned(size_t n) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - return arena->AllocateAligned(n); - } else { - return AllocateAlignedFallback(n); - } - } - - void ReturnArrayMemory(void* p, size_t size) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - arena->ReturnArrayMemory(p, size); - } - } - - // This function allocates n bytes if the common happy case is true and - // returns true. Otherwise does nothing and returns false. This strange - // semantics is necessary to allow callers to program functions that only - // have fallback function calls in tail position. This substantially improves - // code for the happy path. - PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned(size_t n, void** out) { - SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { - return arena->MaybeAllocateAligned(n, out); - } - return false; - } - - void* AllocateAlignedWithCleanup(size_t n, size_t align, - void (*destructor)(void*)); - - // Add object pointer and cleanup function pointer to the list. - void AddCleanup(void* elem, void (*cleanup)(void*)); - - private: - friend class ArenaBenchmark; - friend class TcParser; - friend class SerialArena; - friend struct SerialArenaChunkHeader; - static uint64_t GetNextLifeCycleId(); - - class SerialArenaChunk; - - // Returns a new SerialArenaChunk that has {id, serial} at slot 0. It may - // grow based on "prev_num_slots". - static SerialArenaChunk* NewSerialArenaChunk(uint32_t prev_capacity, void* id, - SerialArena* serial); - static SerialArenaChunk* SentrySerialArenaChunk(); - - // Returns the first ArenaBlock* for the first SerialArena. If users provide - // one, use it if it's acceptable. Otherwise returns a sentry block. - ArenaBlock* FirstBlock(void* buf, size_t size); - // Same as the above but returns a valid block if "policy" is not default. - ArenaBlock* FirstBlock(void* buf, size_t size, - const AllocationPolicy& policy); - - // Adds SerialArena to the chunked list. May create a new chunk. - void AddSerialArena(void* id, SerialArena* serial); - - // Members are declared here to track sizeof(ThreadSafeArena) and hotness - // centrally. - - // Unique for each arena. Changes on Reset(). - uint64_t tag_and_id_ = 0; - - TaggedAllocationPolicyPtr alloc_policy_; // Tagged pointer to AllocPolicy. - ThreadSafeArenaStatsHandle arena_stats_; - - // Adding a new chunk to head_ must be protected by mutex_. - absl::Mutex mutex_; - // Pointer to a linked list of SerialArenaChunk. - std::atomic head_{nullptr}; - - void* first_owner_; - // Must be declared after alloc_policy_; otherwise, it may lose info on - // user-provided initial block. - SerialArena first_arena_; - - static_assert(std::is_trivially_destructible{}, - "SerialArena needs to be trivially destructible."); - - const AllocationPolicy* AllocPolicy() const { return alloc_policy_.get(); } - void InitializeWithPolicy(const AllocationPolicy& policy); - void* AllocateAlignedWithCleanupFallback(size_t n, size_t align, - void (*destructor)(void*)); - - void Init(); - - // Delete or Destruct all objects owned by the arena. - void CleanupList(); - - inline void CacheSerialArena(SerialArena* serial) { - thread_cache().last_serial_arena = serial; - thread_cache().last_lifecycle_id_seen = tag_and_id_; - } - - PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(SerialArena** arena) { - // If this thread already owns a block in this arena then try to use that. - // This fast path optimizes the case where multiple threads allocate from - // the same arena. - ThreadCache* tc = &thread_cache(); - if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) { - *arena = tc->last_serial_arena; - return true; - } - return false; - } - - // Finds SerialArena or creates one if not found. When creating a new one, - // create a big enough block to accommodate n bytes. - SerialArena* GetSerialArenaFallback(size_t n); - - template - void* AllocateAlignedFallback(size_t n); - - // Executes callback function over SerialArenaChunk. Passes const - // SerialArenaChunk*. - template - void WalkConstSerialArenaChunk(Functor fn) const; - - // Executes callback function over SerialArenaChunk. - template - void WalkSerialArenaChunk(Functor fn); - - // Executes callback function over SerialArena in chunked list in reverse - // chronological order. Passes const SerialArena*. - template - void PerConstSerialArenaInChunk(Functor fn) const; - - // Releases all memory except the first block which it returns. The first - // block might be owned by the user and thus need some extra checks before - // deleting. - SerialArena::Memory Free(size_t* space_allocated); - -#ifdef _MSC_VER -#pragma warning(disable : 4324) -#endif - struct alignas(kCacheAlignment) ThreadCache { - // Number of per-thread lifecycle IDs to reserve. Must be power of two. - // To reduce contention on a global atomic, each thread reserves a batch of - // IDs. The following number is calculated based on a stress test with - // ~6500 threads all frequently allocating a new arena. - static constexpr size_t kPerThreadIds = 256; - // Next lifecycle ID available to this thread. We need to reserve a new - // batch, if `next_lifecycle_id & (kPerThreadIds - 1) == 0`. - uint64_t next_lifecycle_id{0}; - // The ThreadCache is considered valid as long as this matches the - // lifecycle_id of the arena being used. - uint64_t last_lifecycle_id_seen{static_cast(-1)}; - SerialArena* last_serial_arena{nullptr}; - }; - - // Lifecycle_id can be highly contended variable in a situation of lots of - // arena creation. Make sure that other global variables are not sharing the - // cacheline. -#ifdef _MSC_VER -#pragma warning(disable : 4324) -#endif - using LifecycleId = uint64_t; - ABSL_CONST_INIT alignas( - kCacheAlignment) static std::atomic lifecycle_id_; -#if defined(PROTOBUF_NO_THREADLOCAL) - // iOS does not support __thread keyword so we use a custom thread local - // storage class we implemented. - static ThreadCache& thread_cache(); -#elif defined(PROTOBUF_USE_DLLS) - // Thread local variables cannot be exposed through DLL interface but we can - // wrap them in static functions. - static ThreadCache& thread_cache(); -#else - ABSL_CONST_INIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_; - static ThreadCache& thread_cache() { return thread_cache_; } -#endif - - public: - // kBlockHeaderSize is sizeof(ArenaBlock), aligned up to the nearest multiple - // of 8 to protect the invariant that pos is always at a multiple of 8. - static constexpr size_t kBlockHeaderSize = SerialArena::kBlockHeaderSize; - static constexpr size_t kSerialArenaSize = - (sizeof(SerialArena) + 7) & static_cast(-8); - static constexpr size_t kAllocPolicySize = - ArenaAlignDefault::Ceil(sizeof(AllocationPolicy)); - static constexpr size_t kMaxCleanupNodeSize = 16; - static_assert(kBlockHeaderSize % 8 == 0, - "kBlockHeaderSize must be a multiple of 8."); - static_assert(kSerialArenaSize % 8 == 0, - "kSerialArenaSize must be a multiple of 8."); -}; - } // namespace internal } // namespace protobuf } // namespace google #include "google/protobuf/port_undef.inc" -#endif // GOOGLE_PROTOBUF_ARENA_IMPL_H__ +#endif // GOOGLE_PROTOBUF_SERIAL_ARENA_H__ diff --git a/src/google/protobuf/thread_safe_arena.h b/src/google/protobuf/thread_safe_arena.h new file mode 100644 index 000000000000..a5ef1c2d993c --- /dev/null +++ b/src/google/protobuf/thread_safe_arena.h @@ -0,0 +1,308 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2022 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// This file defines the internal class ThreadSafeArena + +#ifndef GOOGLE_PROTOBUF_THREAD_SAFE_ARENA_H__ +#define GOOGLE_PROTOBUF_THREAD_SAFE_ARENA_H__ + +#include +#include +#include +#include +#include + +#include "absl/synchronization/mutex.h" +#include "google/protobuf/arena_align.h" +#include "google/protobuf/arena_allocation_policy.h" +#include "google/protobuf/arena_cleanup.h" +#include "google/protobuf/arena_config.h" +#include "google/protobuf/arenaz_sampler.h" +#include "google/protobuf/port.h" +#include "google/protobuf/serial_arena.h" + +// Must be included last. +#include "google/protobuf/port_def.inc" + +namespace google { +namespace protobuf { +namespace internal { + +// Tag type used to invoke the constructor of message-owned arena. +// Only message-owned arenas use this constructor for creation. +// Such constructors are internal implementation details of the library. +struct MessageOwned { + explicit MessageOwned() = default; +}; + +// This class provides the core Arena memory allocation library. Different +// implementations only need to implement the public interface below. +// Arena is not a template type as that would only be useful if all protos +// in turn would be templates, which will/cannot happen. However separating +// the memory allocation part from the cruft of the API users expect we can +// use #ifdef the select the best implementation based on hardware / OS. +class PROTOBUF_EXPORT ThreadSafeArena { + public: + ThreadSafeArena(); + + // Constructor solely used by message-owned arena. + explicit ThreadSafeArena(internal::MessageOwned); + + ThreadSafeArena(char* mem, size_t size); + + explicit ThreadSafeArena(void* mem, size_t size, + const AllocationPolicy& policy); + + // All protos have pointers back to the arena hence Arena must have + // pointer stability. + ThreadSafeArena(const ThreadSafeArena&) = delete; + ThreadSafeArena& operator=(const ThreadSafeArena&) = delete; + ThreadSafeArena(ThreadSafeArena&&) = delete; + ThreadSafeArena& operator=(ThreadSafeArena&&) = delete; + + // Destructor deletes all owned heap allocated objects, and destructs objects + // that have non-trivial destructors, except for proto2 message objects whose + // destructors can be skipped. Also, frees all blocks except the initial block + // if it was passed in. + ~ThreadSafeArena(); + + uint64_t Reset(); + + uint64_t SpaceAllocated() const; + uint64_t SpaceUsed() const; + + template + void* AllocateAligned(size_t n) { + SerialArena* arena; + if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + return arena->AllocateAligned(n); + } else { + return AllocateAlignedFallback(n); + } + } + + void ReturnArrayMemory(void* p, size_t size) { + SerialArena* arena; + if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + arena->ReturnArrayMemory(p, size); + } + } + + // This function allocates n bytes if the common happy case is true and + // returns true. Otherwise does nothing and returns false. This strange + // semantics is necessary to allow callers to program functions that only + // have fallback function calls in tail position. This substantially improves + // code for the happy path. + PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned(size_t n, void** out) { + SerialArena* arena; + if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + return arena->MaybeAllocateAligned(n, out); + } + return false; + } + + void* AllocateAlignedWithCleanup(size_t n, size_t align, + void (*destructor)(void*)); + + // Add object pointer and cleanup function pointer to the list. + void AddCleanup(void* elem, void (*cleanup)(void*)); + + // Checks whether this arena is message-owned. + PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const { + return tag_and_id_ & kMessageOwnedArena; + } + + private: + friend class ArenaBenchmark; + friend class TcParser; + friend class SerialArena; + friend struct SerialArenaChunkHeader; + static uint64_t GetNextLifeCycleId(); + + class SerialArenaChunk; + + // Returns a new SerialArenaChunk that has {id, serial} at slot 0. It may + // grow based on "prev_num_slots". + static SerialArenaChunk* NewSerialArenaChunk(uint32_t prev_capacity, void* id, + SerialArena* serial); + static SerialArenaChunk* SentrySerialArenaChunk(); + + // Returns the first ArenaBlock* for the first SerialArena. If users provide + // one, use it if it's acceptable. Otherwise returns a sentry block. + ArenaBlock* FirstBlock(void* buf, size_t size); + // Same as the above but returns a valid block if "policy" is not default. + ArenaBlock* FirstBlock(void* buf, size_t size, + const AllocationPolicy& policy); + + // Adds SerialArena to the chunked list. May create a new chunk. + void AddSerialArena(void* id, SerialArena* serial); + + // Members are declared here to track sizeof(ThreadSafeArena) and hotness + // centrally. + + // Unique for each arena. Changes on Reset(). + uint64_t tag_and_id_ = 0; + + TaggedAllocationPolicyPtr alloc_policy_; // Tagged pointer to AllocPolicy. + ThreadSafeArenaStatsHandle arena_stats_; + + // Adding a new chunk to head_ must be protected by mutex_. + absl::Mutex mutex_; + // Pointer to a linked list of SerialArenaChunk. + std::atomic head_{nullptr}; + + void* first_owner_; + // Must be declared after alloc_policy_; otherwise, it may lose info on + // user-provided initial block. + SerialArena first_arena_; + + // The LSB of tag_and_id_ indicates if the arena is message-owned. + enum : uint64_t { kMessageOwnedArena = 1 }; + + static_assert(std::is_trivially_destructible{}, + "SerialArena needs to be trivially destructible."); + + const AllocationPolicy* AllocPolicy() const { return alloc_policy_.get(); } + void InitializeWithPolicy(const AllocationPolicy& policy); + void* AllocateAlignedWithCleanupFallback(size_t n, size_t align, + void (*destructor)(void*)); + + void Init(); + + // Delete or Destruct all objects owned by the arena. + void CleanupList(); + + inline void CacheSerialArena(SerialArena* serial) { + if (!IsMessageOwned()) { + thread_cache().last_serial_arena = serial; + thread_cache().last_lifecycle_id_seen = tag_and_id_; + } + } + + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(SerialArena** arena) { + // If this thread already owns a block in this arena then try to use that. + // This fast path optimizes the case where multiple threads allocate from + // the same arena. + ThreadCache* tc = &thread_cache(); + if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) { + *arena = tc->last_serial_arena; + return true; + } + return false; + } + + // Finds SerialArena or creates one if not found. When creating a new one, + // create a big enough block to accommodate n bytes. + SerialArena* GetSerialArenaFallback(size_t n); + + template + void* AllocateAlignedFallback(size_t n); + + // Executes callback function over SerialArenaChunk. Passes const + // SerialArenaChunk*. + template + void WalkConstSerialArenaChunk(Functor fn) const; + + // Executes callback function over SerialArenaChunk. + template + void WalkSerialArenaChunk(Functor fn); + + // Executes callback function over SerialArena in chunked list in reverse + // chronological order. Passes const SerialArena*. + template + void PerConstSerialArenaInChunk(Functor fn) const; + + // Releases all memory except the first block which it returns. The first + // block might be owned by the user and thus need some extra checks before + // deleting. + SerialArena::Memory Free(size_t* space_allocated); + +#ifdef _MSC_VER +#pragma warning(disable : 4324) +#endif + struct alignas(kCacheAlignment) ThreadCache { + // Number of per-thread lifecycle IDs to reserve. Must be power of two. + // To reduce contention on a global atomic, each thread reserves a batch of + // IDs. The following number is calculated based on a stress test with + // ~6500 threads all frequently allocating a new arena. + static constexpr size_t kPerThreadIds = 256; + // Next lifecycle ID available to this thread. We need to reserve a new + // batch, if `next_lifecycle_id & (kPerThreadIds - 1) == 0`. + uint64_t next_lifecycle_id{0}; + // The ThreadCache is considered valid as long as this matches the + // lifecycle_id of the arena being used. + uint64_t last_lifecycle_id_seen{static_cast(-1)}; + SerialArena* last_serial_arena{nullptr}; + }; + + // Lifecycle_id can be highly contended variable in a situation of lots of + // arena creation. Make sure that other global variables are not sharing the + // cacheline. +#ifdef _MSC_VER +#pragma warning(disable : 4324) +#endif + using LifecycleId = uint64_t; + ABSL_CONST_INIT alignas( + kCacheAlignment) static std::atomic lifecycle_id_; +#if defined(PROTOBUF_NO_THREADLOCAL) + // iOS does not support __thread keyword so we use a custom thread local + // storage class we implemented. + static ThreadCache& thread_cache(); +#elif defined(PROTOBUF_USE_DLLS) + // Thread local variables cannot be exposed through DLL interface but we can + // wrap them in static functions. + static ThreadCache& thread_cache(); +#else + ABSL_CONST_INIT static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_; + static ThreadCache& thread_cache() { return thread_cache_; } +#endif + + public: + // kBlockHeaderSize is sizeof(ArenaBlock), aligned up to the nearest multiple + // of 8 to protect the invariant that pos is always at a multiple of 8. + static constexpr size_t kBlockHeaderSize = SerialArena::kBlockHeaderSize; + static constexpr size_t kSerialArenaSize = + (sizeof(SerialArena) + 7) & static_cast(-8); + static constexpr size_t kAllocPolicySize = + ArenaAlignDefault::Ceil(sizeof(AllocationPolicy)); + static constexpr size_t kMaxCleanupNodeSize = 16; + static_assert(kBlockHeaderSize % 8 == 0, + "kBlockHeaderSize must be a multiple of 8."); + static_assert(kSerialArenaSize % 8 == 0, + "kSerialArenaSize must be a multiple of 8."); +}; + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include "google/protobuf/port_undef.inc" + +#endif // GOOGLE_PROTOBUF_THREAD_SAFE_ARENA_H__ From c997d818ddf85317f923682858e857f20267fd17 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 17:53:51 +0000 Subject: [PATCH 29/43] Auto-generate files after cl/495340630 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From 6b87d6f44594a7f993ba9532ab6040bfa7fe2965 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 14 Dec 2022 10:36:53 -0800 Subject: [PATCH 30/43] Add a deprecated message and enum option for restoring legacy json field validation. See https://github.com/protocolbuffers/protobuf/pull/10750 for more information. PiperOrigin-RevId: 495354518 --- php/ext/google/protobuf/php-upb.c | 245 +++++++++++++------------ php/ext/google/protobuf/php-upb.h | 36 ++++ ruby/ext/google/protobuf_c/ruby-upb.c | 10 +- ruby/ext/google/protobuf_c/ruby-upb.h | 36 ++++ src/file_lists.cmake | 2 +- src/google/protobuf/descriptor.pb.cc | 255 ++++++++++++++++---------- src/google/protobuf/descriptor.pb.h | 74 ++++++++ src/google/protobuf/descriptor.proto | 20 ++ 8 files changed, 462 insertions(+), 216 deletions(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index a2cb3b5859d8..f09792b4fa1f 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -978,18 +978,19 @@ static const upb_MiniTableSub google_protobuf_MessageOptions_submsgs[1] = { {.submsg = &google_protobuf_UninterpretedOption_msg_init}, }; -static const upb_MiniTableField google_protobuf_MessageOptions__fields[5] = { +static const upb_MiniTableField google_protobuf_MessageOptions__fields[6] = { {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_MessageOptions_msg_init = { &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], - 16, 5, kUpb_ExtMode_Extendable, 3, 255, 0, + 16, 6, kUpb_ExtMode_Extendable, 3, 255, 0, }; static const upb_MiniTableSub google_protobuf_FieldOptions_submsgs[3] = { @@ -1033,16 +1034,17 @@ static const upb_MiniTableSub google_protobuf_EnumOptions_submsgs[1] = { {.submsg = &google_protobuf_UninterpretedOption_msg_init}, }; -static const upb_MiniTableField google_protobuf_EnumOptions__fields[3] = { +static const upb_MiniTableField google_protobuf_EnumOptions__fields[4] = { {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_EnumOptions_msg_init = { &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], - UPB_SIZE(8, 16), 3, kUpb_ExtMode_Extendable, 0, 255, 0, + UPB_SIZE(8, 16), 4, kUpb_ExtMode_Extendable, 0, 255, 0, }; static const upb_MiniTableSub google_protobuf_EnumValueOptions_submsgs[1] = { @@ -1305,7 +1307,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = { * regenerated. */ -static const char descriptor[7820] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', +static const char descriptor[7996] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '\"', 'M', '\n', '\021', 'F', 'i', 'l', 'e', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'S', 'e', 't', '\022', '8', '\n', '\004', 'f', 'i', 'l', 'e', '\030', '\001', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', @@ -1495,7 +1497,7 @@ static const char descriptor[7820] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', ' 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', ':', '\n', '\014', 'O', 'p', 't', 'i', 'm', 'i', 'z', 'e', 'M', 'o', 'd', 'e', '\022', '\t', '\n', '\005', 'S', 'P', 'E', 'E', 'D', '\020', '\001', '\022', '\r', '\n', '\t', 'C', 'O', 'D', 'E', '_', 'S', 'I', 'Z', 'E', '\020', '\002', '\022', '\020', '\n', '\014', 'L', 'I', 'T', 'E', '_', 'R', 'U', 'N', 'T', 'I', 'M', 'E', '\020', '\003', '*', '\t', '\010', -'\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '&', '\020', '\'', '\"', '\343', '\002', '\n', '\016', 'M', 'e', 's', 's', 'a', 'g', +'\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '&', '\020', '\'', '\"', '\273', '\003', '\n', '\016', 'M', 'e', 's', 's', 'a', 'g', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '<', '\n', '\027', 'm', 'e', 's', 's', 'a', 'g', 'e', '_', 's', 'e', 't', '_', 'w', 'i', 'r', 'e', '_', 'f', 'o', 'r', 'm', 'a', 't', '\030', '\001', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\024', 'm', 'e', 's', 's', 'a', 'g', 'e', 'S', 'e', 't', 'W', 'i', 'r', 'e', 'F', 'o', 'r', 'm', 'a', 't', '\022', 'L', '\n', '\037', 'n', @@ -1504,120 +1506,127 @@ static const char descriptor[7820] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', ' 'n', 'd', 'a', 'r', 'd', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'A', 'c', 'c', 'e', 's', 's', 'o', 'r', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', '\033', '\n', '\t', 'm', 'a', 'p', '_', 'e', 'n', 't', 'r', 'y', -'\030', '\007', ' ', '\001', '(', '\010', 'R', '\010', 'm', 'a', 'p', 'E', 'n', 't', 'r', 'y', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', -'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', -'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', -'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', -'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\004', '\020', '\005', 'J', '\004', -'\010', '\005', '\020', '\006', 'J', '\004', '\010', '\006', '\020', '\007', 'J', '\004', '\010', '\010', '\020', '\t', 'J', '\004', '\010', '\t', '\020', '\n', '\"', '\222', '\004', -'\n', '\014', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', 'A', '\n', '\005', 'c', 't', 'y', 'p', 'e', '\030', '\001', -' ', '\001', '(', '\016', '2', '#', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', -'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '.', 'C', 'T', 'y', 'p', 'e', ':', '\006', 'S', 'T', 'R', 'I', 'N', 'G', 'R', -'\005', 'c', 't', 'y', 'p', 'e', '\022', '\026', '\n', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\006', 'p', -'a', 'c', 'k', 'e', 'd', '\022', 'G', '\n', '\006', 'j', 's', 't', 'y', 'p', 'e', '\030', '\006', ' ', '\001', '(', '\016', '2', '$', '.', 'g', -'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', -'n', 's', '.', 'J', 'S', 'T', 'y', 'p', 'e', ':', '\t', 'J', 'S', '_', 'N', 'O', 'R', 'M', 'A', 'L', 'R', '\006', 'j', 's', 't', -'y', 'p', 'e', '\022', '\031', '\n', '\004', 'l', 'a', 'z', 'y', '\030', '\005', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', -'\004', 'l', 'a', 'z', 'y', '\022', '.', '\n', '\017', 'u', 'n', 'v', 'e', 'r', 'i', 'f', 'i', 'e', 'd', '_', 'l', 'a', 'z', 'y', '\030', -'\017', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\016', 'u', 'n', 'v', 'e', 'r', 'i', 'f', 'i', 'e', 'd', 'L', -'a', 'z', 'y', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', -'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', '\031', '\n', '\004', 'w', 'e', 'a', 'k', -'\030', '\n', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\004', 'w', 'e', 'a', 'k', '\022', 'X', '\n', '\024', 'u', 'n', -'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', -'2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', -'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', -'t', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', '/', '\n', '\005', 'C', 'T', 'y', 'p', 'e', '\022', '\n', '\n', '\006', 'S', 'T', 'R', -'I', 'N', 'G', '\020', '\000', '\022', '\010', '\n', '\004', 'C', 'O', 'R', 'D', '\020', '\001', '\022', '\020', '\n', '\014', 'S', 'T', 'R', 'I', 'N', 'G', -'_', 'P', 'I', 'E', 'C', 'E', '\020', '\002', '\"', '5', '\n', '\006', 'J', 'S', 'T', 'y', 'p', 'e', '\022', '\r', '\n', '\t', 'J', 'S', '_', -'N', 'O', 'R', 'M', 'A', 'L', '\020', '\000', '\022', '\r', '\n', '\t', 'J', 'S', '_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\001', '\022', '\r', -'\n', '\t', 'J', 'S', '_', 'N', 'U', 'M', 'B', 'E', 'R', '\020', '\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', -'\004', '\010', '\004', '\020', '\005', '\"', 's', '\n', '\014', 'O', 'n', 'e', 'o', 'f', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', 'X', '\n', '\024', -'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', -'(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', -'t', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', -'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\300', '\001', -'\n', '\013', 'E', 'n', 'u', 'm', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '\037', '\n', '\013', 'a', 'l', 'l', 'o', 'w', '_', 'a', 'l', -'i', 'a', 's', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\n', 'a', 'l', 'l', 'o', 'w', 'A', 'l', 'i', 'a', 's', '\022', '%', '\n', '\n', -'d', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', -'d', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', -'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', -'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', -'t', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', -'*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\005', '\020', '\006', '\"', '\236', '\001', '\n', '\020', 'E', 'n', 'u', -'m', 'V', 'a', 'l', 'u', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', -'e', 'd', '\030', '\001', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', -'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', -'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', -'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', -'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', -'\200', '\200', '\002', '\"', '\234', '\001', '\n', '\016', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', -'\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', -'\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', +'\030', '\007', ' ', '\001', '(', '\010', 'R', '\010', 'm', 'a', 'p', 'E', 'n', 't', 'r', 'y', '\022', 'V', '\n', '&', 'd', 'e', 'p', 'r', 'e', +'c', 'a', 't', 'e', 'd', '_', 'l', 'e', 'g', 'a', 'c', 'y', '_', 'j', 's', 'o', 'n', '_', 'f', 'i', 'e', 'l', 'd', '_', 'c', +'o', 'n', 'f', 'l', 'i', 'c', 't', 's', '\030', '\013', ' ', '\001', '(', '\010', 'B', '\002', '\030', '\001', 'R', '\"', 'd', 'e', 'p', 'r', 'e', +'c', 'a', 't', 'e', 'd', 'L', 'e', 'g', 'a', 'c', 'y', 'J', 's', 'o', 'n', 'F', 'i', 'e', 'l', 'd', 'C', 'o', 'n', 'f', 'l', +'i', 'c', 't', 's', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', +'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', +'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', +'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', +'\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\004', '\020', '\005', 'J', '\004', '\010', '\005', '\020', '\006', 'J', '\004', '\010', '\006', '\020', '\007', 'J', '\004', +'\010', '\010', '\020', '\t', 'J', '\004', '\010', '\t', '\020', '\n', '\"', '\222', '\004', '\n', '\014', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', +'n', 's', '\022', 'A', '\n', '\005', 'c', 't', 'y', 'p', 'e', '\030', '\001', ' ', '\001', '(', '\016', '2', '#', '.', 'g', 'o', 'o', 'g', 'l', +'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '.', 'C', +'T', 'y', 'p', 'e', ':', '\006', 'S', 'T', 'R', 'I', 'N', 'G', 'R', '\005', 'c', 't', 'y', 'p', 'e', '\022', '\026', '\n', '\006', 'p', 'a', +'c', 'k', 'e', 'd', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\006', 'p', 'a', 'c', 'k', 'e', 'd', '\022', 'G', '\n', '\006', 'j', 's', 't', +'y', 'p', 'e', '\030', '\006', ' ', '\001', '(', '\016', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', +'u', 'f', '.', 'F', 'i', 'e', 'l', 'd', 'O', 'p', 't', 'i', 'o', 'n', 's', '.', 'J', 'S', 'T', 'y', 'p', 'e', ':', '\t', 'J', +'S', '_', 'N', 'O', 'R', 'M', 'A', 'L', 'R', '\006', 'j', 's', 't', 'y', 'p', 'e', '\022', '\031', '\n', '\004', 'l', 'a', 'z', 'y', '\030', +'\005', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\004', 'l', 'a', 'z', 'y', '\022', '.', '\n', '\017', 'u', 'n', 'v', +'e', 'r', 'i', 'f', 'i', 'e', 'd', '_', 'l', 'a', 'z', 'y', '\030', '\017', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', +'R', '\016', 'u', 'n', 'v', 'e', 'r', 'i', 'f', 'i', 'e', 'd', 'L', 'a', 'z', 'y', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', +'c', 'a', 't', 'e', 'd', '\030', '\003', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', +'c', 'a', 't', 'e', 'd', '\022', '\031', '\n', '\004', 'w', 'e', 'a', 'k', '\030', '\n', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', +'e', 'R', '\004', 'w', 'e', 'a', 'k', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', +'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', +'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', +'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', '/', '\n', +'\005', 'C', 'T', 'y', 'p', 'e', '\022', '\n', '\n', '\006', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\000', '\022', '\010', '\n', '\004', 'C', 'O', 'R', +'D', '\020', '\001', '\022', '\020', '\n', '\014', 'S', 'T', 'R', 'I', 'N', 'G', '_', 'P', 'I', 'E', 'C', 'E', '\020', '\002', '\"', '5', '\n', '\006', +'J', 'S', 'T', 'y', 'p', 'e', '\022', '\r', '\n', '\t', 'J', 'S', '_', 'N', 'O', 'R', 'M', 'A', 'L', '\020', '\000', '\022', '\r', '\n', '\t', +'J', 'S', '_', 'S', 'T', 'R', 'I', 'N', 'G', '\020', '\001', '\022', '\r', '\n', '\t', 'J', 'S', '_', 'N', 'U', 'M', 'B', 'E', 'R', '\020', +'\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\004', '\020', '\005', '\"', 's', '\n', '\014', 'O', 'n', 'e', +'o', 'f', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', +'d', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', +'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', +'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', +'\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\230', '\002', '\n', '\013', 'E', 'n', 'u', 'm', 'O', 'p', 't', 'i', 'o', 'n', +'s', '\022', '\037', '\n', '\013', 'a', 'l', 'l', 'o', 'w', '_', 'a', 'l', 'i', 'a', 's', '\030', '\002', ' ', '\001', '(', '\010', 'R', '\n', 'a', +'l', 'l', 'o', 'w', 'A', 'l', 'i', 'a', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '\003', +' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'V', +'\n', '&', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '_', 'l', 'e', 'g', 'a', 'c', 'y', '_', 'j', 's', 'o', 'n', '_', +'f', 'i', 'e', 'l', 'd', '_', 'c', 'o', 'n', 'f', 'l', 'i', 'c', 't', 's', '\030', '\006', ' ', '\001', '(', '\010', 'B', '\002', '\030', '\001', +'R', '\"', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', 'L', 'e', 'g', 'a', 'c', 'y', 'J', 's', 'o', 'n', 'F', 'i', 'e', +'l', 'd', 'C', 'o', 'n', 'f', 'l', 'i', 'c', 't', 's', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', -'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\340', '\002', '\n', '\r', 'M', 'e', 't', 'h', 'o', 'd', 'O', 'p', -'t', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', '\010', -':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'q', '\n', '\021', 'i', 'd', -'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', '_', 'l', 'e', 'v', 'e', 'l', '\030', '\"', ' ', '\001', '(', '\016', '2', '/', '.', 'g', -'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'M', 'e', 't', 'h', 'o', 'd', 'O', 'p', 't', 'i', -'o', 'n', 's', '.', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', ':', '\023', 'I', 'D', 'E', -'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', 'R', '\020', 'i', 'd', 'e', 'm', 'p', 'o', 't', -'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', -'d', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', -'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', -'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\"', -'P', '\n', '\020', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', '\027', '\n', '\023', 'I', 'D', -'E', 'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'N', 'O', -'_', 'S', 'I', 'D', 'E', '_', 'E', 'F', 'F', 'E', 'C', 'T', 'S', '\020', '\001', '\022', '\016', '\n', '\n', 'I', 'D', 'E', 'M', 'P', 'O', -'T', 'E', 'N', 'T', '\020', '\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\232', '\003', '\n', '\023', 'U', 'n', 'i', -'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\004', 'n', 'a', 'm', 'e', '\030', -'\002', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', -'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '.', 'N', 'a', 'm', 'e', 'P', 'a', -'r', 't', 'R', '\004', 'n', 'a', 'm', 'e', '\022', ')', '\n', '\020', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '_', 'v', 'a', -'l', 'u', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 'V', 'a', 'l', 'u', -'e', '\022', ',', '\n', '\022', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\004', -' ', '\001', '(', '\004', 'R', '\020', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', ',', '\n', -'\022', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\005', ' ', '\001', '(', '\003', -'R', '\020', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', '!', '\n', '\014', 'd', 'o', 'u', -'b', 'l', 'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\006', ' ', '\001', '(', '\001', 'R', '\013', 'd', 'o', 'u', 'b', 'l', 'e', 'V', 'a', -'l', 'u', 'e', '\022', '!', '\n', '\014', 's', 't', 'r', 'i', 'n', 'g', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\007', ' ', '\001', '(', '\014', -'R', '\013', 's', 't', 'r', 'i', 'n', 'g', 'V', 'a', 'l', 'u', 'e', '\022', '\'', '\n', '\017', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', -'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\010', ' ', '\001', '(', '\t', 'R', '\016', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', 'V', -'a', 'l', 'u', 'e', '\032', 'J', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a', 'm', 'e', '_', -'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!', '\n', '\014', 'i', -'s', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E', 'x', 't', 'e', -'n', 's', 'i', 'o', 'n', '\"', '\247', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', -'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g', 'l', -'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', -'.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L', -'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', -'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', -'\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', -'\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', '+', -'\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(', '\t', -'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e', 'a', -'d', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006', ' ', -'\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e', -'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', -'\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', -'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', -'d', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', 'a', -'t', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', -'t', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o', 'u', -'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', -'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020', -'\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', 'n', -'t', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', -'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', -'t', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', -'\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n', -'\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.', -'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', -'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', -'.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r', -'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e', -'.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n', +'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', 'J', '\004', '\010', '\005', '\020', '\006', '\"', '\236', '\001', '\n', '\020', 'E', 'n', +'u', 'm', 'V', 'a', 'l', 'u', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', +'t', 'e', 'd', '\030', '\001', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', +'t', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', +'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', +'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', +'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', +'\200', '\200', '\200', '\002', '\"', '\234', '\001', '\n', '\016', 'S', 'e', 'r', 'v', 'i', 'c', 'e', 'O', 'p', 't', 'i', 'o', 'n', 's', '\022', '%', +'\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', '\010', ':', '\005', 'f', 'a', 'l', 's', 'e', +'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', +'e', 't', 'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', +'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', +'O', 'p', 't', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', +'o', 'n', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\340', '\002', '\n', '\r', 'M', 'e', 't', 'h', 'o', 'd', 'O', +'p', 't', 'i', 'o', 'n', 's', '\022', '%', '\n', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\030', '!', ' ', '\001', '(', +'\010', ':', '\005', 'f', 'a', 'l', 's', 'e', 'R', '\n', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd', '\022', 'q', '\n', '\021', 'i', +'d', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', '_', 'l', 'e', 'v', 'e', 'l', '\030', '\"', ' ', '\001', '(', '\016', '2', '/', '.', +'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'M', 'e', 't', 'h', 'o', 'd', 'O', 'p', 't', +'i', 'o', 'n', 's', '.', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', ':', '\023', 'I', 'D', +'E', 'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', 'R', '\020', 'i', 'd', 'e', 'm', 'p', 'o', +'t', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', 'X', '\n', '\024', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', +'e', 'd', '_', 'o', 'p', 't', 'i', 'o', 'n', '\030', '\347', '\007', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', +'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', +'t', 'i', 'o', 'n', 'R', '\023', 'u', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', +'\"', 'P', '\n', '\020', 'I', 'd', 'e', 'm', 'p', 'o', 't', 'e', 'n', 'c', 'y', 'L', 'e', 'v', 'e', 'l', '\022', '\027', '\n', '\023', 'I', +'D', 'E', 'M', 'P', 'O', 'T', 'E', 'N', 'C', 'Y', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\017', 'N', +'O', '_', 'S', 'I', 'D', 'E', '_', 'E', 'F', 'F', 'E', 'C', 'T', 'S', '\020', '\001', '\022', '\016', '\n', '\n', 'I', 'D', 'E', 'M', 'P', +'O', 'T', 'E', 'N', 'T', '\020', '\002', '*', '\t', '\010', '\350', '\007', '\020', '\200', '\200', '\200', '\200', '\002', '\"', '\232', '\003', '\n', '\023', 'U', 'n', +'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\004', 'n', 'a', 'm', 'e', +'\030', '\002', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', +'U', 'n', 'i', 'n', 't', 'e', 'r', 'p', 'r', 'e', 't', 'e', 'd', 'O', 'p', 't', 'i', 'o', 'n', '.', 'N', 'a', 'm', 'e', 'P', +'a', 'r', 't', 'R', '\004', 'n', 'a', 'm', 'e', '\022', ')', '\n', '\020', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', '_', 'v', +'a', 'l', 'u', 'e', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'i', 'd', 'e', 'n', 't', 'i', 'f', 'i', 'e', 'r', 'V', 'a', 'l', +'u', 'e', '\022', ',', '\n', '\022', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', +'\004', ' ', '\001', '(', '\004', 'R', '\020', 'p', 'o', 's', 'i', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', ',', +'\n', '\022', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', '_', 'i', 'n', 't', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\005', ' ', '\001', '(', +'\003', 'R', '\020', 'n', 'e', 'g', 'a', 't', 'i', 'v', 'e', 'I', 'n', 't', 'V', 'a', 'l', 'u', 'e', '\022', '!', '\n', '\014', 'd', 'o', +'u', 'b', 'l', 'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\006', ' ', '\001', '(', '\001', 'R', '\013', 'd', 'o', 'u', 'b', 'l', 'e', 'V', +'a', 'l', 'u', 'e', '\022', '!', '\n', '\014', 's', 't', 'r', 'i', 'n', 'g', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\007', ' ', '\001', '(', +'\014', 'R', '\013', 's', 't', 'r', 'i', 'n', 'g', 'V', 'a', 'l', 'u', 'e', '\022', '\'', '\n', '\017', 'a', 'g', 'g', 'r', 'e', 'g', 'a', +'t', 'e', '_', 'v', 'a', 'l', 'u', 'e', '\030', '\010', ' ', '\001', '(', '\t', 'R', '\016', 'a', 'g', 'g', 'r', 'e', 'g', 'a', 't', 'e', +'V', 'a', 'l', 'u', 'e', '\032', 'J', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a', 'm', 'e', +'_', 'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!', '\n', '\014', +'i', 's', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E', 'x', 't', +'e', 'n', 's', 'i', 'o', 'n', '\"', '\247', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', +'\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g', +'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', +'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', +'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', +'\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', +'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', +'s', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', +'+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(', +'\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e', +'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006', +' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', +'e', 'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', +'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g', +'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', +'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', +'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', +'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o', +'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i', +'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', +'\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', +'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', +'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', +'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', +'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', +'\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', 'B', '~', '\n', '\023', 'c', 'o', 'm', +'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', +'t', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', +'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', +'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', +'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n', }; static _upb_DefPool_Init *deps[1] = { @@ -1628,7 +1637,7 @@ _upb_DefPool_Init google_protobuf_descriptor_proto_upbdefinit = { deps, &google_protobuf_descriptor_proto_upb_file_layout, "google/protobuf/descriptor.proto", - UPB_STRINGVIEW_INIT(descriptor, 7820) + UPB_STRINGVIEW_INIT(descriptor, 7996) }; /* diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index 1db98915b7ac..bae79ebe20a1 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -5564,6 +5564,21 @@ UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protob const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } +UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) { + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { + bool default_val = false; + bool ret; + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); @@ -5589,6 +5604,9 @@ UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(googl }UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); +}UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) { + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, 8, len); } @@ -5915,6 +5933,21 @@ UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } +UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) { + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { + bool default_val = false; + bool ret; + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); @@ -5934,6 +5967,9 @@ UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_Enum }UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); +}UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) { + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 69e63f4cc37e..649207a962c0 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -978,18 +978,19 @@ static const upb_MiniTableSub google_protobuf_MessageOptions_submsgs[1] = { {.submsg = &google_protobuf_UninterpretedOption_msg_init}, }; -static const upb_MiniTableField google_protobuf_MessageOptions__fields[5] = { +static const upb_MiniTableField google_protobuf_MessageOptions__fields[6] = { {1, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {2, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {3, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_MessageOptions_msg_init = { &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], - 16, 5, kUpb_ExtMode_Extendable, 3, 255, 0, + 16, 6, kUpb_ExtMode_Extendable, 3, 255, 0, }; static const upb_MiniTableSub google_protobuf_FieldOptions_submsgs[3] = { @@ -1033,16 +1034,17 @@ static const upb_MiniTableSub google_protobuf_EnumOptions_submsgs[1] = { {.submsg = &google_protobuf_UninterpretedOption_msg_init}, }; -static const upb_MiniTableField google_protobuf_EnumOptions__fields[3] = { +static const upb_MiniTableField google_protobuf_EnumOptions__fields[4] = { {2, 1, 1, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, + {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}, {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, }; const upb_MiniTable google_protobuf_EnumOptions_msg_init = { &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], - UPB_SIZE(8, 16), 3, kUpb_ExtMode_Extendable, 0, 255, 0, + UPB_SIZE(8, 16), 4, kUpb_ExtMode_Extendable, 0, 255, 0, }; static const upb_MiniTableSub google_protobuf_EnumValueOptions_submsgs[1] = { diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index a05f7cdd962a..3640a1f7ece0 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -5566,6 +5566,21 @@ UPB_INLINE bool google_protobuf_MessageOptions_has_map_entry(const google_protob const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } +UPB_INLINE void google_protobuf_MessageOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions* msg) { + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE bool google_protobuf_MessageOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { + bool default_val = false; + bool ret; + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_MessageOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_MessageOptions* msg) { + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} UPB_INLINE void google_protobuf_MessageOptions_clear_uninterpreted_option(google_protobuf_MessageOptions* msg) { const upb_MiniTableField field = {999, 8, 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); @@ -5591,6 +5606,9 @@ UPB_INLINE void google_protobuf_MessageOptions_set_message_set_wire_format(googl }UPB_INLINE void google_protobuf_MessageOptions_set_map_entry(google_protobuf_MessageOptions *msg, bool value) { const upb_MiniTableField field = {7, 4, 4, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); +}UPB_INLINE void google_protobuf_MessageOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_MessageOptions *msg, bool value) { + const upb_MiniTableField field = {11, 5, 5, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_mutable_uninterpreted_option(google_protobuf_MessageOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, 8, len); } @@ -5917,6 +5935,21 @@ UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated(const google_protobuf const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; return _upb_Message_HasNonExtensionField(msg, &field); } +UPB_INLINE void google_protobuf_EnumOptions_clear_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions* msg) { + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_ClearNonExtensionField(msg, &field); +} +UPB_INLINE bool google_protobuf_EnumOptions_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { + bool default_val = false; + bool ret; + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_EnumOptions_has_deprecated_legacy_json_field_conflicts(const google_protobuf_EnumOptions* msg) { + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + return _upb_Message_HasNonExtensionField(msg, &field); +} UPB_INLINE void google_protobuf_EnumOptions_clear_uninterpreted_option(google_protobuf_EnumOptions* msg) { const upb_MiniTableField field = {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; _upb_Message_ClearNonExtensionField(msg, &field); @@ -5936,6 +5969,9 @@ UPB_INLINE void google_protobuf_EnumOptions_set_allow_alias(google_protobuf_Enum }UPB_INLINE void google_protobuf_EnumOptions_set_deprecated(google_protobuf_EnumOptions *msg, bool value) { const upb_MiniTableField field = {3, 2, 2, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; _upb_Message_SetNonExtensionField(msg, &field, &value); +}UPB_INLINE void google_protobuf_EnumOptions_set_deprecated_legacy_json_field_conflicts(google_protobuf_EnumOptions *msg, bool value) { + const upb_MiniTableField field = {6, 3, 3, kUpb_NoSub, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)}; + _upb_Message_SetNonExtensionField(msg, &field, &value); }UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mutable_uninterpreted_option(google_protobuf_EnumOptions* msg, size_t* len) { return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 985b0c294c58..14fb1e37d1f0 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -307,7 +307,8 @@ PROTOBUF_CONSTEXPR MessageOptions::MessageOptions( , /*decltype(_impl_.message_set_wire_format_)*/false , /*decltype(_impl_.no_standard_descriptor_accessor_)*/false , /*decltype(_impl_.deprecated_)*/false - , /*decltype(_impl_.map_entry_)*/false} {} + , /*decltype(_impl_.map_entry_)*/false + , /*decltype(_impl_.deprecated_legacy_json_field_conflicts_)*/false} {} struct MessageOptionsDefaultTypeInternal { PROTOBUF_CONSTEXPR MessageOptionsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~MessageOptionsDefaultTypeInternal() {} @@ -363,7 +364,8 @@ PROTOBUF_CONSTEXPR EnumOptions::EnumOptions( , /*decltype(_impl_._cached_size_)*/{} , /*decltype(_impl_.uninterpreted_option_)*/{} , /*decltype(_impl_.allow_alias_)*/false - , /*decltype(_impl_.deprecated_)*/false} {} + , /*decltype(_impl_.deprecated_)*/false + , /*decltype(_impl_.deprecated_legacy_json_field_conflicts_)*/false} {} struct EnumOptionsDefaultTypeInternal { PROTOBUF_CONSTEXPR EnumOptionsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} ~EnumOptionsDefaultTypeInternal() {} @@ -827,11 +829,13 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.no_standard_descriptor_accessor_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.deprecated_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.map_entry_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.deprecated_legacy_json_field_conflicts_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _impl_.uninterpreted_option_), 0, 1, 2, 3, + 4, ~0u, PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _internal_metadata_), @@ -876,9 +880,11 @@ const ::uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] P ~0u, // no sizeof(Split) PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.allow_alias_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.deprecated_legacy_json_field_conflicts_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _impl_.uninterpreted_option_), 0, 1, + 2, ~0u, PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _internal_metadata_), @@ -1024,19 +1030,19 @@ static const ::_pbi::MigrationSchema { 192, 203, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto)}, { 206, 220, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)}, { 226, 255, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileOptions)}, - { 276, 289, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)}, - { 294, 310, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, - { 318, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, - { 327, 338, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, - { 341, 351, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, - { 353, 363, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, - { 365, 376, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, - { 379, 389, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, - { 391, 406, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, - { 413, 426, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, - { 431, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, - { 440, 453, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, - { 458, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, + { 276, 290, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)}, + { 296, 312, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, + { 320, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, + { 329, 341, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, + { 345, 355, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, + { 357, 367, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, + { 369, 380, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, + { 383, 393, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, + { 395, 410, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, + { 417, 430, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, + { 435, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, + { 444, 457, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, + { 462, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -1163,74 +1169,76 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PR "terpreted_option\030\347\007 \003(\0132$.google.protobu" "f.UninterpretedOption\":\n\014OptimizeMode\022\t\n" "\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020" - "\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\204\002\n\016MessageOptions\022&\n" + "\003*\t\010\350\007\020\200\200\200\200\002J\004\010&\020\'\"\270\002\n\016MessageOptions\022&\n" "\027message_set_wire_format\030\001 \001(\010:\005false\022.\n" "\037no_standard_descriptor_accessor\030\002 \001(\010:\005" "false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_" - "entry\030\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003" - "(\0132$.google.protobuf.UninterpretedOption" - "*\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\"\276\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.goog" - "le.protobuf.FieldOptions.CType:\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\017unverified_lazy\030" - "\017 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" - "\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted_op" - "tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre" - "tedOption\"/\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_NORMA" - "L\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMBER\020\002*\t\010\350\007\020\200" - "\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C\n\024uninterpre" - "ted_option\030\347\007 \003(\0132$.google.protobuf.Unin" - "terpretedOption*\t\010\350\007\020\200\200\200\200\002\"\223\001\n\013EnumOptio" - "ns\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 " - "\001(\010:\005false\022C\n\024uninterpreted_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\n" - "deprecated\030\001 \001(\010:\005false\022C\n\024uninterpreted" + "entry\030\007 \001(\010\0222\n&deprecated_legacy_json_fi" + "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\002\"{\n\016ServiceOption" - "s\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninterp" - "reted_option\030\347\007 \003(\0132$.google.protobuf.Un" - "interpretedOption*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodO" - "ptions\022\031\n\ndeprecated\030! \001(\010:\005false\022_\n\021ide" - "mpotency_level\030\" \001(\0162/.google.protobuf.M" - "ethodOptions.IdempotencyLevel:\023IDEMPOTEN" - "CY_UNKNOWN\022C\n\024uninterpreted_option\030\347\007 \003(" - "\0132$.google.protobuf.UninterpretedOption\"" - "P\n\020IdempotencyLevel\022\027\n\023IDEMPOTENCY_UNKNO" - "WN\020\000\022\023\n\017NO_SIDE_EFFECTS\020\001\022\016\n\nIDEMPOTENT\020" - "\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022;\n\004" - "name\030\002 \003(\0132-.google.protobuf.Uninterpret" - "edOption.NamePart\022\030\n\020identifier_value\030\003 " - "\001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022negat" - "ive_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_val" - "ue\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\016SourceCodeInfo" - "\022:\n\010location\030\001 \003(\0132(.google.protobuf.Sou" - "rceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004pat" - "h\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_comments\030\004 \001" - "(\t\022!\n\031leading_detached_comments\030\006 \003(\t\"\234\002" - "\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\0132" - "-.google.protobuf.GeneratedCodeInfo.Anno" - "tation\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\003e" - "nd\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.prot" - "obuf.GeneratedCodeInfo.Annotation.Semant" - "ic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALI" - "AS\020\002B~\n\023com.google.protobufB\020DescriptorP" - "rotosH\001Z-google.golang.org/protobuf/type" - "s/descriptorpb\370\001\001\242\002\003GPB\252\002\032Google.Protobu" - "f.Reflection" + "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\"\276\003\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\022C\n\024unin" + "terpreted_option\030\347\007 \003(\0132$.google.protobu" + "f.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_NUM" + "BER\020\002*\t\010\350\007\020\200\200\200\200\002J\004\010\004\020\005\"^\n\014OneofOptions\022C" + "\n\024uninterpreted_option\030\347\007 \003(\0132$.google.p" + "rotobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\307" + "\001\n\013EnumOptions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\nd" + "eprecated\030\003 \001(\010:\005false\0222\n&deprecated_leg" + "acy_json_field_conflicts\030\006 \001(\010B\002\030\001\022C\n\024un" + "interpreted_option\030\347\007 \003(\0132$.google.proto" + "buf.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" + ":\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$" + ".google.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(\0132$.google.protobuf.UninterpretedOptio" + "n*\t\010\350\007\020\200\200\200\200\002\"\255\002\n\rMethodOptions\022\031\n\ndeprec" + "ated\030! \001(\010:\005false\022_\n\021idempotency_level\030\"" + " \001(\0162/.google.protobuf.MethodOptions.Ide" + "mpotencyLevel:\023IDEMPOTENCY_UNKNOWN\022C\n\024un" + "interpreted_option\030\347\007 \003(\0132$.google.proto" + "buf.UninterpretedOption\"P\n\020IdempotencyLe" + "vel\022\027\n\023IDEMPOTENCY_UNKNOWN\020\000\022\023\n\017NO_SIDE_" + "EFFECTS\020\001\022\016\n\nIDEMPOTENT\020\002*\t\010\350\007\020\200\200\200\200\002\"\236\002\n" + "\023UninterpretedOption\022;\n\004name\030\002 \003(\0132-.goo" + "gle.protobuf.UninterpretedOption.NamePar" + "t\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_valu" + "e\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010Name" + "Part\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.Loca" + "tion\032\206\001\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004s" + "pan\030\002 \003(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022" + "\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_de" + "tached_comments\030\006 \003(\t\"\234\002\n\021GeneratedCodeI" + "nfo\022A\n\nannotation\030\001 \003(\0132-.google.protobu" + "f.GeneratedCodeInfo.Annotation\032\303\001\n\nAnnot" + "ation\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\010sema" + "ntic\030\005 \001(\01626.google.protobuf.GeneratedCo" + "deInfo.Annotation.Semantic\"(\n\010Semantic\022\010" + "\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002B~\n\023com.goog" + "le.protobufB\020DescriptorProtosH\001Z-google." + "golang.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, - 6212, + 6316, descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto, "google/protobuf/descriptor.proto", &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once, @@ -7607,6 +7615,9 @@ class MessageOptions::_Internal { static void set_has_map_entry(HasBits* has_bits) { (*has_bits)[0] |= 8u; } + static void set_has_deprecated_legacy_json_field_conflicts(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } }; MessageOptions::MessageOptions(::PROTOBUF_NAMESPACE_ID::Arena* arena) @@ -7625,13 +7636,14 @@ MessageOptions::MessageOptions(const MessageOptions& from) , decltype(_impl_.message_set_wire_format_){} , decltype(_impl_.no_standard_descriptor_accessor_){} , decltype(_impl_.deprecated_){} - , decltype(_impl_.map_entry_){}}; + , decltype(_impl_.map_entry_){} + , decltype(_impl_.deprecated_legacy_json_field_conflicts_){}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); ::memcpy(&_impl_.message_set_wire_format_, &from._impl_.message_set_wire_format_, - static_cast<::size_t>(reinterpret_cast(&_impl_.map_entry_) - - reinterpret_cast(&_impl_.message_set_wire_format_)) + sizeof(_impl_.map_entry_)); + static_cast<::size_t>(reinterpret_cast(&_impl_.deprecated_legacy_json_field_conflicts_) - + reinterpret_cast(&_impl_.message_set_wire_format_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions) } @@ -7646,6 +7658,7 @@ inline void MessageOptions::SharedCtor(::_pb::Arena* arena) { , decltype(_impl_.no_standard_descriptor_accessor_){false} , decltype(_impl_.deprecated_){false} , decltype(_impl_.map_entry_){false} + , decltype(_impl_.deprecated_legacy_json_field_conflicts_){false} }; } @@ -7676,9 +7689,12 @@ void MessageOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); - ::memset(&_impl_.message_set_wire_format_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.map_entry_) - - reinterpret_cast(&_impl_.message_set_wire_format_)) + sizeof(_impl_.map_entry_)); + cached_has_bits = _impl_._has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + ::memset(&_impl_.message_set_wire_format_, 0, static_cast<::size_t>( + reinterpret_cast(&_impl_.deprecated_legacy_json_field_conflicts_) - + reinterpret_cast(&_impl_.message_set_wire_format_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_)); + } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -7731,6 +7747,16 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::_pbi::ParseContext goto handle_unusual; } continue; + // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + case 11: + if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 88)) { + _Internal::set_has_deprecated_legacy_json_field_conflicts(&has_bits); + _impl_.deprecated_legacy_json_field_conflicts_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else { + goto handle_unusual; + } + continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) { @@ -7806,6 +7832,12 @@ ::uint8_t* MessageOptions::_InternalSerialize( target = ::_pbi::WireFormatLite::WriteBoolToArray(7, this->_internal_map_entry(), target); } + // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray(11, this->_internal_deprecated_legacy_json_field_conflicts(), target); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned i = 0, n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { @@ -7845,7 +7877,7 @@ ::size_t MessageOptions::ByteSizeLong() const { } cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x0000001fu) { // optional bool message_set_wire_format = 1 [default = false]; if (cached_has_bits & 0x00000001u) { total_size += 1 + 1; @@ -7866,6 +7898,11 @@ ::size_t MessageOptions::ByteSizeLong() const { total_size += 1 + 1; } + // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + 1; + } + } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -7888,7 +7925,7 @@ void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const : _this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x0000001fu) { if (cached_has_bits & 0x00000001u) { _this->_impl_.message_set_wire_format_ = from._impl_.message_set_wire_format_; } @@ -7901,6 +7938,9 @@ void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const : if (cached_has_bits & 0x00000008u) { _this->_impl_.map_entry_ = from._impl_.map_entry_; } + if (cached_has_bits & 0x00000010u) { + _this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; + } _this->_impl_._has_bits_[0] |= cached_has_bits; } _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); @@ -7931,8 +7971,8 @@ void MessageOptions::InternalSwap(MessageOptions* 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(MessageOptions, _impl_.map_entry_) - + sizeof(MessageOptions::_impl_.map_entry_) + PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.deprecated_legacy_json_field_conflicts_) + + sizeof(MessageOptions::_impl_.deprecated_legacy_json_field_conflicts_) - PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.message_set_wire_format_)>( reinterpret_cast(&_impl_.message_set_wire_format_), reinterpret_cast(&other->_impl_.message_set_wire_format_)); @@ -8626,6 +8666,9 @@ class EnumOptions::_Internal { static void set_has_deprecated(HasBits* has_bits) { (*has_bits)[0] |= 2u; } + static void set_has_deprecated_legacy_json_field_conflicts(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } }; EnumOptions::EnumOptions(::PROTOBUF_NAMESPACE_ID::Arena* arena) @@ -8642,13 +8685,14 @@ EnumOptions::EnumOptions(const EnumOptions& from) , /*decltype(_impl_._cached_size_)*/{} , decltype(_impl_.uninterpreted_option_){from._impl_.uninterpreted_option_} , decltype(_impl_.allow_alias_){} - , decltype(_impl_.deprecated_){}}; + , decltype(_impl_.deprecated_){} + , decltype(_impl_.deprecated_legacy_json_field_conflicts_){}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); ::memcpy(&_impl_.allow_alias_, &from._impl_.allow_alias_, - static_cast<::size_t>(reinterpret_cast(&_impl_.deprecated_) - - reinterpret_cast(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_)); + static_cast<::size_t>(reinterpret_cast(&_impl_.deprecated_legacy_json_field_conflicts_) - + reinterpret_cast(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions) } @@ -8661,6 +8705,7 @@ inline void EnumOptions::SharedCtor(::_pb::Arena* arena) { , decltype(_impl_.uninterpreted_option_){arena} , decltype(_impl_.allow_alias_){false} , decltype(_impl_.deprecated_){false} + , decltype(_impl_.deprecated_legacy_json_field_conflicts_){false} }; } @@ -8692,8 +8737,8 @@ void EnumOptions::Clear() { _impl_._extensions_.Clear(); _impl_.uninterpreted_option_.Clear(); ::memset(&_impl_.allow_alias_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.deprecated_) - - reinterpret_cast(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_)); + reinterpret_cast(&_impl_.deprecated_legacy_json_field_conflicts_) - + reinterpret_cast(&_impl_.allow_alias_)) + sizeof(_impl_.deprecated_legacy_json_field_conflicts_)); _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -8726,6 +8771,16 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::_pbi::ParseContext* c goto handle_unusual; } continue; + // optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 48)) { + _Internal::set_has_deprecated_legacy_json_field_conflicts(&has_bits); + _impl_.deprecated_legacy_json_field_conflicts_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else { + goto handle_unusual; + } + continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) { @@ -8789,6 +8844,12 @@ ::uint8_t* EnumOptions::_InternalSerialize( target = ::_pbi::WireFormatLite::WriteBoolToArray(3, this->_internal_deprecated(), target); } + // optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray(6, this->_internal_deprecated_legacy_json_field_conflicts(), target); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned i = 0, n = static_cast(this->_internal_uninterpreted_option_size()); i < n; i++) { @@ -8828,7 +8889,7 @@ ::size_t EnumOptions::ByteSizeLong() const { } cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000007u) { // optional bool allow_alias = 2; if (cached_has_bits & 0x00000001u) { total_size += 1 + 1; @@ -8839,6 +8900,11 @@ ::size_t EnumOptions::ByteSizeLong() const { total_size += 1 + 1; } + // optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + 1; + } + } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -8861,13 +8927,16 @@ void EnumOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PR _this->_impl_.uninterpreted_option_.MergeFrom(from._impl_.uninterpreted_option_); cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { _this->_impl_.allow_alias_ = from._impl_.allow_alias_; } if (cached_has_bits & 0x00000002u) { _this->_impl_.deprecated_ = from._impl_.deprecated_; } + if (cached_has_bits & 0x00000004u) { + _this->_impl_.deprecated_legacy_json_field_conflicts_ = from._impl_.deprecated_legacy_json_field_conflicts_; + } _this->_impl_._has_bits_[0] |= cached_has_bits; } _this->_impl_._extensions_.MergeFrom(internal_default_instance(), from._impl_._extensions_); @@ -8898,8 +8967,8 @@ void EnumOptions::InternalSwap(EnumOptions* 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(EnumOptions, _impl_.deprecated_) - + sizeof(EnumOptions::_impl_.deprecated_) + PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.deprecated_legacy_json_field_conflicts_) + + sizeof(EnumOptions::_impl_.deprecated_legacy_json_field_conflicts_) - PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.allow_alias_)>( reinterpret_cast(&_impl_.allow_alias_), reinterpret_cast(&other->_impl_.allow_alias_)); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 3b253fef077b..e586763192c9 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -4396,6 +4396,7 @@ class PROTOBUF_EXPORT MessageOptions final : kNoStandardDescriptorAccessorFieldNumber = 2, kDeprecatedFieldNumber = 3, kMapEntryFieldNumber = 7, + kDeprecatedLegacyJsonFieldConflictsFieldNumber = 11, }; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; @@ -4455,6 +4456,16 @@ class PROTOBUF_EXPORT MessageOptions final : void _internal_set_map_entry(bool value); public: + // optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + PROTOBUF_DEPRECATED bool has_deprecated_legacy_json_field_conflicts() const; + PROTOBUF_DEPRECATED void clear_deprecated_legacy_json_field_conflicts(); + PROTOBUF_DEPRECATED bool deprecated_legacy_json_field_conflicts() const; + PROTOBUF_DEPRECATED void set_deprecated_legacy_json_field_conflicts(bool value); + private: + bool _internal_deprecated_legacy_json_field_conflicts() const; + void _internal_set_deprecated_legacy_json_field_conflicts(bool value); + public: + template uninterpreted_option_; bool allow_alias_; bool deprecated_; + bool deprecated_legacy_json_field_conflicts_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; @@ -12604,6 +12628,31 @@ inline void MessageOptions::set_map_entry(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.map_entry) } +// optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; +inline bool MessageOptions::has_deprecated_legacy_json_field_conflicts() const { + bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline void MessageOptions::clear_deprecated_legacy_json_field_conflicts() { + _impl_.deprecated_legacy_json_field_conflicts_ = false; + _impl_._has_bits_[0] &= ~0x00000010u; +} +inline bool MessageOptions::_internal_deprecated_legacy_json_field_conflicts() const { + return _impl_.deprecated_legacy_json_field_conflicts_; +} +inline bool MessageOptions::deprecated_legacy_json_field_conflicts() const { + // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts) + return _internal_deprecated_legacy_json_field_conflicts(); +} +inline void MessageOptions::_internal_set_deprecated_legacy_json_field_conflicts(bool value) { + _impl_._has_bits_[0] |= 0x00000010u; + _impl_.deprecated_legacy_json_field_conflicts_ = value; +} +inline void MessageOptions::set_deprecated_legacy_json_field_conflicts(bool value) { + _internal_set_deprecated_legacy_json_field_conflicts(value); + // @@protoc_insertion_point(field_set:google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int MessageOptions::_internal_uninterpreted_option_size() const { return _impl_.uninterpreted_option_.size(); @@ -12963,6 +13012,31 @@ inline void EnumOptions::set_deprecated(bool value) { // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated) } +// optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; +inline bool EnumOptions::has_deprecated_legacy_json_field_conflicts() const { + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline void EnumOptions::clear_deprecated_legacy_json_field_conflicts() { + _impl_.deprecated_legacy_json_field_conflicts_ = false; + _impl_._has_bits_[0] &= ~0x00000004u; +} +inline bool EnumOptions::_internal_deprecated_legacy_json_field_conflicts() const { + return _impl_.deprecated_legacy_json_field_conflicts_; +} +inline bool EnumOptions::deprecated_legacy_json_field_conflicts() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts) + return _internal_deprecated_legacy_json_field_conflicts(); +} +inline void EnumOptions::_internal_set_deprecated_legacy_json_field_conflicts(bool value) { + _impl_._has_bits_[0] |= 0x00000004u; + _impl_.deprecated_legacy_json_field_conflicts_ = value; +} +inline void EnumOptions::set_deprecated_legacy_json_field_conflicts(bool value) { + _internal_set_deprecated_legacy_json_field_conflicts(value); + // @@protoc_insertion_point(field_set:google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int EnumOptions::_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 0636a87ab172..004ce7829319 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -518,6 +518,18 @@ message MessageOptions { reserved 8; // javalite_serializable reserved 9; // javanano_as_lite + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // + // This should only be used as a temporary measure against broken builds due + // to the change in behavior for JSON field name conflicts. + // + // TODO(b/261750190) This is legacy behavior we plan to remove once downstream + // teams have had time to migrate. + optional bool deprecated_legacy_json_field_conflicts = 11 [deprecated = true]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -646,6 +658,14 @@ message EnumOptions { reserved 5; // javanano_as_lite + // Enable the legacy handling of JSON field name conflicts. This lowercases + // and strips underscored from the fields before comparison in proto3 only. + // The new behavior takes `json_name` into account and applies to proto2 as + // well. + // TODO(b/261750190) Remove this legacy behavior once downstream teams have + // had time to migrate. + optional bool deprecated_legacy_json_field_conflicts = 6 [deprecated = true]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; From 33593edfef1c09a01ecef7d181025ad209869fb4 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 18:43:16 +0000 Subject: [PATCH 31/43] Auto-generate files after cl/495354518 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From 9595cbbf9a1dbd03edaf3def50befd99b727642c Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 10:47:32 -0800 Subject: [PATCH 32/43] Mark UnmodifiableLazyStringList deprecated. UnmodifiableLazyStringList is unnecessary and will be removed in a future release. PiperOrigin-RevId: 495357579 --- .../java/com/google/protobuf/UnmodifiableLazyStringList.java | 2 ++ src/file_lists.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java b/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java index 415b2cde0de3..2eebc9ddea02 100644 --- a/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +++ b/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java @@ -43,7 +43,9 @@ * it cannot be modified via the wrapper. * * @author jonp@google.com (Jon Perlow) + * @deprecated use {@link LazyStringArrayList#makeImmutable} instead. */ +@Deprecated public class UnmodifiableLazyStringList extends AbstractList implements LazyStringList, RandomAccess { diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From e783e856023947d536b4da6c9b50b8e257fd7647 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 18:53:12 +0000 Subject: [PATCH 33/43] Auto-generate files after cl/495357579 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From da70972f52293a1fea1fdeccf8e64b191460b4c7 Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Wed, 14 Dec 2022 12:59:06 -0800 Subject: [PATCH 34/43] Update collect_all_artifacts.sh to install mono for 20.04 instead of 16.04 PiperOrigin-RevId: 495394221 --- kokoro/release/collect_all_artifacts.sh | 7 +++---- src/file_lists.cmake | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/kokoro/release/collect_all_artifacts.sh b/kokoro/release/collect_all_artifacts.sh index 330bb693c030..ad125049784e 100755 --- a/kokoro/release/collect_all_artifacts.sh +++ b/kokoro/release/collect_all_artifacts.sh @@ -49,11 +49,10 @@ cp ${INPUT_ARTIFACTS_DIR}/build64/src/protoc protoc/macosx_x64/protoc # Install nuget (will also install mono) # TODO(jtattermusch): use "mono:5.14" docker image instead so we don't have to apt-get install +sudo apt update +sudo apt install gnupg ca-certificates sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list -# NVidia has stopped publishing Cuda packages for Ubuntu 16.04, so we need to -# delete this file to allow the apt update to run successfully. -sudo rm -f /etc/apt/sources.list.d/cuda.list +echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update sudo apt-get install -y nuget diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From 7049c555ec73defb18ee30f649cd385b28b243b0 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 21:05:32 +0000 Subject: [PATCH 35/43] Auto-generate files after cl/495394221 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From afddce8cc9e7b36b978781c7b526530e5ce8559c Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Wed, 14 Dec 2022 14:10:12 -0800 Subject: [PATCH 36/43] Add -y to collect_all_artifacts apt install for `gnupg ca-certificates` PiperOrigin-RevId: 495412826 --- kokoro/release/collect_all_artifacts.sh | 2 +- src/file_lists.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kokoro/release/collect_all_artifacts.sh b/kokoro/release/collect_all_artifacts.sh index ad125049784e..0f2e8033075c 100755 --- a/kokoro/release/collect_all_artifacts.sh +++ b/kokoro/release/collect_all_artifacts.sh @@ -50,7 +50,7 @@ cp ${INPUT_ARTIFACTS_DIR}/build64/src/protoc protoc/macosx_x64/protoc # Install nuget (will also install mono) # TODO(jtattermusch): use "mono:5.14" docker image instead so we don't have to apt-get install sudo apt update -sudo apt install gnupg ca-certificates +sudo apt install -y gnupg ca-certificates sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From a6d0a6a441b7e1ff861cf4eba63868557516dd0e Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 22:17:42 +0000 Subject: [PATCH 37/43] Auto-generate files after cl/495412826 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From b51c551e37b1036bf54ade9911d9a39aed879ab0 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 14:54:48 -0800 Subject: [PATCH 38/43] Remove unused package private class ProtobufLists. PiperOrigin-RevId: 495424888 --- java/core/BUILD.bazel | 1 - .../com/google/protobuf/ProtobufLists.java | 95 ------------------- java/lite/pom.xml | 1 - src/file_lists.cmake | 2 +- 4 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 java/core/src/main/java/com/google/protobuf/ProtobufLists.java diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel index 9207a552fd32..6113169c6c7a 100644 --- a/java/core/BUILD.bazel +++ b/java/core/BUILD.bazel @@ -80,7 +80,6 @@ LITE_SRCS = [ "src/main/java/com/google/protobuf/ProtoSyntax.java", "src/main/java/com/google/protobuf/Protobuf.java", "src/main/java/com/google/protobuf/ProtobufArrayList.java", - "src/main/java/com/google/protobuf/ProtobufLists.java", "src/main/java/com/google/protobuf/ProtocolStringList.java", "src/main/java/com/google/protobuf/RawMessageInfo.java", "src/main/java/com/google/protobuf/Reader.java", diff --git a/java/core/src/main/java/com/google/protobuf/ProtobufLists.java b/java/core/src/main/java/com/google/protobuf/ProtobufLists.java deleted file mode 100644 index 018c9118c0fa..000000000000 --- a/java/core/src/main/java/com/google/protobuf/ProtobufLists.java +++ /dev/null @@ -1,95 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package com.google.protobuf; - -import com.google.protobuf.Internal.BooleanList; -import com.google.protobuf.Internal.DoubleList; -import com.google.protobuf.Internal.FloatList; -import com.google.protobuf.Internal.IntList; -import com.google.protobuf.Internal.LongList; -import com.google.protobuf.Internal.ProtobufList; - -/** Utility class for construction of lists that extend {@link ProtobufList}. */ -@ExperimentalApi -@CheckReturnValue -final class ProtobufLists { - private ProtobufLists() {} - - public static ProtobufList emptyProtobufList() { - return ProtobufArrayList.emptyList(); - } - - public static ProtobufList mutableCopy(ProtobufList list) { - int size = list.size(); - return list.mutableCopyWithCapacity( - size == 0 ? AbstractProtobufList.DEFAULT_CAPACITY : size * 2); - } - - public static BooleanList emptyBooleanList() { - return BooleanArrayList.emptyList(); - } - - public static BooleanList newBooleanList() { - return new BooleanArrayList(); - } - - public static IntList emptyIntList() { - return IntArrayList.emptyList(); - } - - public static IntList newIntList() { - return new IntArrayList(); - } - - public static LongList emptyLongList() { - return LongArrayList.emptyList(); - } - - public static LongList newLongList() { - return new LongArrayList(); - } - - public static FloatList emptyFloatList() { - return FloatArrayList.emptyList(); - } - - public static FloatList newFloatList() { - return new FloatArrayList(); - } - - public static DoubleList emptyDoubleList() { - return DoubleArrayList.emptyList(); - } - - public static DoubleList newDoubleList() { - return new DoubleArrayList(); - } -} diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 26603ec15cbb..ebaacbb7bcfe 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -156,7 +156,6 @@ ProtoSyntax.java Protobuf.java ProtobufArrayList.java - ProtobufLists.java ProtocolStringList.java RawMessageInfo.java Reader.java diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From bed86285472f1161ffca4c4d5124d49c010e27dc Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 14 Dec 2022 23:00:54 +0000 Subject: [PATCH 39/43] Auto-generate files after cl/495424888 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From 6df908957ab5df447e3db2c7cf14fc735665bb87 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 14 Dec 2022 19:55:54 -0800 Subject: [PATCH 40/43] Internal changes PiperOrigin-RevId: 495485093 --- python/google/protobuf/__init__.py | 0 .../protobuf/internal/_parameterized.py | 26 +++++++++---------- src/file_lists.cmake | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) mode change 100644 => 100755 python/google/protobuf/__init__.py diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py old mode 100644 new mode 100755 diff --git a/python/google/protobuf/internal/_parameterized.py b/python/google/protobuf/internal/_parameterized.py index afdbb78c365b..2f4a3b6b734f 100755 --- a/python/google/protobuf/internal/_parameterized.py +++ b/python/google/protobuf/internal/_parameterized.py @@ -37,8 +37,8 @@ A simple example: - class AdditionExample(parameterized.TestCase): - @parameterized.parameters( + class AdditionExample(_parameterized.TestCase): + @_parameterized.parameters( (1, 2, 3), (4, 5, 9), (1, 1, 3)) @@ -54,8 +54,8 @@ def testAddition(self, op1, op2, result): Parameters for individual test cases can be tuples (with positional parameters) or dictionaries (with named parameters): - class AdditionExample(parameterized.TestCase): - @parameterized.parameters( + class AdditionExample(_parameterized.TestCase): + @_parameterized.parameters( {'op1': 1, 'op2': 2, 'result': 3}, {'op1': 4, 'op2': 5, 'result': 9}, ) @@ -82,8 +82,8 @@ def testAddition(self, op1, op2, result): be a string (or an object that returns an apt name when converted via str()): - class NamedExample(parameterized.TestCase): - @parameterized.named_parameters( + class NamedExample(_parameterized.TestCase): + @_parameterized.named_parameters( ('Normal', 'aa', 'aaa', True), ('EmptyPrefix', '', 'abc', True), ('BothEmpty', '', '', True)) @@ -106,10 +106,10 @@ def testStartsWith(self, prefix, string, result): TestCase class, instead of decorating all test methods individually, the class itself can be decorated: - @parameterized.parameters( + @_parameterized.parameters( (1, 2, 3) (4, 5, 9)) - class ArithmeticTest(parameterized.TestCase): + class ArithmeticTest(_parameterized.TestCase): def testAdd(self, arg1, arg2, result): self.assertEqual(arg1 + arg2, result) @@ -122,8 +122,8 @@ def testSubtract(self, arg2, arg2, result): created from other sources, a single non-tuple iterable can be passed into the decorator. This iterable will be used to obtain the test cases: - class AdditionExample(parameterized.TestCase): - @parameterized.parameters( + class AdditionExample(_parameterized.TestCase): + @_parameterized.parameters( c.op1, c.op2, c.result for c in testcases ) def testAddition(self, op1, op2, result): @@ -135,8 +135,8 @@ def testAddition(self, op1, op2, result): If a test method takes only one argument, the single argument does not need to be wrapped into a tuple: - class NegativeNumberExample(parameterized.TestCase): - @parameterized.parameters( + class NegativeNumberExample(_parameterized.TestCase): + @_parameterized.parameters( -1, -3, -4, -5 ) def testIsNegative(self, arg): @@ -423,7 +423,7 @@ def CoopTestCase(other_base_class): import google3 import mox - from google3.testing.pybase import parameterized + from google.protobuf.internal import _parameterized class ExampleTest(parameterized.CoopTestCase(mox.MoxTestBase)): ... diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From b5f83ddb905cee1d07fc39c0c63c73c1096897e0 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 15 Dec 2022 04:02:03 +0000 Subject: [PATCH 41/43] Auto-generate files after cl/495485093 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h From 9baae6adcb3793d435737c8e61b2f047e6b84515 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 14 Dec 2022 21:51:34 -0800 Subject: [PATCH 42/43] Clean up aarch64 tests. This bumps us to gcc 6 (rather than 4.8), which fully supports C++14, and migrates the Python tests to our Bazel-based system. C#, PHP, and Ruby will remain on CMake + alternate build system for now. PiperOrigin-RevId: 495501807 --- build_defs/arch_tests.bzl | 9 ++-- build_defs/internal_shell.bzl | 11 ++--- ...compile_and_run_tests_with_qemu_aarch64.sh | 18 -------- .../run_dockcross_linux_aarch64.sh | 36 --------------- .../run_dockcross_manylinux2014_aarch64.sh | 21 ++------- .../aarch64/python_crosscompile_aarch64.sh | 44 ------------------- .../python_run_tests_with_qemu_aarch64.sh | 28 ------------ kokoro/linux/aarch64/test_cpp_aarch64.sh | 14 ------ kokoro/linux/aarch64/test_java_aarch64.sh | 32 -------------- kokoro/linux/aarch64/test_python_aarch64.sh | 26 ----------- kokoro/linux/cpp_aarch64/common.cfg | 4 +- kokoro/linux/java_aarch64/common.cfg | 4 +- kokoro/linux/python_aarch64/build.sh | 13 ------ kokoro/linux/python_aarch64/common.cfg | 21 ++++++++- python/BUILD.bazel | 17 +++++++ src/file_lists.cmake | 2 +- src/google/protobuf/arena_align.h | 2 +- 17 files changed, 56 insertions(+), 246 deletions(-) delete mode 100755 kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh delete mode 100755 kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh delete mode 100755 kokoro/linux/aarch64/python_crosscompile_aarch64.sh delete mode 100755 kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh delete mode 100755 kokoro/linux/aarch64/test_cpp_aarch64.sh delete mode 100755 kokoro/linux/aarch64/test_java_aarch64.sh delete mode 100755 kokoro/linux/aarch64/test_python_aarch64.sh delete mode 100755 kokoro/linux/python_aarch64/build.sh diff --git a/build_defs/arch_tests.bzl b/build_defs/arch_tests.bzl index 61fa00c944f0..ba67cc61ba9a 100644 --- a/build_defs/arch_tests.bzl +++ b/build_defs/arch_tests.bzl @@ -24,13 +24,12 @@ def _arch_test_impl( name = name, tools = bazel_binaries, cmd = """ - for binary in "$(rootpaths %s) %s"; do + for binary in "%s"; do (file -L $$binary | grep -q "%s") \ || (echo "Test binary is not an %s binary: "; file -L $$binary; exit 1) done """ % ( - " ".join(bazel_binaries), - " ".join(system_binaries), + " ".join(["$(rootpaths %s)" % b for b in bazel_binaries] + system_binaries), file_platform, platform, ), @@ -44,13 +43,13 @@ def _arch_test_impl( def aarch64_test(**kwargs): _arch_test_impl( platform = "aarch64", - file_platform = "ELF 64-bit LSB executable, ARM aarch64", + file_platform = "ELF 64-bit LSB.* ARM aarch64", **kwargs ) def x86_64_test(**kwargs): _arch_test_impl( platform = "x86_64", - file_platform = "ELF 64-bit LSB executable, ARM x86_64", + file_platform = "ELF 64-bit LSB.*, ARM x86_64", **kwargs ) diff --git a/build_defs/internal_shell.bzl b/build_defs/internal_shell.bzl index 670c4d5f56bb..649184a5184c 100644 --- a/build_defs/internal_shell.bzl +++ b/build_defs/internal_shell.bzl @@ -9,7 +9,6 @@ def inline_sh_binary( tools = [], deps = [], cmd = "", - testonly = None, **kwargs): """Bazel rule to wrap up an inline bash script in a binary. @@ -28,8 +27,6 @@ def inline_sh_binary( deps: a list of dependency labels that are required to run this binary. cmd: the inline sh command to run. **kwargs: other keyword arguments that are passed to sh_binary. - testonly: common rule attribute (see: - https://bazel.build/reference/be/common-definitions#common-attributes) """ native.genrule( @@ -38,15 +35,16 @@ def inline_sh_binary( exec_tools = tools, outs = [name + ".sh"], cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd, - testonly = testonly, visibility = ["//visibility:private"], + tags = kwargs["tags"] if "tags" in kwargs else None, + target_compatible_with = kwargs["target_compatible_with"] if "target_compatible_with" in kwargs else None, + testonly = kwargs["testonly"] if "testonly" in kwargs else None, ) native.sh_binary( name = name, srcs = [name + "_genrule"], data = srcs + tools + deps, - testonly = testonly, **kwargs ) @@ -83,6 +81,9 @@ def inline_sh_test( outs = [name + ".sh"], cmd = "cat <<'EOF' >$(OUTS)\n#!/bin/bash -exu\n%s\nEOF\n" % cmd, visibility = ["//visibility:private"], + tags = kwargs["tags"] if "tags" in kwargs else None, + target_compatible_with = kwargs["target_compatible_with"] if "target_compatible_with" in kwargs else None, + testonly = kwargs["testonly"] if "testonly" in kwargs else None, ) native.sh_test( diff --git a/kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh deleted file mode 100755 index f7c45f950087..000000000000 --- a/kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -# Builds protobuf C++ with aarch64 crosscompiler and runs a basic set of tests under an emulator. -# NOTE: This script is expected to run under the dockcross/linux-arm64 docker image. - -set -ex - -# the build commands are expected to run under dockcross docker image -# where the CC, CXX and other toolchain variables already point to the crosscompiler -cmake . -make -j8 - -# check that the resulting test binary is indeed an aarch64 ELF -(file ./tests | grep -q "ELF 64-bit LSB executable, ARM aarch64") || (echo "Test binary in not an aarch64 binary"; exit 1) - -# run the basic set of C++ tests under QEMU -# there are other tests we could run (e.g. ./lite-test), but this is sufficient as a smoketest -qemu-aarch64 ./tests diff --git a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh deleted file mode 100755 index aca08bdd129a..000000000000 --- a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -e - -# go to the repo root -cd $(dirname $0)/../../../.. - -if [[ -t 0 ]]; then - DOCKER_TTY_ARGS="-it" -else - # The input device on kokoro is not a TTY, so -it does not work. - DOCKER_TTY_ARGS= -fi - -# Pin the dockcross image since newer versions of the image break the build -PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/linux-arm64:20210625-795dd4d - -# running dockcross image without any arguments generates a wrapper -# scripts that can be used to run commands under the dockcross image -# easily. -# See https://github.com/dockcross/dockcross#usage for details -docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-linux-arm64.sh -chmod +x dockcross-linux-arm64.sh - -# the wrapper script has CRLF line endings and bash doesn't like that -# so we change CRLF line endings into LF. -sed -i 's/\r//g' dockcross-linux-arm64.sh - -# The dockcross wrapper script runs arbitrary commands under the selected dockcross -# image with the following properties which make its use very convenient: -# * the current working directory is mounted under /work so the container can easily -# access the current workspace -# * the processes in the container run under the same UID and GID as the host process so unlike -# vanilla "docker run" invocations, the workspace doesn't get polluted with files -# owned by root. -./dockcross-linux-arm64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@" diff --git a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh index efaf40fb2f34..33a5cbdd7dea 100755 --- a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh +++ b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh @@ -1,9 +1,10 @@ #!/bin/bash -set -e +set -ex # go to the repo root cd $(dirname $0)/../../../.. +GIT_REPO_ROOT=`pwd` if [[ -t 0 ]]; then DOCKER_TTY_ARGS="-it" @@ -17,24 +18,10 @@ fi # before https://github.com/dockcross/dockcross/pull/449 # Thanks to that, wheel build with this image aren't actually # compliant with manylinux2014, but only with manylinux_2_24 -PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/manylinux2014-aarch64:20200929-608e6ac +PINNED_DOCKCROSS_IMAGE_VERSION=quay.io/pypa/manylinux_2_24_aarch64 # running dockcross image without any arguments generates a wrapper # scripts that can be used to run commands under the dockcross image # easily. # See https://github.com/dockcross/dockcross#usage for details -docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-manylinux2014-aarch64.sh -chmod +x dockcross-manylinux2014-aarch64.sh - -# the wrapper script has CRLF line endings and bash doesn't like that -# so we change CRLF line endings into LF. -sed -i 's/\r//g' dockcross-manylinux2014-aarch64.sh - -# The dockcross wrapper script runs arbitrary commands under the selected dockcross -# image with the following properties which make its use very convenient: -# * the current working directory is mounted under /work so the container can easily -# access the current workspace -# * the processes in the container run under the same UID and GID as the host process so unlike -# vanilla "docker run" invocations, the workspace doesn't get polluted with files -# owned by root. -./dockcross-manylinux2014-aarch64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@" +docker run -v $GIT_REPO_ROOT:/workspace --rm $PINNED_DOCKCROSS_IMAGE_VERSION /bin/bash -c "cd /workspace; git config --global --add safe.directory '*'; $@" diff --git a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh deleted file mode 100755 index a04c7e408c36..000000000000 --- a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# Builds protobuf python including the C++ extension with aarch64 crosscompiler. -# The outputs of this script are laid out so that we can later test them under an aarch64 emulator. -# NOTE: This script is expected to run under the dockcross/manylinux2014-aarch64 docker image. - -set -ex - -PYTHON="/opt/python/cp38-cp38/bin/python" - -# Initialize any submodules. -git submodule update --init --recursive - -# Build protoc and libprotobuf -cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_WITH_ZLIB=0 -Dprotobuf_BUILD_TESTS=OFF . -make -j8 - -# create a simple shell wrapper that runs crosscompiled protoc under qemu -echo '#!/bin/bash' >protoc_qemu_wrapper.sh -echo 'exec qemu-aarch64 "../protoc" "$@"' >>protoc_qemu_wrapper.sh -chmod ugo+x protoc_qemu_wrapper.sh - -# PROTOC variable is by build_py step that runs under ./python directory -export PROTOC=../protoc_qemu_wrapper.sh - -pushd python - -# NOTE: this step will use protoc_qemu_wrapper.sh to generate protobuf files. -${PYTHON} setup.py build_py - -# when crosscompiling for aarch64, --plat-name needs to be set explicitly -# to end up with correctly named wheel file -# the value should be manylinuxABC_ARCH and dockcross docker image -# conveniently provides the value in the AUDITWHEEL_PLAT env -plat_name_flag="--plat-name=$AUDITWHEEL_PLAT" - -# override the value of EXT_SUFFIX to make sure the crosscompiled .so files in the wheel have the correct filename suffix -export PROTOCOL_BUFFERS_OVERRIDE_EXT_SUFFIX="$(${PYTHON} -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX").replace("-x86_64-linux-gnu.so", "-aarch64-linux-gnu.so"))')" - -# Build the python extension inplace to be able to python unittests later -${PYTHON} setup.py build_ext --cpp_implementation --compile_static_extension --inplace - -# Build the binary wheel (to check it with auditwheel) -${PYTHON} setup.py bdist_wheel --cpp_implementation --compile_static_extension $plat_name_flag diff --git a/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh deleted file mode 100755 index 4c75ad8110b4..000000000000 --- a/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -set -ex - -# go to the repo root -cd $(dirname $0)/../../.. -cd python - -PYTHON="/opt/python/cp38-cp38/bin/python" -${PYTHON} -m pip install --user pytest auditwheel numpy - -# check that we are really using aarch64 python -(${PYTHON} -c 'import sysconfig; print(sysconfig.get_platform())' | grep -q "linux-aarch64") || (echo "Wrong python platform, needs to be aarch64 python."; exit 1) - -# step 1: run all python unittests -# we've built the python extension previously with --inplace option -# so we can just discover all the unittests and run them directly under -# the python/ directory. -LD_LIBRARY_PATH=. PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -m pytest google/protobuf - -# step 2: run auditwheel show to check that the wheel is manylinux2014 compatible. -# auditwheel needs to run on wheel's target platform (or under an emulator) -${PYTHON} -m auditwheel show dist/protobuf-*-manylinux2014_aarch64.whl - -# step 3: smoketest that the wheel can be installed and run a smokecheck -${PYTHON} -m pip install dist/protobuf-*-manylinux2014_aarch64.whl -# when python cpp extension is on, simply importing a message type will trigger loading the cpp extension -PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -c 'import google.protobuf.timestamp_pb2; print("Successfully loaded the python cpp extension!")' diff --git a/kokoro/linux/aarch64/test_cpp_aarch64.sh b/kokoro/linux/aarch64/test_cpp_aarch64.sh deleted file mode 100755 index 26f95f323caf..000000000000 --- a/kokoro/linux/aarch64/test_cpp_aarch64.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -# Crosscompiles protobuf C++ under dockcross docker image and runs the tests under an emulator. - -set -e - -# go to the repo root -cd $(dirname $0)/../../.. - -# Initialize any submodules. -git submodule update --init --recursive - -# run the C++ build and test script under dockcross/linux-arm64 image -kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh diff --git a/kokoro/linux/aarch64/test_java_aarch64.sh b/kokoro/linux/aarch64/test_java_aarch64.sh deleted file mode 100755 index a80665907cab..000000000000 --- a/kokoro/linux/aarch64/test_java_aarch64.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -set -ex - -# go to the repo root -cd $(dirname $0)/../../.. - -if [[ -t 0 ]]; then - DOCKER_TTY_ARGS="-it" -else - # The input device on kokoro is not a TTY, so -it does not work. - DOCKER_TTY_ARGS= -fi - -# crosscompile protoc as we will later need it for the java build. -# we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible -# with a wide range of linux distros (including any docker images we will use later to build and test java) -kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh - -# the command that will be used to build and test java under an emulator -# * IsValidUtf8Test and DecodeUtf8Test tests are skipped because they take very long under an emulator. -TEST_JAVA_COMMAND="mvn --batch-mode -DskipTests install && mvn --batch-mode -Dtest='**/*Test, !**/*IsValidUtf8Test, !**/*DecodeUtf8Test' -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false surefire:test" - -# use an actual aarch64 docker image (with a real aarch64 java and maven) to run build & test protobuf java under an emulator -# * mount the protobuf root as /work to be able to access the crosscompiled files -# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force -# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user -# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity, -# we just run map the user's home to a throwaway temporary directory -# * the JAVA_OPTS and MAVEN_CONFIG variables are being set mostly to silence warnings about non-existent home directory -# and to avoid polluting the workspace. -docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "JAVA_OPTS=-Duser.home=/home/fake-user" -e "MAVEN_CONFIG=/home/fake-user/.m2" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work arm64v8/maven:3.8-openjdk-11 bash -c "cd java && $TEST_JAVA_COMMAND" diff --git a/kokoro/linux/aarch64/test_python_aarch64.sh b/kokoro/linux/aarch64/test_python_aarch64.sh deleted file mode 100755 index 1e2d57021f51..000000000000 --- a/kokoro/linux/aarch64/test_python_aarch64.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e - -# go to the repo root -cd $(dirname $0)/../../.. - -if [[ -t 0 ]]; then - DOCKER_TTY_ARGS="-it" -else - # The input device on kokoro is not a TTY, so -it does not work. - DOCKER_TTY_ARGS= -fi - -# crosscompile python extension and the binary wheel under dockcross/manylinux2014-aarch64 image -kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/python_crosscompile_aarch64.sh - -# once crosscompilation is done, use an actual aarch64 docker image (with a real aarch64 python) to run all the tests under an emulator -# * mount the protobuf root as /work to be able to access the crosscompiled files -# * intentionally use a different image than manylinux2014 so that we don't build and test on the same linux distribution -# (manylinux_2_24 is debian-based while manylinux2014 is centos-based) -# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force -# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user -# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity, -# we just run map the user's home to a throwaway temporary directory -docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work quay.io/pypa/manylinux_2_24_aarch64 kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh diff --git a/kokoro/linux/cpp_aarch64/common.cfg b/kokoro/linux/cpp_aarch64/common.cfg index f77f73b928ca..4b38c2c71812 100644 --- a/kokoro/linux/cpp_aarch64/common.cfg +++ b/kokoro/linux/cpp_aarch64/common.cfg @@ -6,12 +6,12 @@ timeout_mins: 120 env_vars { key: "CONTAINER_IMAGE" - value: "gcr.io/protobuf-build/emulation/linux:aarch64-4e847d7a01c1792471b6dd985ab0bf2677332e6f" + value: "gcr.io/protobuf-build/emulation/linux:aarch64-8c600b1add46ab66e9cb15b893be175fe464dcbb" } env_vars { key: "BAZEL_TARGETS" - value: "//src/..." + value: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test" } action { diff --git a/kokoro/linux/java_aarch64/common.cfg b/kokoro/linux/java_aarch64/common.cfg index 75e3f0bddb17..9879e7b29c84 100644 --- a/kokoro/linux/java_aarch64/common.cfg +++ b/kokoro/linux/java_aarch64/common.cfg @@ -6,12 +6,12 @@ timeout_mins: 120 env_vars { key: "CONTAINER_IMAGE" - value: "gcr.io/protobuf-build/emulation/linux:aarch64-4e847d7a01c1792471b6dd985ab0bf2677332e6f" + value: "gcr.io/protobuf-build/emulation/linux:aarch64-8c600b1add46ab66e9cb15b893be175fe464dcbb" } env_vars { key: "BAZEL_TARGETS" - value: "//java/..." + value: "//java/... //src/google/protobuf/compiler:protoc_aarch64_test" } action { diff --git a/kokoro/linux/python_aarch64/build.sh b/kokoro/linux/python_aarch64/build.sh deleted file mode 100755 index 2c67396462a6..000000000000 --- a/kokoro/linux/python_aarch64/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# -# This is the top-level script we give to Kokoro as the entry point for -# running the "continuous" and "presubmit" jobs. - -set -ex - -# Change to repo root -cd $(dirname $0)/../../.. - -kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh - -kokoro/linux/aarch64/test_python_aarch64.sh diff --git a/kokoro/linux/python_aarch64/common.cfg b/kokoro/linux/python_aarch64/common.cfg index dee4a47367be..0b636da72af5 100644 --- a/kokoro/linux/python_aarch64/common.cfg +++ b/kokoro/linux/python_aarch64/common.cfg @@ -1,11 +1,28 @@ # Config file for running tests in Kokoro # Location of the build script in repository -build_file: "protobuf/kokoro/linux/python_aarch64/build.sh" +build_file: "protobuf/kokoro/linux/bazel.sh" timeout_mins: 120 +env_vars { + key: "CONTAINER_IMAGE" + value: "gcr.io/protobuf-build/emulation/linux:aarch64-8c600b1add46ab66e9cb15b893be175fe464dcbb" +} + +env_vars { + key: "BAZEL_TARGETS" + value: "//python/... //python:aarch64_test" +} + +env_vars { + key: "BAZEL_EXTRA_FLAGS" + value: "--define=use_fast_cpp_protos=true " + # TODO(b/262628111) Enable this once conformance tests are fixed. + "--test_tag_filters=-conformance" +} + action { define_artifacts { - regex: "**/sponge_log.xml" + regex: "**/sponge_log.*" } } diff --git a/python/BUILD.bazel b/python/BUILD.bazel index d40e76ab088b..cc0772cb78dd 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -10,6 +10,7 @@ load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_python//python:defs.bzl", "py_library") load("@pip_deps//:requirements.bzl", "requirement") load("//:protobuf.bzl", "internal_py_proto_library") +load("//build_defs:arch_tests.bzl", "aarch64_test", "x86_64_test") load("//build_defs:cpp_opts.bzl", "COPTS") load("//conformance:defs.bzl", "conformance_test") load(":internal.bzl", "internal_copy_files", "internal_py_test") @@ -118,6 +119,22 @@ cc_binary( }), ) +aarch64_test( + name = "aarch64_test", + bazel_binaries = [ + "google/protobuf/internal/_api_implementation.so", + "google/protobuf/pyext/_message.so", + ], +) + +x86_64_test( + name = "x86_64_test", + bazel_binaries = [ + "google/protobuf/internal/_api_implementation.so", + "google/protobuf/pyext/_message.so", + ], +) + py_library( name = "python_srcs", srcs = glob( diff --git a/src/file_lists.cmake b/src/file_lists.cmake index 9faaf622260f..b7367effb682 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h diff --git a/src/google/protobuf/arena_align.h b/src/google/protobuf/arena_align.h index 6b4718e482bc..573caf3a9637 100644 --- a/src/google/protobuf/arena_align.h +++ b/src/google/protobuf/arena_align.h @@ -145,7 +145,7 @@ struct ArenaAlign { constexpr size_t Ceil(size_t n) const { return (n + align - 1) & -align; } constexpr size_t Floor(size_t n) const { return (n & ~(align - 1)); } - size_t Padded(size_t n) const { + constexpr size_t Padded(size_t n) const { // TODO(mvels): there are direct callers of AllocateAligned() that violate // `size` being a multiple of `align`: that should be an error / assert. // ABSL_ASSERT(IsAligned(n)); From 08ad73b58ecde2c9c06605ab924ab956cb581f91 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 15 Dec 2022 05:56:56 +0000 Subject: [PATCH 43/43] Auto-generate files after cl/495501807 --- src/file_lists.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_lists.cmake b/src/file_lists.cmake index b7367effb682..9faaf622260f 100644 --- a/src/file_lists.cmake +++ b/src/file_lists.cmake @@ -168,8 +168,8 @@ set(libprotobuf_hdrs ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h - ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/serial_arena.h + ${protobuf_SOURCE_DIR}/src/google/protobuf/service.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h