diff options
author | heretic <heretic@yandex-team.ru> | 2022-06-14 13:29:31 +0300 |
---|---|---|
committer | heretic <heretic@yandex-team.ru> | 2022-06-14 13:29:31 +0300 |
commit | 16f8be4f481c275c34795233c18f8d078382fcb3 (patch) | |
tree | 2363f1306ce2e17e72c0a48614256acd046990e6 | |
parent | 647dc68b78e469e5ab416e9b62885c9846fd511d (diff) | |
download | ydb-16f8be4f481c275c34795233c18f8d078382fcb3.tar.gz |
Update protobuf to 3.18.1
ref:4846abb21711ea0dc148d4c5df7b5edd3d1bdc69
203 files changed, 14387 insertions, 9366 deletions
diff --git a/build/prebuilt/contrib/tools/protoc/ya.make.induced_deps b/build/prebuilt/contrib/tools/protoc/ya.make.induced_deps index fe5a21c374..55ede44772 100644 --- a/build/prebuilt/contrib/tools/protoc/ya.make.induced_deps +++ b/build/prebuilt/contrib/tools/protoc/ya.make.induced_deps @@ -13,6 +13,7 @@ INDUCED_DEPS(h+cpp ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/arenastring.h ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/extension_set.h ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/generated_enum_reflection.h + ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.h ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h ${ARCADIA_ROOT}/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h diff --git a/build/prebuilt/contrib/tools/protoc/ya.make.resource b/build/prebuilt/contrib/tools/protoc/ya.make.resource index 3ff7d7d89a..3322a63ad9 100644 --- a/build/prebuilt/contrib/tools/protoc/ya.make.resource +++ b/build/prebuilt/contrib/tools/protoc/ya.make.resource @@ -1,9 +1,9 @@ IF (OS_DARWIN AND ARCH_X86_64) - SET(SANDBOX_RESOURCE_ID 2811816665) + SET(SANDBOX_RESOURCE_ID 3190481428) ELSEIF (OS_LINUX AND ARCH_X86_64) - SET(SANDBOX_RESOURCE_ID 2811817121) + SET(SANDBOX_RESOURCE_ID 3190481835) ELSEIF (OS_WINDOWS AND ARCH_X86_64) - SET(SANDBOX_RESOURCE_ID 2811816165) + SET(SANDBOX_RESOURCE_ID 3190481028) ELSE() SET(SANDBOX_RESOURCE_ID) ENDIF() diff --git a/contrib/libs/protobuf/.yandex_meta/devtools.copyrights.report b/contrib/libs/protobuf/.yandex_meta/devtools.copyrights.report index dbb7524e8e..8f4e82e7a6 100644 --- a/contrib/libs/protobuf/.yandex_meta/devtools.copyrights.report +++ b/contrib/libs/protobuf/.yandex_meta/devtools.copyrights.report @@ -86,12 +86,12 @@ BELONGS ya.make src/google/protobuf/extension_set.h [2:2] src/google/protobuf/extension_set_heavy.cc [2:2] src/google/protobuf/extension_set_inl.h [2:2] - src/google/protobuf/field_access_listener.cc [2:2] - src/google/protobuf/field_access_listener.h [2:2] src/google/protobuf/field_mask.proto [2:2] src/google/protobuf/generated_enum_reflection.h [2:2] src/google/protobuf/generated_enum_util.cc [2:2] src/google/protobuf/generated_enum_util.h [2:2] + src/google/protobuf/generated_message_bases.cc [2:2] + src/google/protobuf/generated_message_bases.h [2:2] src/google/protobuf/generated_message_reflection.cc [2:2] src/google/protobuf/generated_message_reflection.h [2:2] src/google/protobuf/generated_message_table_driven.cc [2:2] @@ -106,6 +106,8 @@ BELONGS ya.make src/google/protobuf/has_bits.h [2:2] src/google/protobuf/implicit_weak_message.cc [2:2] src/google/protobuf/implicit_weak_message.h [2:2] + src/google/protobuf/inlined_string_field.cc [2:2] + src/google/protobuf/inlined_string_field.h [2:2] src/google/protobuf/io/coded_stream.cc [2:2] src/google/protobuf/io/coded_stream.h [2:2] src/google/protobuf/io/gzip_stream.cc [2:2] diff --git a/contrib/libs/protobuf/.yandex_meta/devtools.licenses.report b/contrib/libs/protobuf/.yandex_meta/devtools.licenses.report index 975855f0bf..daf209a41a 100644 --- a/contrib/libs/protobuf/.yandex_meta/devtools.licenses.report +++ b/contrib/libs/protobuf/.yandex_meta/devtools.licenses.report @@ -31,7 +31,7 @@ SKIP CC-BY-4.0 0e41e61e59ce22134d560f0888c92f3a BELONGS ya.make -FILE_IGNORE src/google/protobuf/util/internal/json_stream_parser.cc found in files: CHANGES.txt at line 517 +FILE_IGNORE src/google/protobuf/util/internal/json_stream_parser.cc found in files: CHANGES.txt at line 591 License text: * Improves performance of json_stream_parser.cc by factor 1000 (#7230) Scancode info: @@ -40,7 +40,7 @@ FILE_IGNORE src/google/protobuf/util/internal/json_stream_parser.cc found in fil Match type : REFERENCE Links : http://creativecommons.org/licenses/by/4.0/, http://creativecommons.org/licenses/by/4.0/legalcode, https://spdx.org/licenses/CC-BY-4.0 Files with this license: - CHANGES.txt [517:517] + CHANGES.txt [591:591] SKIP BSD-3-Clause 37699d6edc78bcd9e06fd0dbc68720e1 BELONGS ya.make @@ -53,7 +53,7 @@ BELONGS ya.make Match type : REFERENCE Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause Files with this license: - CHANGES.txt [2776:2776] + CHANGES.txt [2850:2850] SKIP Apache-2.0 3f6cb5f9815c6f54e808b56a203ac513 BELONGS ya.make @@ -66,7 +66,7 @@ BELONGS ya.make Match type : REFERENCE Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0 Files with this license: - CHANGES.txt [2776:2776] + CHANGES.txt [2850:2850] KEEP BSD-3-Clause 6aa235708ac9f5dd8e5c6ac415fc5837 BELONGS ya.make @@ -100,12 +100,12 @@ BELONGS ya.make src/google/protobuf/extension_set.h [5:29] src/google/protobuf/extension_set_heavy.cc [5:29] src/google/protobuf/extension_set_inl.h [5:29] - src/google/protobuf/field_access_listener.cc [5:29] - src/google/protobuf/field_access_listener.h [5:29] src/google/protobuf/field_mask.proto [5:29] src/google/protobuf/generated_enum_reflection.h [5:29] src/google/protobuf/generated_enum_util.cc [5:29] src/google/protobuf/generated_enum_util.h [5:29] + src/google/protobuf/generated_message_bases.cc [5:29] + src/google/protobuf/generated_message_bases.h [5:29] src/google/protobuf/generated_message_reflection.cc [5:29] src/google/protobuf/generated_message_reflection.h [5:29] src/google/protobuf/generated_message_table_driven.cc [5:29] @@ -120,6 +120,8 @@ BELONGS ya.make src/google/protobuf/has_bits.h [5:29] src/google/protobuf/implicit_weak_message.cc [5:29] src/google/protobuf/implicit_weak_message.h [5:29] + src/google/protobuf/inlined_string_field.cc [5:29] + src/google/protobuf/inlined_string_field.h [5:29] src/google/protobuf/io/coded_stream.cc [5:29] src/google/protobuf/io/coded_stream.h [5:29] src/google/protobuf/io/gzip_stream.cc [5:29] diff --git a/contrib/libs/protobuf/CHANGES.txt b/contrib/libs/protobuf/CHANGES.txt index d3f4e019a4..69207d6ae9 100644 --- a/contrib/libs/protobuf/CHANGES.txt +++ b/contrib/libs/protobuf/CHANGES.txt @@ -1,3 +1,77 @@ +2021-10-04 version 3.18.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Python + * Update setup.py to reflect that we now require at least Python 3.5 (#8989) + * Performance fix for DynamicMessage: force GetRaw() to be inlined (#9023) + + Ruby + * Update ruby_generator.cc to allow proto2 imports in proto3 (#9003) + +2021-09-13 version 3.18.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + C++ + * Fix warnings raised by clang 11 (#8664) + * Make StringPiece constructible from std::string_view (#8707) + * Add missing capability attributes for LLVM 12 (#8714) + * Stop using std::iterator (deprecated in C++17). (#8741) + * Move field_access_listener from libprotobuf-lite to libprotobuf (#8775) + * Fix #7047 Safely handle setlocale (#8735) + * Remove deprecated version of SetTotalBytesLimit() (#8794) + * Support arena allocation of google::protobuf::AnyMetadata (#8758) + * Fix undefined symbol error around SharedCtor() (#8827) + * Fix default value of enum(int) in json_util with proto2 (#8835) + * Better Smaller ByteSizeLong + * Introduce event filters for inject_field_listener_events + * Reduce memory usage of DescriptorPool + * For lazy fields copy serialized form when allowed. + * Re-introduce the InlinedStringField class + * v2 access listener + * Reduce padding in the proto's ExtensionRegistry map. + * GetExtension performance optimizations + * Make tracker a static variable rather than call static functions + * Support extensions in field access listener + * Annotate MergeFrom for field access listener + * Fix incomplete types for field access listener + * Add map_entry/new_map_entry to SpecificField in MessageDifferencer. They + record the map items which are different in MessageDifferencer's reporter. + * Reduce binary size due to fieldless proto messages + * TextFormat: ParseInfoTree supports getting field end location in addition to + start. + * Fix repeated enum extension size in field listener + * Enable Any Text Expansion for Descriptors::DebugString() + * Switch from int{8,16,32,64} to int{8,16,32,64}_t + + Java + * Fix errorprone conflict (#8723) + * Removing deprecated TimeUtil class. (#8749) + * Optimized FieldDescriptor.valueOf() to avoid array copying. + * Removing deprecated TimeUtil class. + * Add Durations.parseUnchecked(String) and Timestamps.parseUnchecked(String) + * FieldMaskUtil: Add convenience method to mask the fields out of a given proto. + + JavaScript + * Optimize binary parsing of repeated float64 + * Fix for optimization when reading doubles from binary wire format + * Replace toArray implementation with toJSON. + + Python + * Drops support for 2.7 and 3.5. + + PHP + * Migrate PHP & Ruby to ABSL wyhash (#8854) + * Added support for PHP 8.1 (currently in RC1) to the C extension (#8964) + * Fixed PHP SEGV when constructing messages from a destructor. (#8969) + + Ruby + * Move DSL implementation from C to pure Ruby (#8850) + * Fixed a memory bug with RepeatedField#+. (#8970) + + Other + * [csharp] ByteString.CreateCodedInput should use ArraySegment offset and count (#8740) + * [ObjC] Add support for using the proto package to prefix symbols. (#8760) + * field_presence.md: fix Go example (#8788) + + 2021-06-04 version 3.17.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) C++ * Introduce FieldAccessListener. @@ -277,7 +351,7 @@ collection directly instead of using the other methods of the BaseContainer. * MessageFactory.CreateProtoype can be overridden to customize class creation. * Fix PyUnknownFields memory leak (#7928) - * Add macOS big sur compatibility (#8126) + * Add macOS Big Sur compatibility (#8126) JavaScript * Generate `getDescriptor` methods with `*` as their `this` type. diff --git a/contrib/libs/protobuf/CMakeLists.txt b/contrib/libs/protobuf/CMakeLists.txt index beeb126b7f..50dec0e151 100644 --- a/contrib/libs/protobuf/CMakeLists.txt +++ b/contrib/libs/protobuf/CMakeLists.txt @@ -37,13 +37,14 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/extension_set.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc - ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/field_access_listener.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_enum_util.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/io/io_win32.cc diff --git a/contrib/libs/protobuf/SECURITY.md b/contrib/libs/protobuf/SECURITY.md new file mode 100644 index 0000000000..76a40ee066 --- /dev/null +++ b/contrib/libs/protobuf/SECURITY.md @@ -0,0 +1,4 @@ +To report security concerns or vulnerabilities within protobuf, please use +Google's official channel for reporting these. + +https://www.google.com/appserve/security-bugs/m2/new diff --git a/contrib/libs/protobuf/src/README.md b/contrib/libs/protobuf/src/README.md index ec4901d894..51d9e2fe38 100644 --- a/contrib/libs/protobuf/src/README.md +++ b/contrib/libs/protobuf/src/README.md @@ -1,8 +1,6 @@ Protocol Buffers - Google's data interchange format =================================================== -[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fcpp_distcheck%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-bazel.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fbazel%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-cpp_distcheck.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fcpp_distcheck%2Fcontinuous) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) - Copyright 2008 Google Inc. https://developers.google.com/protocol-buffers/ diff --git a/contrib/libs/protobuf/src/google/protobuf/any.pb.cc b/contrib/libs/protobuf/src/google/protobuf/any.pb.cc index 66b731e296..0bef6281b4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/any.pb.cc @@ -38,19 +38,20 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Any, type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Any, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, value_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Any)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Any)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Any_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Any_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fany_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -175,7 +176,8 @@ const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bytes value = 2; case 2: @@ -183,28 +185,29 @@ const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern auto str = _internal_mutable_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -260,13 +263,7 @@ size_t Any::ByteSizeLong() const { this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = { @@ -275,8 +272,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Any::GetClassData() const { return &_class_data_; } -void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Any *>(to)->MergeFrom( static_cast<const Any &>(from)); } @@ -310,16 +307,18 @@ bool Any::IsInitialized() const { void Any::InternalSwap(Any* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &type_url_, GetArenaForAllocation(), - &other->type_url_, other->GetArenaForAllocation() + &type_url_, lhs_arena, + &other->type_url_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &value_, GetArenaForAllocation(), - &other->value_, other->GetArenaForAllocation() + &value_, lhs_arena, + &other->value_, rhs_arena ); } @@ -332,8 +331,8 @@ void Any::InternalSwap(Any* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Any >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Any >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Any >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Any >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/any.pb.h b/contrib/libs/protobuf/src/google/protobuf/any.pb.h index f45f983ffb..fd7af0bf34 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/any.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -59,7 +59,7 @@ struct AnyDefaultTypeInternal; PROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Any>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Any* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Any final : } inline Any& operator=(Any&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -175,7 +179,7 @@ class PROTOBUF_EXPORT Any final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Any& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.cc b/contrib/libs/protobuf/src/google/protobuf/api.pb.cc index b2e14d1836..5cca2f161d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/api.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/api.pb.cc @@ -75,47 +75,50 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, methods_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, version_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, source_context_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, mixins_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Api, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, methods_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, version_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, source_context_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, mixins_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, syntax_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, request_type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, request_streaming_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, response_type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, response_streaming_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Method, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, request_type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, request_streaming_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, response_type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, response_streaming_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Method, syntax_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Mixin, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Mixin, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Mixin, root_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Mixin, root_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Api)}, - { 12, -1, sizeof(PROTOBUF_NAMESPACE_ID::Method)}, - { 24, -1, sizeof(PROTOBUF_NAMESPACE_ID::Mixin)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Api)}, + { 13, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Method)}, + { 26, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Mixin)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Api_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Method_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Mixin_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Api_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Method_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Mixin_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fapi_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -162,10 +165,10 @@ PROTOBUF_NAMESPACE_OPEN class Api::_Internal { public: - static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg); + static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg); }; -const PROTOBUF_NAMESPACE_ID::SourceContext& +const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_Internal::source_context(const Api* msg) { return *msg->source_context_; } @@ -207,7 +210,7 @@ Api::Api(const Api& from) GetArenaForAllocation()); } if (from._internal_has_source_context()) { - source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); + source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; } @@ -280,7 +283,8 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Method methods = 2; case 2: @@ -292,7 +296,8 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 3; case 3: @@ -304,7 +309,8 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string version = 4; case 4: @@ -313,14 +319,16 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.version")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.SourceContext source_context = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Mixin mixins = 6; case 6: @@ -332,36 +340,38 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Syntax syntax = 7; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_syntax(static_cast<PROTOBUF_NAMESPACE_ID::Syntax>(val)); - } else goto handle_unusual; + _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -494,13 +504,7 @@ size_t Api::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Api::_class_data_ = { @@ -509,8 +513,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Api::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Api::GetClassData() const { return &_class_data_; } -void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Api *>(to)->MergeFrom( static_cast<const Api &>(from)); } @@ -532,7 +536,7 @@ void Api::MergeFrom(const Api& from) { _internal_set_version(from._internal_version()); } if (from._internal_has_source_context()) { - _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); + _internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } if (from._internal_syntax() != 0) { _internal_set_syntax(from._internal_syntax()); @@ -553,19 +557,21 @@ bool Api::IsInitialized() const { void Api::InternalSwap(Api* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); methods_.InternalSwap(&other->methods_); options_.InternalSwap(&other->options_); mixins_.InternalSwap(&other->mixins_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &version_, GetArenaForAllocation(), - &other->version_, other->GetArenaForAllocation() + &version_, lhs_arena, + &other->version_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(Api, syntax_) @@ -688,7 +694,8 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string request_type_url = 2; case 2: @@ -697,14 +704,16 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.request_type_url")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bool request_streaming = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string response_type_url = 4; case 4: @@ -713,14 +722,16 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.response_type_url")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bool response_streaming = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 6; case 6: @@ -732,36 +743,38 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Syntax syntax = 7; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_syntax(static_cast<PROTOBUF_NAMESPACE_ID::Syntax>(val)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -888,13 +901,7 @@ size_t Method::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Method::_class_data_ = { @@ -903,8 +910,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Method::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Method::GetClassData() const { return &_class_data_; } -void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Method *>(to)->MergeFrom( static_cast<const Method &>(from)); } @@ -951,22 +958,24 @@ bool Method::IsInitialized() const { void Method::InternalSwap(Method* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); options_.InternalSwap(&other->options_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &request_type_url_, GetArenaForAllocation(), - &other->request_type_url_, other->GetArenaForAllocation() + &request_type_url_, lhs_arena, + &other->request_type_url_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &response_type_url_, GetArenaForAllocation(), - &other->response_type_url_, other->GetArenaForAllocation() + &response_type_url_, lhs_arena, + &other->response_type_url_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(Method, syntax_) @@ -1065,7 +1074,8 @@ const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string root = 2; case 2: @@ -1074,28 +1084,29 @@ const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.root")); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1155,13 +1166,7 @@ size_t Mixin::ByteSizeLong() const { this->_internal_root()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mixin::_class_data_ = { @@ -1170,8 +1175,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mixin::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Mixin::GetClassData() const { return &_class_data_; } -void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Mixin *>(to)->MergeFrom( static_cast<const Mixin &>(from)); } @@ -1205,16 +1210,18 @@ bool Mixin::IsInitialized() const { void Mixin::InternalSwap(Mixin* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &root_, GetArenaForAllocation(), - &other->root_, other->GetArenaForAllocation() + &root_, lhs_arena, + &other->root_, rhs_arena ); } @@ -1227,14 +1234,14 @@ void Mixin::InternalSwap(Mixin* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Api >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Api >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Api >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Api >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Method >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Method >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Method >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Method >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Mixin >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Mixin >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Mixin >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Mixin >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.h b/contrib/libs/protobuf/src/google/protobuf/api.pb.h index 09482c7fee..34f4fca0c9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/api.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/api.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -67,9 +67,9 @@ struct MixinDefaultTypeInternal; PROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Api>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Method>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Mixin>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Api* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Api>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Method* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Method>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Mixin* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Mixin>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -94,7 +94,11 @@ class PROTOBUF_EXPORT Api final : } inline Api& operator=(Api&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -152,7 +156,7 @@ class PROTOBUF_EXPORT Api final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Api& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -204,16 +208,16 @@ class PROTOBUF_EXPORT Api final : int _internal_methods_size() const; public: void clear_methods(); - PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* + ::PROTOBUF_NAMESPACE_ID::Method* mutable_methods(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* mutable_methods(); private: - const PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; - PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); + const ::PROTOBUF_NAMESPACE_ID::Method& _internal_methods(int index) const; + ::PROTOBUF_NAMESPACE_ID::Method* _internal_add_methods(); public: - const PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; - PROTOBUF_NAMESPACE_ID::Method* add_methods(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& + const ::PROTOBUF_NAMESPACE_ID::Method& methods(int index) const; + ::PROTOBUF_NAMESPACE_ID::Method* add_methods(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& methods() const; // repeated .google.protobuf.Option options = 3; @@ -222,16 +226,16 @@ class PROTOBUF_EXPORT Api final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // repeated .google.protobuf.Mixin mixins = 6; @@ -240,16 +244,16 @@ class PROTOBUF_EXPORT Api final : int _internal_mixins_size() const; public: void clear_mixins(); - PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* + ::PROTOBUF_NAMESPACE_ID::Mixin* mutable_mixins(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* mutable_mixins(); private: - const PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; - PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); + const ::PROTOBUF_NAMESPACE_ID::Mixin& _internal_mixins(int index) const; + ::PROTOBUF_NAMESPACE_ID::Mixin* _internal_add_mixins(); public: - const PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; - PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& + const ::PROTOBUF_NAMESPACE_ID::Mixin& mixins(int index) const; + ::PROTOBUF_NAMESPACE_ID::Mixin* add_mixins(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& mixins() const; // string name = 1; @@ -286,25 +290,25 @@ class PROTOBUF_EXPORT Api final : bool _internal_has_source_context() const; public: void clear_source_context(); - const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); - PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); - void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); + void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); private: - const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; - PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + ::PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); public: void unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context); - PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + ::PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 7; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Api) @@ -314,12 +318,12 @@ class PROTOBUF_EXPORT Api final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method > methods_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin > mixins_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method > methods_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin > mixins_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; - PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; int syntax_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fapi_2eproto; @@ -345,7 +349,11 @@ class PROTOBUF_EXPORT Method final : } inline Method& operator=(Method&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -403,7 +411,7 @@ class PROTOBUF_EXPORT Method final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Method& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -455,16 +463,16 @@ class PROTOBUF_EXPORT Method final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 1; @@ -529,11 +537,11 @@ class PROTOBUF_EXPORT Method final : // .google.protobuf.Syntax syntax = 7; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Method) @@ -543,7 +551,7 @@ class PROTOBUF_EXPORT Method final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr request_type_url_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr response_type_url_; @@ -574,7 +582,11 @@ class PROTOBUF_EXPORT Mixin final : } inline Mixin& operator=(Mixin&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -632,7 +644,7 @@ class PROTOBUF_EXPORT Mixin final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Mixin& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -780,31 +792,31 @@ inline int Api::methods_size() const { inline void Api::clear_methods() { methods_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::mutable_methods(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) return methods_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >* Api::mutable_methods() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) return &methods_; } -inline const PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::_internal_methods(int index) const { return methods_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Method& Api::methods(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) return _internal_methods(index); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::_internal_add_methods() { return methods_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { - PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods(); +inline ::PROTOBUF_NAMESPACE_ID::Method* Api::add_methods() { + ::PROTOBUF_NAMESPACE_ID::Method* _add = _internal_add_methods(); // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Method >& Api::methods() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) return methods_; @@ -817,31 +829,31 @@ inline int Api::_internal_options_size() const { inline int Api::options_size() const { return _internal_options_size(); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Api::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Api::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Api::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Api.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Api::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.options) return options_; @@ -900,17 +912,17 @@ inline bool Api::_internal_has_source_context() const { inline bool Api::has_source_context() const { return _internal_has_source_context(); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { - const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::SourceContext&>( - PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::_internal_source_context() const { + const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::SourceContext&>( + ::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Api::source_context() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) return _internal_source_context(); } inline void Api::unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); } @@ -922,9 +934,9 @@ inline void Api::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.source_context) } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -937,27 +949,27 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::release_source_context() { #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::unsafe_arena_release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context) - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() { if (source_context_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); source_context_ = p; } return source_context_; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Api::mutable_source_context() { + ::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) return _msg; } -inline void Api::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { +inline void Api::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); @@ -989,31 +1001,31 @@ inline int Api::mixins_size() const { inline void Api::clear_mixins() { mixins_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::mutable_mixins(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins) return mixins_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >* Api::mutable_mixins() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins) return &mixins_; } -inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::_internal_mixins(int index) const { return mixins_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Mixin& Api::mixins(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins) return _internal_mixins(index); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::_internal_add_mixins() { return mixins_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { - PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins(); +inline ::PROTOBUF_NAMESPACE_ID::Mixin* Api::add_mixins() { + ::PROTOBUF_NAMESPACE_ID::Mixin* _add = _internal_add_mixins(); // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Mixin >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Mixin >& Api::mixins() const { // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins) return mixins_; @@ -1023,18 +1035,18 @@ Api::mixins() const { inline void Api::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Api::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax) return _internal_syntax(); } -inline void Api::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Api::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax) } @@ -1228,31 +1240,31 @@ inline int Method::_internal_options_size() const { inline int Method::options_size() const { return _internal_options_size(); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Method::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Method::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Method.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Method::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Method.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Method::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Method.options) return options_; @@ -1262,18 +1274,18 @@ Method::options() const { inline void Method::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Method::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax) return _internal_syntax(); } -inline void Method::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Method::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax) } diff --git a/contrib/libs/protobuf/src/google/protobuf/arena.cc b/contrib/libs/protobuf/src/google/protobuf/arena.cc index bd9516b600..c12bf2b3fe 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena.cc +++ b/contrib/libs/protobuf/src/google/protobuf/arena.cc @@ -136,14 +136,14 @@ std::pair<void*, SerialArena::CleanupNode*> SerialArena::AllocateAlignedWithCleanupFallback( size_t n, const AllocationPolicy* policy) { AllocateNewBlock(n + kCleanupSize, policy); - return AllocateAlignedWithCleanup(n, policy); + return AllocateFromExistingWithCleanupFallback(n); } PROTOBUF_NOINLINE void* SerialArena::AllocateAlignedFallback(size_t n, const AllocationPolicy* policy) { AllocateNewBlock(n, policy); - return AllocateAligned(n, policy); + return AllocateFromExisting(n); } void SerialArena::AllocateNewBlock(size_t n, const AllocationPolicy* policy) { @@ -168,8 +168,8 @@ void SerialArena::AllocateNewBlock(size_t n, const AllocationPolicy* policy) { #endif // ADDRESS_SANITIZER } -uint64 SerialArena::SpaceUsed() const { - uint64 space_used = ptr_ - head_->Pointer(kBlockHeaderSize); +uint64_t SerialArena::SpaceUsed() const { + uint64_t space_used = ptr_ - head_->Pointer(kBlockHeaderSize); space_used += space_used_; // Remove the overhead of the SerialArena itself. space_used -= ThreadSafeArena::kSerialArenaSize; @@ -263,11 +263,11 @@ void ThreadSafeArena::Init(bool record_allocs) { auto id = tc.next_lifecycle_id; // We increment lifecycle_id's by multiples of two so we can use bit 0 as // a tag. - constexpr uint64 kDelta = 2; - constexpr uint64 kInc = ThreadCache::kPerThreadIds * kDelta; + constexpr uint64_t kDelta = 2; + constexpr uint64_t kInc = ThreadCache::kPerThreadIds * kDelta; if (PROTOBUF_PREDICT_FALSE((id & (kInc - 1)) == 0)) { constexpr auto relaxed = std::memory_order_relaxed; - // On platforms that don't support uint64 atomics we can certainly not + // On platforms that don't support uint64_t atomics we can certainly not // afford to increment by large intervals and expect uniqueness due to // wrapping, hence we only add by 1. id = lifecycle_id_generator_.id.fetch_add(1, relaxed) * kInc; @@ -316,7 +316,7 @@ SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) { return mem; } -uint64 ThreadSafeArena::Reset() { +uint64_t ThreadSafeArena::Reset() { // Have to do this in a first pass, because some of the destructors might // refer to memory in other blocks. CleanupList(); @@ -406,18 +406,18 @@ void ThreadSafeArena::AddCleanupFallback(void* elem, void (*cleanup)(void*)) { ->AddCleanup(elem, cleanup, AllocPolicy()); } -uint64 ThreadSafeArena::SpaceAllocated() const { +uint64_t ThreadSafeArena::SpaceAllocated() const { SerialArena* serial = threads_.load(std::memory_order_acquire); - uint64 res = 0; + uint64_t res = 0; for (; serial; serial = serial->next()) { res += serial->SpaceAllocated(); } return res; } -uint64 ThreadSafeArena::SpaceUsed() const { +uint64_t ThreadSafeArena::SpaceUsed() const { SerialArena* serial = threads_.load(std::memory_order_acquire); - uint64 space_used = 0; + uint64_t space_used = 0; for (; serial; serial = serial->next()) { space_used += serial->SpaceUsed(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/arena.h b/contrib/libs/protobuf/src/google/protobuf/arena.h index ba080baec0..dd78ded473 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena.h +++ b/contrib/libs/protobuf/src/google/protobuf/arena.h @@ -91,6 +91,7 @@ class ReflectionTester; // defined in test_util.h namespace internal { struct ArenaStringPtr; // defined in arenastring.h +class InlinedStringField; // defined in inlined_string_field.h class LazyField; // defined in lazy_field.h class EpsCopyInputStream; // defined in parse_context.h @@ -298,7 +299,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { // We must delegate to CreateMaybeMessage() and NOT CreateMessageInternal() // because protobuf generated classes specialize CreateMaybeMessage() and we // need to use that specialization for code size reasons. - return Arena::CreateMaybeMessage<T>(arena, std::forward<Args>(args)...); + return Arena::CreateMaybeMessage<T>(arena, static_cast<Args&&>(args)...); } // API to create any objects on the arena. Note that only the object will @@ -319,7 +320,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { template <typename T, typename... Args> PROTOBUF_NDEBUG_INLINE static T* Create(Arena* arena, Args&&... args) { return CreateInternal<T>(arena, std::is_convertible<T*, MessageLite*>(), - std::forward<Args>(args)...); + static_cast<Args&&>(args)...); } // Create an array of object type T on the arena *without* invoking the @@ -350,19 +351,19 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { // policies. Do not use these in unit tests. // Returns the total space allocated by the arena, which is the sum of the // sizes of the underlying blocks. - uint64 SpaceAllocated() const { return impl_.SpaceAllocated(); } + uint64_t SpaceAllocated() const { return impl_.SpaceAllocated(); } // Returns the total space used by the arena. Similar to SpaceAllocated but // does not include free space and block overhead. The total space returned // may not include space used by other threads executing concurrently with // the call to this method. - uint64 SpaceUsed() const { return impl_.SpaceUsed(); } + uint64_t SpaceUsed() const { return impl_.SpaceUsed(); } // Frees all storage allocated by this arena after calling destructors // registered with OwnDestructor() and freeing objects registered with Own(). // Any objects allocated on this arena are unusable after this call. It also // returns the total space used by the arena which is the sums of the sizes // of the allocated blocks. This method is not thread-safe. - uint64 Reset() { return impl_.Reset(); } + uint64_t Reset() { return impl_.Reset(); } // Adds |object| to a list of heap-allocated objects to be freed with |delete| // when the arena is destroyed or reset. @@ -483,7 +484,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { template <typename... Args> static T* Construct(void* ptr, Args&&... args) { - return new (ptr) T(std::forward<Args>(args)...); + return new (ptr) T(static_cast<Args&&>(args)...); } static T* New() { @@ -527,9 +528,9 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { InternalHelper<T>::is_arena_constructable::value, "CreateMessage can only construct types that are ArenaConstructable"); if (arena == NULL) { - return new T(nullptr, std::forward<Args>(args)...); + return new T(nullptr, static_cast<Args&&>(args)...); } else { - return arena->DoCreateMessage<T>(std::forward<Args>(args)...); + return arena->DoCreateMessage<T>(static_cast<Args&&>(args)...); } } @@ -632,9 +633,11 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { CreateInArenaStorageInternal(ptr, arena, typename is_arena_constructable<T>::type(), std::forward<Args>(args)...); - RegisterDestructorInternal( - ptr, arena, - typename InternalHelper<T>::is_destructor_skippable::type()); + if (arena != nullptr) { + RegisterDestructorInternal( + ptr, arena, + typename InternalHelper<T>::is_destructor_skippable::type()); + } } template <typename T, typename... Args> @@ -788,6 +791,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { template <typename Type> friend class internal::GenericTypeHandler; friend struct internal::ArenaStringPtr; // For AllocateAligned. + friend class internal::InlinedStringField; // For AllocateAligned. friend class internal::LazyField; // For CreateMaybeMessage. friend class internal::EpsCopyInputStream; // For parser performance friend class MessageLite; diff --git a/contrib/libs/protobuf/src/google/protobuf/arena_impl.h b/contrib/libs/protobuf/src/google/protobuf/arena_impl.h index 40608dfe0d..b47bad78c7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/arena_impl.h @@ -66,11 +66,11 @@ class PROTOBUF_EXPORT ArenaMetricsCollector { // Invoked when the arena is about to be destroyed. This method will // typically finalize any metric collection and delete the collector. // space_allocated is the space used by the arena. - virtual void OnDestroy(uint64 space_allocated) = 0; + virtual void OnDestroy(uint64_t space_allocated) = 0; // OnReset() is called when the associated arena is reset. // space_allocated is the space used by the arena just before the reset. - virtual void OnReset(uint64 space_allocated) = 0; + virtual void OnReset(uint64_t space_allocated) = 0; // OnAlloc is called when an allocation happens. // type_info is promised to be static - its lifetime extends to @@ -79,7 +79,7 @@ class PROTOBUF_EXPORT ArenaMetricsCollector { // intentionally want to avoid monitoring an allocation. (i.e. internal // allocations for managing the arena) virtual void OnAlloc(const std::type_info* allocated_type, - uint64 alloc_size) = 0; + uint64_t alloc_size) = 0; // Does OnAlloc() need to be called? If false, metric collection overhead // will be reduced since we will not do extra work per allocation. @@ -141,10 +141,10 @@ class PROTOBUF_EXPORT SerialArena { Memory Free(Deallocator deallocator); void CleanupList(); - uint64 SpaceAllocated() const { + uint64_t SpaceAllocated() const { return space_allocated_.load(std::memory_order_relaxed); } - uint64 SpaceUsed() const; + uint64_t SpaceUsed() const; bool HasSpace(size_t n) { return n <= static_cast<size_t>(limit_ - ptr_); } @@ -154,6 +154,11 @@ class PROTOBUF_EXPORT SerialArena { if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) { return AllocateAlignedFallback(n, policy); } + return AllocateFromExisting(n); + } + + private: + void* AllocateFromExisting(size_t n) { void* ret = ptr_; ptr_ += n; #ifdef ADDRESS_SANITIZER @@ -162,17 +167,13 @@ class PROTOBUF_EXPORT SerialArena { return ret; } + 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_); if (PROTOBUF_PREDICT_FALSE(!HasSpace(n))) return false; - void* ret = ptr_; - ptr_ += n; -#ifdef ADDRESS_SANITIZER - ASAN_UNPOISON_MEMORY_REGION(ret, n); -#endif // ADDRESS_SANITIZER - *out = ret; + *out = AllocateFromExisting(n); return true; } @@ -181,6 +182,12 @@ class PROTOBUF_EXPORT SerialArena { if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) { return AllocateAlignedWithCleanupFallback(n, policy); } + return AllocateFromExistingWithCleanupFallback(n); + } + + private: + std::pair<void*, CleanupNode*> AllocateFromExistingWithCleanupFallback( + size_t n) { void* ret = ptr_; ptr_ += n; limit_ -= kCleanupSize; @@ -191,6 +198,7 @@ class PROTOBUF_EXPORT SerialArena { return CreatePair(ret, reinterpret_cast<CleanupNode*>(limit_)); } + public: void AddCleanup(void* elem, void (*cleanup)(void*), const AllocationPolicy* policy) { auto res = AllocateAlignedWithCleanup(0, policy); @@ -206,13 +214,15 @@ class PROTOBUF_EXPORT SerialArena { // Blocks are variable length malloc-ed objects. The following structure // describes the common header for all blocks. struct Block { + Block(Block* next, size_t size) : next(next), size(size), start(nullptr) {} + char* Pointer(size_t n) { GOOGLE_DCHECK(n <= size); return reinterpret_cast<char*>(this) + n; } - Block* next; - size_t size; + Block* const next; + const size_t size; CleanupNode* start; // data follows }; @@ -277,10 +287,10 @@ class PROTOBUF_EXPORT ThreadSafeArena { // if it was passed in. ~ThreadSafeArena(); - uint64 Reset(); + uint64_t Reset(); - uint64 SpaceAllocated() const; - uint64 SpaceUsed() const; + uint64_t SpaceAllocated() const; + uint64_t SpaceUsed() const; void* AllocateAligned(size_t n, const std::type_info* type) { SerialArena* arena; @@ -312,7 +322,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { private: // Unique for each arena. Changes on Reset(). - uint64 tag_and_id_; + uint64_t tag_and_id_; // The LSB of tag_and_id_ indicates if allocs in this arena are recorded. enum { kRecordAllocs = 1 }; @@ -343,7 +353,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; } - inline uint64 LifeCycleId() const { + inline uint64_t LifeCycleId() const { return tag_and_id_ & (-kRecordAllocs - 1); } @@ -362,7 +372,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { hint_.store(serial, std::memory_order_release); } - PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(uint64 lifecycle_id, + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(uint64_t lifecycle_id, SerialArena** arena) { if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true; if (lifecycle_id & kRecordAllocs) return false; @@ -379,7 +389,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { } PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache( - uint64 lifecycle_id, SerialArena** arena) { + uint64_t lifecycle_id, 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. @@ -427,10 +437,10 @@ class PROTOBUF_EXPORT ThreadSafeArena { 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 next_lifecycle_id; + uint64_t next_lifecycle_id; // The ThreadCache is considered valid as long as this matches the // lifecycle_id of the arena being used. - uint64 last_lifecycle_id_seen; + uint64_t last_lifecycle_id_seen; SerialArena* last_serial_arena; }; diff --git a/contrib/libs/protobuf/src/google/protobuf/arenastring.h b/contrib/libs/protobuf/src/google/protobuf/arenastring.h index 65aafce21a..9e76dda5ed 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arenastring.h +++ b/contrib/libs/protobuf/src/google/protobuf/arenastring.h @@ -352,12 +352,15 @@ inline void ArenaStringPtr::UnsafeSetDefault(const TProtoStringType* value) { tagged_ptr_.Set(const_cast<TProtoStringType*>(value)); } +// Make sure rhs_arena allocated rhs, and lhs_arena allocated lhs. inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // const TProtoStringType* default_value, // ArenaStringPtr* rhs, Arena* rhs_arena, // ArenaStringPtr* lhs, Arena* lhs_arena) { + // Silence unused variable warnings in release buildls. (void)default_value; - std::swap(lhs_arena, rhs_arena); + (void)rhs_arena; + (void)lhs_arena; std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_); #ifdef PROTOBUF_FORCE_COPY_IN_SWAP auto force_realloc = [default_value](ArenaStringPtr* p, Arena* arena) { @@ -370,8 +373,10 @@ inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( // if (arena == nullptr) delete old_value; p->tagged_ptr_.Set(new_value); }; - force_realloc(lhs, lhs_arena); - force_realloc(rhs, rhs_arena); + // Because, at this point, tagged_ptr_ has been swapped, arena should also be + // swapped. + force_realloc(lhs, rhs_arena); + force_realloc(rhs, lhs_arena); #endif // PROTOBUF_FORCE_COPY_IN_SWAP } diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc index 8b8d7fd9cf..2ecffe85c9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc @@ -35,6 +35,7 @@ #include <google/protobuf/descriptor.h> #include <algorithm> +#include <array> #include <functional> #include <limits> #include <map> @@ -75,7 +76,8 @@ namespace google { namespace protobuf { -struct Symbol { +class Symbol { + public: enum Type { NULL_SYMBOL, MESSAGE, @@ -83,69 +85,177 @@ struct Symbol { ONEOF, ENUM, ENUM_VALUE, + ENUM_VALUE_OTHER_PARENT, SERVICE, METHOD, - PACKAGE - }; - Type type; - union { - const Descriptor* descriptor; - const FieldDescriptor* field_descriptor; - const OneofDescriptor* oneof_descriptor; - const EnumDescriptor* enum_descriptor; - const EnumValueDescriptor* enum_value_descriptor; - const ServiceDescriptor* service_descriptor; - const MethodDescriptor* method_descriptor; - const FileDescriptor* package_file_descriptor; + PACKAGE, + QUERY_KEY }; - inline Symbol() : type(NULL_SYMBOL) { descriptor = nullptr; } - inline bool IsNull() const { return type == NULL_SYMBOL; } - inline bool IsType() const { return type == MESSAGE || type == ENUM; } - inline bool IsAggregate() const { - return type == MESSAGE || type == PACKAGE || type == ENUM || - type == SERVICE; + Symbol() : ptr_(nullptr) {} + + // Every object we store derives from internal::SymbolBase, where we store the + // symbol type enum. + // Storing in the object can be done without using more space in most cases, + // while storing it in the Symbol type would require 8 bytes. +#define DEFINE_MEMBERS(TYPE, TYPE_CONSTANT, FIELD) \ + explicit Symbol(TYPE* value) : ptr_(value) { \ + value->symbol_type_ = TYPE_CONSTANT; \ + } \ + const TYPE* FIELD() const { \ + return type() == TYPE_CONSTANT ? static_cast<const TYPE*>(ptr_) : nullptr; \ + } + + DEFINE_MEMBERS(Descriptor, MESSAGE, descriptor) + DEFINE_MEMBERS(FieldDescriptor, FIELD, field_descriptor) + DEFINE_MEMBERS(OneofDescriptor, ONEOF, oneof_descriptor) + DEFINE_MEMBERS(EnumDescriptor, ENUM, enum_descriptor) + DEFINE_MEMBERS(ServiceDescriptor, SERVICE, service_descriptor) + DEFINE_MEMBERS(MethodDescriptor, METHOD, method_descriptor) + + // We use a special node for FileDescriptor. + // It is potentially added to the table with multiple different names, so we + // need a separate place to put the name. + struct Package : internal::SymbolBase { + const TProtoStringType* name; + const FileDescriptor* file; + }; + DEFINE_MEMBERS(Package, PACKAGE, package_file_descriptor) + + // Enum values have two different parents. + // We use two different identitied for the same object to determine the two + // different insertions in the map. + static Symbol EnumValue(EnumValueDescriptor* value, int n) { + Symbol s; + internal::SymbolBase* ptr; + if (n == 0) { + ptr = static_cast<internal::SymbolBaseN<0>*>(value); + ptr->symbol_type_ = ENUM_VALUE; + } else { + ptr = static_cast<internal::SymbolBaseN<1>*>(value); + ptr->symbol_type_ = ENUM_VALUE_OTHER_PARENT; + } + s.ptr_ = ptr; + return s; } -#define CONSTRUCTOR(TYPE, TYPE_CONSTANT, FIELD) \ - inline explicit Symbol(const TYPE* value) { \ - type = TYPE_CONSTANT; \ - this->FIELD = value; \ + const EnumValueDescriptor* enum_value_descriptor() const { + return type() == ENUM_VALUE + ? static_cast<const EnumValueDescriptor*>( + static_cast<const internal::SymbolBaseN<0>*>(ptr_)) + : type() == ENUM_VALUE_OTHER_PARENT + ? static_cast<const EnumValueDescriptor*>( + static_cast<const internal::SymbolBaseN<1>*>(ptr_)) + : nullptr; } - CONSTRUCTOR(Descriptor, MESSAGE, descriptor) - CONSTRUCTOR(FieldDescriptor, FIELD, field_descriptor) - CONSTRUCTOR(OneofDescriptor, ONEOF, oneof_descriptor) - CONSTRUCTOR(EnumDescriptor, ENUM, enum_descriptor) - CONSTRUCTOR(EnumValueDescriptor, ENUM_VALUE, enum_value_descriptor) - CONSTRUCTOR(ServiceDescriptor, SERVICE, service_descriptor) - CONSTRUCTOR(MethodDescriptor, METHOD, method_descriptor) - CONSTRUCTOR(FileDescriptor, PACKAGE, package_file_descriptor) -#undef CONSTRUCTOR + // Not a real symbol. + // Only used for heterogeneous lookups and never actually inserted in the + // tables. + struct QueryKey : internal::SymbolBase { + StringPiece name; + const void* parent; + }; + DEFINE_MEMBERS(QueryKey, QUERY_KEY, query_key); +#undef DEFINE_MEMBERS + + Type type() const { + return ptr_ == nullptr ? NULL_SYMBOL + : static_cast<Type>(ptr_->symbol_type_); + } + bool IsNull() const { return type() == NULL_SYMBOL; } + bool IsType() const { return type() == MESSAGE || type() == ENUM; } + bool IsAggregate() const { + return type() == MESSAGE || type() == PACKAGE || type() == ENUM || + type() == SERVICE; + } const FileDescriptor* GetFile() const { - switch (type) { - case NULL_SYMBOL: + switch (type()) { + case MESSAGE: + return descriptor()->file(); + case FIELD: + return field_descriptor()->file(); + case ONEOF: + return oneof_descriptor()->containing_type()->file(); + case ENUM: + return enum_descriptor()->file(); + case ENUM_VALUE: + return enum_value_descriptor()->type()->file(); + case SERVICE: + return service_descriptor()->file(); + case METHOD: + return method_descriptor()->service()->file(); + case PACKAGE: + return package_file_descriptor()->file; + default: return nullptr; + } + } + + StringPiece full_name() const { + switch (type()) { case MESSAGE: - return descriptor->file(); + return descriptor()->full_name(); case FIELD: - return field_descriptor->file(); + return field_descriptor()->full_name(); case ONEOF: - return oneof_descriptor->containing_type()->file(); + return oneof_descriptor()->full_name(); case ENUM: - return enum_descriptor->file(); + return enum_descriptor()->full_name(); case ENUM_VALUE: - return enum_value_descriptor->type()->file(); + return enum_value_descriptor()->full_name(); case SERVICE: - return service_descriptor->file(); + return service_descriptor()->full_name(); case METHOD: - return method_descriptor->service()->file(); + return method_descriptor()->full_name(); case PACKAGE: - return package_file_descriptor; + return *package_file_descriptor()->name; + case QUERY_KEY: + return query_key()->name; + default: + GOOGLE_CHECK(false); } - return nullptr; + return ""; } + + std::pair<const void*, StringPiece> parent_key() const { + const auto or_file = [&](const void* p) { return p ? p : GetFile(); }; + switch (type()) { + case MESSAGE: + return {or_file(descriptor()->containing_type()), descriptor()->name()}; + case FIELD: { + auto* field = field_descriptor(); + return {or_file(field->is_extension() ? field->extension_scope() + : field->containing_type()), + field->name()}; + } + case ONEOF: + return {oneof_descriptor()->containing_type(), + oneof_descriptor()->name()}; + case ENUM: + return {or_file(enum_descriptor()->containing_type()), + enum_descriptor()->name()}; + case ENUM_VALUE: + return {or_file(enum_value_descriptor()->type()->containing_type()), + enum_value_descriptor()->name()}; + case ENUM_VALUE_OTHER_PARENT: + return {enum_value_descriptor()->type(), + enum_value_descriptor()->name()}; + case SERVICE: + return {GetFile(), service_descriptor()->name()}; + case METHOD: + return {method_descriptor()->service(), method_descriptor()->name()}; + case QUERY_KEY: + return {query_key()->parent, query_key()->name}; + default: + GOOGLE_CHECK(false); + } + return {}; + } + + private: + const internal::SymbolBase* ptr_; }; const FieldDescriptor::CppType @@ -435,11 +545,31 @@ struct PointerStringPairHash { const Symbol kNullSymbol; -typedef HASH_MAP<StringPiece, Symbol, HASH_FXN<StringPiece>> - SymbolsByNameMap; +struct SymbolByFullNameHash { + size_t operator()(Symbol s) const { + return HASH_FXN<StringPiece>{}(s.full_name()); + } +}; +struct SymbolByFullNameEq { + bool operator()(Symbol a, Symbol b) const { + return a.full_name() == b.full_name(); + } +}; +using SymbolsByNameSet = + HASH_SET<Symbol, SymbolByFullNameHash, SymbolByFullNameEq>; -typedef HASH_MAP<PointerStringPair, Symbol, PointerStringPairHash> - SymbolsByParentMap; +struct SymbolByParentHash { + size_t operator()(Symbol s) const { + return PointerStringPairHash{}(s.parent_key()); + } +}; +struct SymbolByParentEq { + bool operator()(Symbol a, Symbol b) const { + return a.parent_key() == b.parent_key(); + } +}; +using SymbolsByParentSet = + HASH_SET<Symbol, SymbolByParentHash, SymbolByParentEq>; typedef HASH_MAP<StringPiece, const FileDescriptor*, HASH_FXN<StringPiece>> @@ -496,6 +626,403 @@ bool AllowedExtendeeInProto3(const TProtoStringType& name) { allowed_proto3_extendees->end(); } +// This bump allocator arena is optimized for the use case of this file. It is +// mostly optimized for memory usage, since these objects are expected to live +// for the entirety of the program. +// +// Some differences from other arenas: +// - It has a fixed number of non-trivial types it can hold. This allows +// tracking the allocations with a single byte. In contrast, google::protobuf::Arena +// uses 16 bytes per non-trivial object created. +// - It has some extra metadata for rollbacks. This is necessary for +// implementing the API below. This metadata is flushed at the end and would +// not cause persistent memory usage. +// - It tries to squeeze every byte of out the blocks. If an allocation is too +// large for the current block we move the block to a secondary area where we +// can still use it for smaller objects. This complicates rollback logic but +// makes it much more memory efficient. +// +// The allocation strategy is as follows: +// - Memory is allocated from the front, with a forced 8 byte alignment. +// - Metadata is allocated from the back, one byte per element. +// - The metadata encodes one of two things: +// * For types we want to track, the index into KnownTypes. +// * For raw memory blocks, the size of the block (in 8 byte increments +// to allow for a larger limit). +// - When the raw data is too large to represent in the metadata byte, we +// allocate this memory separately in the heap and store an OutOfLineAlloc +// object instead. These come from large array allocations and alike. +// +// Blocks are kept in 3 areas: +// - `current_` is the one we are currently allocating from. When we need to +// allocate a block that doesn't fit there, we make a new block and move the +// old `current_` to one of the areas below. +// - Blocks that have no more usable space left (ie less than 9 bytes) are +// stored in `full_blocks_`. +// - Blocks that have some usable space are categorized in +// `small_size_blocks_` depending on how much space they have left. +// See `kSmallSizes` to see which sizes we track. +// +class TableArena { + public: + // Allocate a block on `n` bytes, with no destructor information saved. + void* AllocateMemory(uint32_t n) { + uint32_t tag = SizeToRawTag(n) + kFirstRawTag; + if (tag > 255) { + // We can't fit the size, use an OutOfLineAlloc. + return Create<OutOfLineAlloc>(OutOfLineAlloc{::operator new(n), n})->ptr; + } + + return AllocRawInternal(n, static_cast<Tag>(tag)); + } + + // Allocate and construct an element of type `T` as if by + // `T(std::forward<Args>(args...))`. + // The object is registered for destruction, if its destructor is not trivial. + template <typename T, typename... Args> + T* Create(Args&&... args) { + static_assert(alignof(T) <= 8, ""); + return ::new (AllocRawInternal(sizeof(T), TypeTag<T>(KnownTypes{}))) + T(std::forward<Args>(args)...); + } + + TableArena() {} + + TableArena(const TableArena&) = delete; + TableArena& operator=(const TableArena&) = delete; + + ~TableArena() { + // Uncomment this to debug usage statistics of the arena blocks. + // PrintUsageInfo(); + + for (Block* list : GetLists()) { + while (list != nullptr) { + Block* b = list; + list = list->next; + b->VisitBlock(DestroyVisitor{}); + b->Destroy(); + } + } + } + + + // This function exists for debugging only. + // It can be called from the destructor to dump some info in the tests to + // inspect the usage of the arena. + void PrintUsageInfo() const { + const auto print_histogram = [](Block* b, int size) { + std::map<uint32_t, uint32_t> unused_space_count; + int count = 0; + for (; b != nullptr; b = b->next) { + ++unused_space_count[b->space_left()]; + ++count; + } + if (size > 0) { + fprintf(stderr, " Blocks `At least %d`", size); + } else { + fprintf(stderr, " Blocks `full`"); + } + fprintf(stderr, ": %d blocks.\n", count); + for (auto p : unused_space_count) { + fprintf(stderr, " space=%4u, count=%3u\n", p.first, p.second); + } + }; + + fprintf(stderr, "TableArena unused space histogram:\n"); + fprintf(stderr, " Current: %u\n", + current_ != nullptr ? current_->space_left() : 0); + print_histogram(full_blocks_, 0); + for (size_t i = 0; i < kSmallSizes.size(); ++i) { + print_histogram(small_size_blocks_[i], kSmallSizes[i]); + } + } + + // Current allocation count. + // This can be used for checkpointing. + size_t num_allocations() const { return num_allocations_; } + + // Rollback the latest allocations until we reach back to `checkpoint` + // num_allocations. + void RollbackTo(size_t checkpoint) { + while (num_allocations_ > checkpoint) { + GOOGLE_DCHECK(!rollback_info_.empty()); + auto& info = rollback_info_.back(); + Block* b = info.block; + + VisitAlloc(b->data(), &b->start_offset, &b->end_offset, DestroyVisitor{}, + KnownTypes{}); + if (--info.count == 0) { + rollback_info_.pop_back(); + } + --num_allocations_; + } + + // Reconstruct the lists and destroy empty blocks. + auto lists = GetLists(); + current_ = full_blocks_ = nullptr; + small_size_blocks_.fill(nullptr); + + for (Block* list : lists) { + while (list != nullptr) { + Block* b = list; + list = list->next; + + if (b->start_offset == 0) { + // This is empty, free it. + b->Destroy(); + } else { + RelocateToUsedList(b); + } + } + } + } + + // Clear all rollback information. Reduces memory usage. + // Trying to rollback past num_allocations() is now impossible. + void ClearRollbackData() { + rollback_info_.clear(); + rollback_info_.shrink_to_fit(); + } + + private: + static constexpr size_t RoundUp(size_t n) { return (n + 7) & ~7; } + + using Tag = unsigned char; + + void* AllocRawInternal(uint32_t size, Tag tag) { + GOOGLE_DCHECK_GT(size, 0); + size = RoundUp(size); + + Block* to_relocate = nullptr; + Block* to_use; + + for (size_t i = 0; i < kSmallSizes.size(); ++i) { + if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) { + to_use = to_relocate = PopBlock(small_size_blocks_[i]); + break; + } + } + + if (to_relocate != nullptr) { + // We found one in the loop. + } else if (current_ != nullptr && size + 1 <= current_->space_left()) { + to_use = current_; + } else { + // No space left anywhere, make a new block. + to_relocate = current_; + // For now we hardcode the size to one page. Note that the maximum we can + // allocate in the block according to the limits of Tag is less than 2k, + // so this can fit anything that Tag can represent. + constexpr size_t kBlockSize = 4096; + to_use = current_ = ::new (::operator new(kBlockSize)) Block(kBlockSize); + GOOGLE_DCHECK_GE(current_->space_left(), size + 1); + } + + ++num_allocations_; + if (!rollback_info_.empty() && rollback_info_.back().block == to_use) { + ++rollback_info_.back().count; + } else { + rollback_info_.push_back({to_use, 1}); + } + + void* p = to_use->Allocate(size, tag); + if (to_relocate != nullptr) { + RelocateToUsedList(to_relocate); + } + return p; + } + + static void OperatorDelete(void* p, size_t s) { +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + ::operator delete(p, s); +#else + ::operator delete(p); +#endif + } + + struct OutOfLineAlloc { + void* ptr; + uint32_t size; + }; + + template <typename... T> + struct TypeList { + static constexpr Tag kSize = static_cast<Tag>(sizeof...(T)); + }; + + template <typename T, typename Visitor> + static void RunVisitor(char* p, uint16_t* start, Visitor visit) { + *start -= RoundUp(sizeof(T)); + visit(reinterpret_cast<T*>(p + *start)); + } + + // Visit the allocation at the passed location. + // It updates start/end to be after the visited object. + // This allows visiting a whole block by calling the function in a loop. + template <typename Visitor, typename... T> + static void VisitAlloc(char* p, uint16_t* start, uint16_t* end, Visitor visit, + TypeList<T...>) { + const Tag tag = static_cast<Tag>(p[*end]); + if (tag >= kFirstRawTag) { + // Raw memory. Skip it. + *start -= TagToSize(tag); + } else { + using F = void (*)(char*, uint16_t*, Visitor); + static constexpr F kFuncs[] = {&RunVisitor<T, Visitor>...}; + kFuncs[tag](p, start, visit); + } + ++*end; + } + + template <typename U, typename... Ts> + static constexpr Tag TypeTag(TypeList<U, Ts...>) { + return 0; + } + + template < + typename U, typename T, typename... Ts, + typename = typename std::enable_if<!std::is_same<U, T>::value>::type> + static constexpr Tag TypeTag(TypeList<T, Ts...>) { + return 1 + TypeTag<U>(TypeList<Ts...>{}); + } + + template <typename U> + static constexpr Tag TypeTag(TypeList<>) { + static_assert(std::is_trivially_destructible<U>::value, ""); + return SizeToRawTag(sizeof(U)); + } + + using KnownTypes = + TypeList<OutOfLineAlloc, TProtoStringType, + // For name arrays + std::array<TProtoStringType, 2>, std::array<TProtoStringType, 3>, + std::array<TProtoStringType, 4>, std::array<TProtoStringType, 5>, + FileDescriptorTables, SourceCodeInfo, FileOptions, + MessageOptions, FieldOptions, ExtensionRangeOptions, + OneofOptions, EnumOptions, EnumValueOptions, ServiceOptions, + MethodOptions>; + static constexpr Tag kFirstRawTag = KnownTypes::kSize; + + + struct DestroyVisitor { + template <typename T> + void operator()(T* p) { + p->~T(); + } + void operator()(OutOfLineAlloc* p) { OperatorDelete(p->ptr, p->size); } + }; + + static uint32_t SizeToRawTag(size_t n) { return (RoundUp(n) / 8) - 1; } + + static uint32_t TagToSize(Tag tag) { + GOOGLE_DCHECK_GE(tag, kFirstRawTag); + return static_cast<uint32_t>(tag - kFirstRawTag + 1) * 8; + } + + struct Block { + uint16_t start_offset; + uint16_t end_offset; + uint16_t capacity; + Block* next; + + // `allocated_size` is the total size of the memory block allocated. + // The `Block` structure is constructed at the start and the rest of the + // memory is used as the payload of the `Block`. + explicit Block(uint32_t allocated_size) { + start_offset = 0; + end_offset = capacity = + reinterpret_cast<char*>(this) + allocated_size - data(); + next = nullptr; + } + + char* data() { + return reinterpret_cast<char*>(this) + RoundUp(sizeof(Block)); + } + + uint32_t memory_used() { + return data() + capacity - reinterpret_cast<char*>(this); + } + uint32_t space_left() const { return end_offset - start_offset; } + + void* Allocate(uint32_t n, Tag tag) { + GOOGLE_DCHECK_LE(n + 1, space_left()); + void* p = data() + start_offset; + start_offset += n; + data()[--end_offset] = tag; + return p; + } + + void Destroy() { OperatorDelete(this, memory_used()); } + + void PrependTo(Block*& list) { + next = list; + list = this; + } + + template <typename Visitor> + void VisitBlock(Visitor visit) { + for (uint16_t s = start_offset, e = end_offset; s != 0;) { + VisitAlloc(data(), &s, &e, visit, KnownTypes{}); + } + } + }; + + Block* PopBlock(Block*& list) { + Block* res = list; + list = list->next; + return res; + } + + void RelocateToUsedList(Block* to_relocate) { + if (current_ == nullptr) { + current_ = to_relocate; + current_->next = nullptr; + return; + } else if (current_->space_left() < to_relocate->space_left()) { + std::swap(current_, to_relocate); + current_->next = nullptr; + } + + for (int i = kSmallSizes.size(); --i >= 0;) { + if (to_relocate->space_left() >= 1 + kSmallSizes[i]) { + to_relocate->PrependTo(small_size_blocks_[i]); + return; + } + } + + to_relocate->PrependTo(full_blocks_); + } + + static constexpr std::array<uint8_t, 6> kSmallSizes = {{ + // Sizes for pointer arrays. + 8, 16, 24, 32, + // Sizes for string arrays (for descriptor names). + // The most common array sizes are 2 and 3. + 2 * sizeof(TProtoStringType), 3 * sizeof(TProtoStringType)}}; + + // Helper function to iterate all lists. + std::array<Block*, 2 + kSmallSizes.size()> GetLists() const { + std::array<Block*, 2 + kSmallSizes.size()> res; + res[0] = current_; + res[1] = full_blocks_; + std::copy(small_size_blocks_.begin(), small_size_blocks_.end(), &res[2]); + return res; + } + + Block* current_ = nullptr; + std::array<Block*, kSmallSizes.size()> small_size_blocks_ = {{}}; + Block* full_blocks_ = nullptr; + + size_t num_allocations_ = 0; + struct RollbackInfo { + Block* block; + size_t count; + }; + std::vector<RollbackInfo> rollback_info_; +}; + +constexpr std::array<uint8_t, 6> TableArena::kSmallSizes; + } // anonymous namespace // =================================================================== @@ -619,14 +1146,31 @@ class DescriptorPool::Tables { // Allocate a string which will be destroyed when the pool is destroyed. // The string is initialized to the given value for convenience. - TProtoStringType* AllocateString(StringPiece value); - - // Allocate empty string which will be destroyed when the pool is destroyed. - TProtoStringType* AllocateEmptyString(); - - // Allocate a internal::call_once which will be destroyed when the pool is + const TProtoStringType* AllocateString(StringPiece value); + + // Allocates an array of strings which will be destroyed when the pool is + // destroyed. The array is initialized with the input values. + template <typename... In> + const TProtoStringType* AllocateStringArray(In&&... values); + + struct FieldNamesResult { + TProtoStringType* array; + int lowercase_index; + int camelcase_index; + int json_index; + }; + // Allocate all 5 names of the field: + // name, full name, lowercase, camelcase and json. + // This function will dedup the strings when possible. + // The resulting array contains `name` at index 0, `full_name` at index 1 and + // the other 3 indices are specified in the result. + FieldNamesResult AllocateFieldNames(const TProtoStringType& name, + const TProtoStringType& scope, + const TProtoStringType* opt_json_name); + + // Allocate a LazyInitData which will be destroyed when the pool is // destroyed. - internal::once_flag* AllocateOnceDynamic(); + internal::LazyInitData* AllocateLazyInit(); // Allocate a protocol message object. Some older versions of GCC have // trouble understanding explicit template instantiations in some cases, so @@ -641,34 +1185,22 @@ class DescriptorPool::Tables { private: // All other memory allocated in the pool. Must be first as other objects can // point into these. - std::vector<std::vector<char>> allocations_; - std::vector<std::unique_ptr<TProtoStringType>> strings_; - std::vector<std::unique_ptr<Message>> messages_; - std::vector<std::unique_ptr<internal::once_flag>> once_dynamics_; - std::vector<std::unique_ptr<FileDescriptorTables>> file_tables_; + TableArena arena_; - SymbolsByNameMap symbols_by_name_; + SymbolsByNameSet symbols_by_name_; FilesByNameMap files_by_name_; ExtensionsGroupedByDescriptorMap extensions_; struct CheckPoint { explicit CheckPoint(const Tables* tables) - : strings_before_checkpoint(tables->strings_.size()), - messages_before_checkpoint(tables->messages_.size()), - once_dynamics_before_checkpoint(tables->once_dynamics_.size()), - file_tables_before_checkpoint(tables->file_tables_.size()), - allocations_before_checkpoint(tables->allocations_.size()), + : arena_before_checkpoint(tables->arena_.num_allocations()), pending_symbols_before_checkpoint( tables->symbols_after_checkpoint_.size()), pending_files_before_checkpoint( tables->files_after_checkpoint_.size()), pending_extensions_before_checkpoint( tables->extensions_after_checkpoint_.size()) {} - int strings_before_checkpoint; - int messages_before_checkpoint; - int once_dynamics_before_checkpoint; - int file_tables_before_checkpoint; - int allocations_before_checkpoint; + int arena_before_checkpoint; int pending_symbols_before_checkpoint; int pending_files_before_checkpoint; int pending_extensions_before_checkpoint; @@ -703,13 +1235,9 @@ class FileDescriptorTables { // ----------------------------------------------------------------- // Finding items. - // Find symbols. These return a null Symbol (symbol.IsNull() is true) - // if not found. + // Returns a null Symbol (symbol.IsNull() is true) if not found. inline Symbol FindNestedSymbol(const void* parent, StringPiece name) const; - inline Symbol FindNestedSymbolOfType(const void* parent, - StringPiece name, - const Symbol::Type type) const; // These return nullptr if not found. inline const FieldDescriptor* FindFieldByNumber(const Descriptor* parent, @@ -765,7 +1293,7 @@ class FileDescriptorTables { const FileDescriptorTables* tables); void FieldsByCamelcaseNamesLazyInitInternal() const; - SymbolsByParentMap symbols_by_parent_; + SymbolsByParentSet symbols_by_parent_; mutable FieldsByNameMap fields_by_lowercase_name_; std::unique_ptr<FieldsByNameMap> fields_by_lowercase_name_tmp_; mutable internal::once_flag fields_by_lowercase_name_once_; @@ -834,6 +1362,7 @@ void DescriptorPool::Tables::ClearLastCheckpoint() { symbols_after_checkpoint_.clear(); files_after_checkpoint_.clear(); extensions_after_checkpoint_.clear(); + arena_.ClearRollbackData(); } } @@ -843,7 +1372,9 @@ void DescriptorPool::Tables::RollbackToLastCheckpoint() { for (size_t i = checkpoint.pending_symbols_before_checkpoint; i < symbols_after_checkpoint_.size(); i++) { - symbols_by_name_.erase(symbols_after_checkpoint_[i]); + Symbol::QueryKey name; + name.name = symbols_after_checkpoint_[i]; + symbols_by_name_.erase(Symbol(&name)); } for (size_t i = checkpoint.pending_files_before_checkpoint; i < files_after_checkpoint_.size(); i++) { @@ -860,41 +1391,26 @@ void DescriptorPool::Tables::RollbackToLastCheckpoint() { extensions_after_checkpoint_.resize( checkpoint.pending_extensions_before_checkpoint); - strings_.resize(checkpoint.strings_before_checkpoint); - messages_.resize(checkpoint.messages_before_checkpoint); - once_dynamics_.resize(checkpoint.once_dynamics_before_checkpoint); - file_tables_.resize(checkpoint.file_tables_before_checkpoint); - allocations_.resize(checkpoint.allocations_before_checkpoint); + arena_.RollbackTo(checkpoint.arena_before_checkpoint); checkpoints_.pop_back(); } // ------------------------------------------------------------------- inline Symbol DescriptorPool::Tables::FindSymbol(StringPiece key) const { - const Symbol* result = FindOrNull(symbols_by_name_, key); - if (result == nullptr) { - return kNullSymbol; - } else { - return *result; - } + Symbol::QueryKey name; + name.name = key; + auto it = symbols_by_name_.find(Symbol(&name)); + return it == symbols_by_name_.end() ? kNullSymbol : *it; } inline Symbol FileDescriptorTables::FindNestedSymbol( const void* parent, StringPiece name) const { - const Symbol* result = - FindOrNull(symbols_by_parent_, PointerStringPair(parent, name)); - if (result == nullptr) { - return kNullSymbol; - } else { - return *result; - } -} - -inline Symbol FileDescriptorTables::FindNestedSymbolOfType( - const void* parent, StringPiece name, const Symbol::Type type) const { - Symbol result = FindNestedSymbol(parent, name); - if (result.type != type) return kNullSymbol; - return result; + Symbol::QueryKey query; + query.name = name; + query.parent = parent; + auto it = symbols_by_parent_.find(Symbol(&query)); + return it == symbols_by_parent_.end() ? kNullSymbol : *it; } Symbol DescriptorPool::Tables::FindByNameHelper(const DescriptorPool* pool, @@ -1045,9 +1561,9 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown( DescriptorPool::Tables* tables = const_cast<DescriptorPool::Tables*>( DescriptorPool::generated_pool()->tables_.get()); EnumValueDescriptor* result = tables->Allocate<EnumValueDescriptor>(); - result->name_ = tables->AllocateString(enum_value_name); - result->full_name_ = - tables->AllocateString(parent->full_name() + "." + enum_value_name); + result->all_names_ = tables->AllocateStringArray( + enum_value_name, + StrCat(parent->full_name(), ".", enum_value_name)); result->number_ = number; result->type_ = parent; result->options_ = &EnumValueOptions::default_instance(); @@ -1076,7 +1592,8 @@ inline void DescriptorPool::Tables::FindAllExtensions( bool DescriptorPool::Tables::AddSymbol(const TProtoStringType& full_name, Symbol symbol) { - if (InsertIfNotPresent(&symbols_by_name_, full_name, symbol)) { + GOOGLE_DCHECK_EQ(full_name, symbol.full_name()); + if (symbols_by_name_.insert(symbol).second) { symbols_after_checkpoint_.push_back(full_name.c_str()); return true; } else { @@ -1087,8 +1604,9 @@ bool DescriptorPool::Tables::AddSymbol(const TProtoStringType& full_name, bool FileDescriptorTables::AddAliasUnderParent(const void* parent, const TProtoStringType& name, Symbol symbol) { - PointerStringPair by_parent_key(parent, name.c_str()); - return InsertIfNotPresent(&symbols_by_parent_, by_parent_key, symbol); + GOOGLE_DCHECK_EQ(name, symbol.parent_key().second); + GOOGLE_DCHECK_EQ(parent, symbol.parent_key().first); + return symbols_by_parent_.insert(symbol).second; } bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) { @@ -1167,46 +1685,107 @@ Type* DescriptorPool::Tables::AllocateArray(int count) { return reinterpret_cast<Type*>(AllocateBytes(sizeof(Type) * count)); } -TProtoStringType* DescriptorPool::Tables::AllocateString(StringPiece value) { - TProtoStringType* result = new TProtoStringType(value); - strings_.emplace_back(result); - return result; +const TProtoStringType* DescriptorPool::Tables::AllocateString( + StringPiece value) { + return arena_.Create<TProtoStringType>(value); } -TProtoStringType* DescriptorPool::Tables::AllocateEmptyString() { - TProtoStringType* result = new TProtoStringType(); - strings_.emplace_back(result); - return result; +template <typename... In> +const TProtoStringType* DescriptorPool::Tables::AllocateStringArray(In&&... values) { + auto& array = *arena_.Create<std::array<TProtoStringType, sizeof...(In)>>(); + array = {{TProtoStringType(std::forward<In>(values))...}}; + return array.data(); } -internal::once_flag* DescriptorPool::Tables::AllocateOnceDynamic() { - internal::once_flag* result = new internal::once_flag(); - once_dynamics_.emplace_back(result); +DescriptorPool::Tables::FieldNamesResult +DescriptorPool::Tables::AllocateFieldNames(const TProtoStringType& name, + const TProtoStringType& scope, + const TProtoStringType* opt_json_name) { + TProtoStringType lowercase_name = name; + LowerString(&lowercase_name); + + TProtoStringType camelcase_name = ToCamelCase(name, /* lower_first = */ true); + TProtoStringType json_name; + if (opt_json_name != nullptr) { + json_name = *opt_json_name; + } else { + json_name = ToJsonName(name); + } + + const bool lower_eq_name = lowercase_name == name; + const bool camel_eq_name = camelcase_name == name; + const bool json_eq_name = json_name == name; + const bool json_eq_camel = json_name == camelcase_name; + + const int total_count = 2 + (lower_eq_name ? 0 : 1) + + (camel_eq_name ? 0 : 1) + + (json_eq_name || json_eq_camel ? 0 : 1); + FieldNamesResult result; + // We use std::array to allow handling of the destruction of the strings. + switch (total_count) { + case 2: + result.array = arena_.Create<std::array<TProtoStringType, 2>>()->data(); + break; + case 3: + result.array = arena_.Create<std::array<TProtoStringType, 3>>()->data(); + break; + case 4: + result.array = arena_.Create<std::array<TProtoStringType, 4>>()->data(); + break; + case 5: + result.array = arena_.Create<std::array<TProtoStringType, 5>>()->data(); + break; + } + + result.array[0] = name; + if (scope.empty()) { + result.array[1] = name; + } else { + result.array[1] = StrCat(scope, ".", name); + } + int index = 2; + if (lower_eq_name) { + result.lowercase_index = 0; + } else { + result.lowercase_index = index; + result.array[index++] = std::move(lowercase_name); + } + + if (camel_eq_name) { + result.camelcase_index = 0; + } else { + result.camelcase_index = index; + result.array[index++] = std::move(camelcase_name); + } + + if (json_eq_name) { + result.json_index = 0; + } else if (json_eq_camel) { + result.json_index = result.camelcase_index; + } else { + result.json_index = index; + result.array[index] = std::move(json_name); + } + return result; } +internal::LazyInitData* DescriptorPool::Tables::AllocateLazyInit() { + return arena_.Create<internal::LazyInitData>(); +} + template <typename Type> Type* DescriptorPool::Tables::AllocateMessage(Type* /* dummy */) { - Type* result = new Type; - messages_.emplace_back(result); - return result; + return arena_.Create<Type>(); } FileDescriptorTables* DescriptorPool::Tables::AllocateFileTables() { - FileDescriptorTables* result = new FileDescriptorTables; - file_tables_.emplace_back(result); - return result; + return arena_.Create<FileDescriptorTables>(); } void* DescriptorPool::Tables::AllocateBytes(int size) { - // TODO(kenton): Would it be worthwhile to implement this in some more - // sophisticated way? Probably not for the open source release, but for - // internal use we could easily plug in one of our existing memory pool - // allocators... if (size == 0) return nullptr; - - allocations_.emplace_back(size); - return allocations_.back().data(); + return arena_.AllocateMemory(size); } void FileDescriptorTables::BuildLocationsByPath( @@ -1407,60 +1986,54 @@ const FileDescriptor* DescriptorPool::FindFileContainingSymbol( const Descriptor* DescriptorPool::FindMessageTypeByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::MESSAGE) ? result.descriptor : nullptr; + return tables_->FindByNameHelper(this, name).descriptor(); } const FieldDescriptor* DescriptorPool::FindFieldByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - if (result.type == Symbol::FIELD && - !result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; + if (const FieldDescriptor* field = + tables_->FindByNameHelper(this, name).field_descriptor()) { + if (!field->is_extension()) { + return field; + } } + return nullptr; } const FieldDescriptor* DescriptorPool::FindExtensionByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - if (result.type == Symbol::FIELD && result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; + if (const FieldDescriptor* field = + tables_->FindByNameHelper(this, name).field_descriptor()) { + if (field->is_extension()) { + return field; + } } + return nullptr; } const OneofDescriptor* DescriptorPool::FindOneofByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::ONEOF) ? result.oneof_descriptor : nullptr; + return tables_->FindByNameHelper(this, name).oneof_descriptor(); } const EnumDescriptor* DescriptorPool::FindEnumTypeByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::ENUM) ? result.enum_descriptor : nullptr; + return tables_->FindByNameHelper(this, name).enum_descriptor(); } const EnumValueDescriptor* DescriptorPool::FindEnumValueByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::ENUM_VALUE) ? result.enum_value_descriptor - : nullptr; + return tables_->FindByNameHelper(this, name).enum_value_descriptor(); } const ServiceDescriptor* DescriptorPool::FindServiceByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::SERVICE) ? result.service_descriptor : nullptr; + return tables_->FindByNameHelper(this, name).service_descriptor(); } const MethodDescriptor* DescriptorPool::FindMethodByName( ConstStringParam name) const { - Symbol result = tables_->FindByNameHelper(this, name); - return (result.type == Symbol::METHOD) ? result.method_descriptor : nullptr; + return tables_->FindByNameHelper(this, name).method_descriptor(); } const FieldDescriptor* DescriptorPool::FindExtensionByNumber( @@ -1607,34 +2180,20 @@ const FieldDescriptor* Descriptor::FindFieldByCamelcaseName( } const FieldDescriptor* Descriptor::FindFieldByName(ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); - if (!result.IsNull() && !result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; - } + const FieldDescriptor* field = + file()->tables_->FindNestedSymbol(this, key).field_descriptor(); + return field != nullptr && !field->is_extension() ? field : nullptr; } const OneofDescriptor* Descriptor::FindOneofByName(ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ONEOF); - if (!result.IsNull()) { - return result.oneof_descriptor; - } else { - return nullptr; - } + return file()->tables_->FindNestedSymbol(this, key).oneof_descriptor(); } const FieldDescriptor* Descriptor::FindExtensionByName( ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); - if (!result.IsNull() && result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; - } + const FieldDescriptor* field = + file()->tables_->FindNestedSymbol(this, key).field_descriptor(); + return field != nullptr && field->is_extension() ? field : nullptr; } const FieldDescriptor* Descriptor::FindExtensionByLowercaseName( @@ -1660,35 +2219,17 @@ const FieldDescriptor* Descriptor::FindExtensionByCamelcaseName( } const Descriptor* Descriptor::FindNestedTypeByName(ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE); - if (!result.IsNull()) { - return result.descriptor; - } else { - return nullptr; - } + return file()->tables_->FindNestedSymbol(this, key).descriptor(); } const EnumDescriptor* Descriptor::FindEnumTypeByName( ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM); - if (!result.IsNull()) { - return result.enum_descriptor; - } else { - return nullptr; - } + return file()->tables_->FindNestedSymbol(this, key).enum_descriptor(); } const EnumValueDescriptor* Descriptor::FindEnumValueByName( ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); - if (!result.IsNull()) { - return result.enum_value_descriptor; - } else { - return nullptr; - } + return file()->tables_->FindNestedSymbol(this, key).enum_value_descriptor(); } const FieldDescriptor* Descriptor::map_key() const { @@ -1705,13 +2246,7 @@ const FieldDescriptor* Descriptor::map_value() const { const EnumValueDescriptor* EnumDescriptor::FindValueByName( ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); - if (!result.IsNull()) { - return result.enum_value_descriptor; - } else { - return nullptr; - } + return file()->tables_->FindNestedSymbol(this, key).enum_value_descriptor(); } const EnumValueDescriptor* EnumDescriptor::FindValueByNumber(int key) const { @@ -1725,64 +2260,34 @@ const EnumValueDescriptor* EnumDescriptor::FindValueByNumberCreatingIfUnknown( const MethodDescriptor* ServiceDescriptor::FindMethodByName( ConstStringParam key) const { - Symbol result = - file()->tables_->FindNestedSymbolOfType(this, key, Symbol::METHOD); - if (!result.IsNull()) { - return result.method_descriptor; - } else { - return nullptr; - } + return file()->tables_->FindNestedSymbol(this, key).method_descriptor(); } const Descriptor* FileDescriptor::FindMessageTypeByName( ConstStringParam key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE); - if (!result.IsNull()) { - return result.descriptor; - } else { - return nullptr; - } + return tables_->FindNestedSymbol(this, key).descriptor(); } const EnumDescriptor* FileDescriptor::FindEnumTypeByName( ConstStringParam key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM); - if (!result.IsNull()) { - return result.enum_descriptor; - } else { - return nullptr; - } + return tables_->FindNestedSymbol(this, key).enum_descriptor(); } const EnumValueDescriptor* FileDescriptor::FindEnumValueByName( ConstStringParam key) const { - Symbol result = - tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE); - if (!result.IsNull()) { - return result.enum_value_descriptor; - } else { - return nullptr; - } + return tables_->FindNestedSymbol(this, key).enum_value_descriptor(); } const ServiceDescriptor* FileDescriptor::FindServiceByName( ConstStringParam key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::SERVICE); - if (!result.IsNull()) { - return result.service_descriptor; - } else { - return nullptr; - } + return tables_->FindNestedSymbol(this, key).service_descriptor(); } const FieldDescriptor* FileDescriptor::FindExtensionByName( ConstStringParam key) const { - Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD); - if (!result.IsNull() && result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else { - return nullptr; - } + const FieldDescriptor* field = + tables_->FindNestedSymbol(this, key).field_descriptor(); + return field != nullptr && field->is_extension() ? field : nullptr; } const FieldDescriptor* FileDescriptor::FindExtensionByLowercaseName( @@ -1879,7 +2384,7 @@ bool DescriptorPool::IsSubSymbolOfBuiltType(StringPiece name) const { Symbol symbol = tables_->FindSymbol(prefix); // If the symbol type is anything other than PACKAGE, then its complete // definition is already known. - if (!symbol.IsNull() && symbol.type != Symbol::PACKAGE) { + if (!symbol.IsNull() && symbol.type() != Symbol::PACKAGE) { return true; } } @@ -1960,7 +2465,7 @@ bool DescriptorPool::TryFindExtensionInFallbackDatabase( // =================================================================== bool FieldDescriptor::is_map_message_type() const { - return message_type_->options().map_entry(); + return type_descriptor_.message_type->options().map_entry(); } TProtoStringType FieldDescriptor::DefaultValueAsString( @@ -1968,16 +2473,16 @@ TProtoStringType FieldDescriptor::DefaultValueAsString( GOOGLE_CHECK(has_default_value()) << "No default value"; switch (cpp_type()) { case CPPTYPE_INT32: - return StrCat(default_value_int32()); + return StrCat(default_value_int32_t()); break; case CPPTYPE_INT64: - return StrCat(default_value_int64()); + return StrCat(default_value_int64_t()); break; case CPPTYPE_UINT32: - return StrCat(default_value_uint32()); + return StrCat(default_value_uint32_t()); break; case CPPTYPE_UINT64: - return StrCat(default_value_uint64()); + return StrCat(default_value_uint64_t()); break; case CPPTYPE_FLOAT: return SimpleFtoa(default_value_float()); @@ -2276,6 +2781,7 @@ bool RetrieveOptionsAssumingRightPool( if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { TProtoStringType tmp; TextFormat::Printer printer; + printer.SetExpandAny(true); printer.SetInitialIndentLevel(depth + 1); printer.PrintFieldValueToString(options, field, repeated ? j : -1, &tmp); @@ -2954,7 +3460,7 @@ bool FileDescriptor::GetSourceLocation(const std::vector<int>& path, if (source_code_info_) { if (const SourceCodeInfo_Location* loc = tables_->GetSourceLocation(path, source_code_info_)) { - const RepeatedField<int32>& span = loc->span(); + const RepeatedField<int32_t>& span = loc->span(); if (span.size() == 3 || span.size() == 4) { out_location->start_line = span.Get(0); out_location->start_column = span.Get(1); @@ -3253,7 +3759,7 @@ class DescriptorBuilder { // package to the symbol table (e.g. AddPackage("foo.bar", ...) will add // "foo.bar" and "foo" to the table). void AddPackage(const TProtoStringType& name, const Message& proto, - const FileDescriptor* file); + FileDescriptor* file); // Checks that the symbol name contains only alphanumeric characters and // underscores. Records an error otherwise. @@ -3287,11 +3793,12 @@ class DescriptorBuilder { DescriptorT* descriptor, const std::vector<int>& options_path, const TProtoStringType& option_name); - // Allocate string on the string pool and initialize it to full proto name. + // Allocates an array of two strings, the first one is a copy of `proto_name`, + // and the second one is the full name. // Full proto name is "scope.proto_name" if scope is non-empty and // "proto_name" otherwise. - TProtoStringType* AllocateNameString(const TProtoStringType& scope, - const TProtoStringType& proto_name); + const TProtoStringType* AllocateNameStrings(const TProtoStringType& scope, + const TProtoStringType& proto_name); // These methods all have the same signature for the sake of the BUILD_ARRAY // macro, below. @@ -3419,13 +3926,13 @@ class DescriptorBuilder { // Convenience functions to set an int field the right way, depending on // its wire type (a single int CppType can represent multiple wire types). - void SetInt32(int number, int32 value, FieldDescriptor::Type type, + void SetInt32(int number, int32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetInt64(int number, int64 value, FieldDescriptor::Type type, + void SetInt64(int number, int64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetUInt32(int number, uint32 value, FieldDescriptor::Type type, + void SetUInt32(int number, uint32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); - void SetUInt64(int number, uint64 value, FieldDescriptor::Type type, + void SetUInt64(int number, uint64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields); // A helper function that adds an error at the specified location of the @@ -3440,7 +3947,11 @@ class DescriptorBuilder { // A helper function that adds an error at the location of the option name // and returns false. bool AddNameError(const TProtoStringType& msg) { +#ifdef PROTOBUF_INTERNAL_IGNORE_FIELD_NAME_ERRORS_ + return true; +#else // PROTOBUF_INTERNAL_IGNORE_FIELD_NAME_ERRORS_ return AddOptionError(DescriptorPool::ErrorCollector::OPTION_NAME, msg); +#endif // PROTOBUF_INTERNAL_IGNORE_FIELD_NAME_ERRORS_ } // A helper function that adds an error at the location of the option name @@ -3739,7 +4250,7 @@ Symbol DescriptorBuilder::FindSymbol(const TProtoStringType& name, bool build_it return result; } - if (result.type == Symbol::PACKAGE) { + if (result.type() == Symbol::PACKAGE) { // Arg, this is overcomplicated. The symbol is a package name. It could // be that the package was defined in multiple files. result.GetFile() // returns the first file we saw that used this package. We've determined @@ -3882,24 +4393,23 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( mutex_->AssertHeld(); } // Compute names. - const TProtoStringType* placeholder_full_name; - const TProtoStringType* placeholder_name; + StringPiece placeholder_full_name; + StringPiece placeholder_name; const TProtoStringType* placeholder_package; if (!ValidateQualifiedName(name)) return kNullSymbol; if (name[0] == '.') { // Fully-qualified. - placeholder_full_name = tables_->AllocateString(name.substr(1)); + placeholder_full_name = name.substr(1); } else { - placeholder_full_name = tables_->AllocateString(name); + placeholder_full_name = name; } - TProtoStringType::size_type dotpos = placeholder_full_name->find_last_of('.'); + TProtoStringType::size_type dotpos = placeholder_full_name.find_last_of('.'); if (dotpos != TProtoStringType::npos) { placeholder_package = - tables_->AllocateString(placeholder_full_name->substr(0, dotpos)); - placeholder_name = - tables_->AllocateString(placeholder_full_name->substr(dotpos + 1)); + tables_->AllocateString(placeholder_full_name.substr(0, dotpos)); + placeholder_name = placeholder_full_name.substr(dotpos + 1); } else { placeholder_package = &internal::GetEmptyString(); placeholder_name = placeholder_full_name; @@ -3907,7 +4417,7 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( // Create the placeholders. FileDescriptor* placeholder_file = NewPlaceholderFileWithMutexHeld( - *placeholder_full_name + ".placeholder.proto"); + StrCat(placeholder_full_name, ".placeholder.proto")); placeholder_file->package_ = placeholder_package; if (placeholder_type == PLACEHOLDER_ENUM) { @@ -3917,8 +4427,8 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( EnumDescriptor* placeholder_enum = &placeholder_file->enum_types_[0]; memset(static_cast<void*>(placeholder_enum), 0, sizeof(*placeholder_enum)); - placeholder_enum->full_name_ = placeholder_full_name; - placeholder_enum->name_ = placeholder_name; + placeholder_enum->all_names_ = + tables_->AllocateStringArray(placeholder_name, placeholder_full_name); placeholder_enum->file_ = placeholder_file; placeholder_enum->options_ = &EnumOptions::default_instance(); placeholder_enum->is_placeholder_ = true; @@ -3932,13 +4442,11 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( memset(static_cast<void*>(placeholder_value), 0, sizeof(*placeholder_value)); - placeholder_value->name_ = tables_->AllocateString("PLACEHOLDER_VALUE"); // Note that enum value names are siblings of their type, not children. - placeholder_value->full_name_ = - placeholder_package->empty() - ? placeholder_value->name_ - : tables_->AllocateString(*placeholder_package + - ".PLACEHOLDER_VALUE"); + placeholder_value->all_names_ = tables_->AllocateStringArray( + "PLACEHOLDER_VALUE", placeholder_package->empty() + ? "PLACEHOLDER_VALUE" + : *placeholder_package + ".PLACEHOLDER_VALUE"); placeholder_value->number_ = 0; placeholder_value->type_ = placeholder_enum; @@ -3953,8 +4461,8 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( memset(static_cast<void*>(placeholder_message), 0, sizeof(*placeholder_message)); - placeholder_message->full_name_ = placeholder_full_name; - placeholder_message->name_ = placeholder_name; + placeholder_message->all_names_ = + tables_->AllocateStringArray(placeholder_name, placeholder_full_name); placeholder_message->file_ = placeholder_file; placeholder_message->options_ = &MessageOptions::default_instance(); placeholder_message->is_placeholder_ = true; @@ -3968,6 +4476,7 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( // kMaxNumber + 1 because ExtensionRange::end is exclusive. placeholder_message->extension_ranges_->end = FieldDescriptor::kMaxNumber + 1; + placeholder_message->extension_ranges_->options_ = nullptr; } return Symbol(placeholder_message); @@ -4052,37 +4561,40 @@ bool DescriptorBuilder::AddSymbol(const TProtoStringType& full_name, } void DescriptorBuilder::AddPackage(const TProtoStringType& name, - const Message& proto, - const FileDescriptor* file) { + const Message& proto, FileDescriptor* file) { if (name.find('\0') != TProtoStringType::npos) { AddError(name, proto, DescriptorPool::ErrorCollector::NAME, "\"" + name + "\" contains null character."); return; } - if (tables_->AddSymbol(name, Symbol(file))) { - // Success. Also add parent package, if any. + + Symbol existing_symbol = tables_->FindSymbol(name); + // It's OK to redefine a package. + if (existing_symbol.IsNull()) { + auto* package = tables_->AllocateArray<Symbol::Package>(1); + // If the name is the package name, then it is already in the arena. + // If not, copy it there. It came from the call to AddPackage below. + package->name = + &name == &file->package() ? &name : tables_->AllocateString(name); + package->file = file; + tables_->AddSymbol(*package->name, Symbol(package)); + // Also add parent package, if any. TProtoStringType::size_type dot_pos = name.find_last_of('.'); if (dot_pos == TProtoStringType::npos) { // No parents. ValidateSymbolName(name, name, proto); } else { // Has parent. - TProtoStringType* parent_name = - tables_->AllocateString(name.substr(0, dot_pos)); - AddPackage(*parent_name, proto, file); + AddPackage(name.substr(0, dot_pos), proto, file); ValidateSymbolName(name.substr(dot_pos + 1), name, proto); } - } else { - Symbol existing_symbol = tables_->FindSymbol(name); - // It's OK to redefine a package. - if (existing_symbol.type != Symbol::PACKAGE) { - // Symbol seems to have been defined in a different file. - AddError(name, proto, DescriptorPool::ErrorCollector::NAME, - "\"" + name + - "\" is already defined (as something other than " - "a package) in file \"" + - existing_symbol.GetFile()->name() + "\"."); - } + } else if (existing_symbol.type() != Symbol::PACKAGE) { + // Symbol seems to have been defined in a different file. + AddError(name, proto, DescriptorPool::ErrorCollector::NAME, + "\"" + name + + "\" is already defined (as something other than " + "a package) in file \"" + + existing_symbol.GetFile()->name() + "\"."); } } @@ -4177,12 +4689,12 @@ void DescriptorBuilder::AllocateOptionsImpl( if (!unknown_fields.empty()) { // Can not use options->GetDescriptor() which may case deadlock. Symbol msg_symbol = tables_->FindSymbol(option_name); - if (msg_symbol.type == Symbol::MESSAGE) { + if (msg_symbol.type() == Symbol::MESSAGE) { for (int i = 0; i < unknown_fields.field_count(); ++i) { assert_mutex_held(pool_); const FieldDescriptor* field = pool_->InternalFindExtensionByNumberNoLock( - msg_symbol.descriptor, unknown_fields.field(i).number()); + msg_symbol.descriptor(), unknown_fields.field(i).number()); if (field) { unused_dependency_.erase(field->file()); } @@ -4395,18 +4907,7 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependency_count_ = proto.dependency_size(); result->dependencies_ = tables_->AllocateArray<const FileDescriptor*>(proto.dependency_size()); - if (pool_->lazily_build_dependencies_) { - result->dependencies_once_ = tables_->AllocateOnceDynamic(); - result->dependencies_names_ = - tables_->AllocateArray<const TProtoStringType*>(proto.dependency_size()); - if (proto.dependency_size() > 0) { - memset(result->dependencies_names_, 0, - sizeof(*result->dependencies_names_) * proto.dependency_size()); - } - } else { - result->dependencies_once_ = nullptr; - result->dependencies_names_ = nullptr; - } + result->dependencies_once_ = nullptr; unused_dependency_.clear(); std::set<int> weak_deps; for (int i = 0; i < proto.weak_dependency_size(); ++i) { @@ -4452,7 +4953,17 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependencies_[i] = dependency; if (pool_->lazily_build_dependencies_ && !dependency) { - result->dependencies_names_[i] = + if (result->dependencies_once_ == nullptr) { + result->dependencies_once_ = tables_->AllocateLazyInit(); + result->dependencies_once_->file.dependencies_names = + tables_->AllocateArray<const TProtoStringType*>(proto.dependency_size()); + if (proto.dependency_size() > 0) { + std::fill_n(result->dependencies_once_->file.dependencies_names, + proto.dependency_size(), nullptr); + } + } + + result->dependencies_once_->file.dependencies_names[i] = tables_->AllocateString(proto.dependency(i)); } } @@ -4570,16 +5081,14 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( } -TProtoStringType* DescriptorBuilder::AllocateNameString( +const TProtoStringType* DescriptorBuilder::AllocateNameStrings( const TProtoStringType& scope, const TProtoStringType& proto_name) { - TProtoStringType* full_name; if (scope.empty()) { - full_name = tables_->AllocateString(proto_name); + return tables_->AllocateStringArray(proto_name, proto_name); } else { - full_name = tables_->AllocateEmptyString(); - *full_name = StrCat(scope, ".", proto_name); + return tables_->AllocateStringArray(proto_name, + StrCat(scope, ".", proto_name)); } - return full_name; } void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, @@ -4587,18 +5096,16 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, Descriptor* result) { const TProtoStringType& scope = (parent == nullptr) ? file_->package() : parent->full_name(); - TProtoStringType* full_name = AllocateNameString(scope, proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); + result->all_names_ = AllocateNameStrings(scope, proto.name()); + ValidateSymbolName(proto.name(), result->full_name(), proto); - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; result->file_ = file_; result->containing_type_ = parent; result->is_placeholder_ = false; result->is_unqualified_placeholder_ = false; result->well_known_type_ = Descriptor::WELLKNOWNTYPE_UNSPECIFIED; - auto it = pool_->tables_->well_known_types_.find(*full_name); + auto it = pool_->tables_->well_known_types_.find(result->full_name()); if (it != pool_->tables_->well_known_types_.end()) { result->well_known_type_ = it->second; } @@ -4726,14 +5233,23 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, bool is_extension) { const TProtoStringType& scope = (parent == nullptr) ? file_->package() : parent->full_name(); - TProtoStringType* full_name = AllocateNameString(scope, proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + // We allocate all names in a single array, and dedup them. + // We remember the indices for the potentially deduped values. + auto all_names = tables_->AllocateFieldNames( + proto.name(), scope, + proto.has_json_name() ? &proto.json_name() : nullptr); + result->all_names_ = all_names.array; + result->lowercase_name_index_ = all_names.lowercase_index; + result->camelcase_name_index_ = all_names.camelcase_index; + result->json_name_index_ = all_names.json_index; + + ValidateSymbolName(proto.name(), result->full_name(), proto); + result->file_ = file_; result->number_ = proto.number(); result->is_extension_ = is_extension; + result->is_oneof_ = false; result->proto3_optional_ = proto.proto3_optional(); if (proto.proto3_optional() && @@ -4744,31 +5260,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, result->full_name()); } - // If .proto files follow the style guide then the name should already be - // lower-cased. If that's the case we can just reuse the string we - // already allocated rather than allocate a new one. - TProtoStringType lowercase_name(proto.name()); - LowerString(&lowercase_name); - if (lowercase_name == proto.name()) { - result->lowercase_name_ = result->name_; - } else { - result->lowercase_name_ = tables_->AllocateString(lowercase_name); - } - - // Don't bother with the above optimization for camel-case names since - // .proto files that follow the guide shouldn't be using names in this - // format, so the optimization wouldn't help much. - result->camelcase_name_ = - tables_->AllocateString(ToCamelCase(proto.name(), - /* lower_first = */ true)); - - if (proto.has_json_name()) { - result->has_json_name_ = true; - result->json_name_ = tables_->AllocateString(proto.json_name()); - } else { - result->has_json_name_ = false; - result->json_name_ = tables_->AllocateString(ToJsonName(proto.name())); - } + result->has_json_name_ = proto.has_json_name(); // Some compilers do not allow static_cast directly between two enum types, // so we must cast to int first. @@ -4793,13 +5285,8 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, // Some of these may be filled in when cross-linking. result->containing_type_ = nullptr; - result->extension_scope_ = nullptr; - result->message_type_ = nullptr; - result->enum_type_ = nullptr; - result->type_name_ = nullptr; result->type_once_ = nullptr; result->default_value_enum_ = nullptr; - result->default_value_enum_name_ = nullptr; result->has_default_value_ = proto.has_default_value(); if (proto.has_default_value() && result->is_repeated()) { @@ -4813,19 +5300,19 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, char* end_pos = nullptr; switch (result->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - result->default_value_int32_ = + result->default_value_int32_t_ = strtol(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_INT64: - result->default_value_int64_ = + result->default_value_int64_t_ = strto64(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_UINT32: - result->default_value_uint32_ = + result->default_value_uint32_t_ = strtoul(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_UINT64: - result->default_value_uint64_ = + result->default_value_uint64_t_ = strtou64(proto.default_value().c_str(), &end_pos, 0); break; case FieldDescriptor::CPPTYPE_FLOAT: @@ -4906,16 +5393,16 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, // No explicit default value switch (result->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: - result->default_value_int32_ = 0; + result->default_value_int32_t_ = 0; break; case FieldDescriptor::CPPTYPE_INT64: - result->default_value_int64_ = 0; + result->default_value_int64_t_ = 0; break; case FieldDescriptor::CPPTYPE_UINT32: - result->default_value_uint32_ = 0; + result->default_value_uint32_t_ = 0; break; case FieldDescriptor::CPPTYPE_UINT64: - result->default_value_uint64_ = 0; + result->default_value_uint64_t_ = 0; break; case FieldDescriptor::CPPTYPE_FLOAT: result->default_value_float_ = 0.0f; @@ -4972,16 +5459,13 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, "FieldDescriptorProto.extendee not set for extension field."); } - result->extension_scope_ = parent; + result->scope_.extension_scope = parent; if (proto.has_oneof_index()) { AddError(result->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, "FieldDescriptorProto.oneof_index should not be set for " "extensions."); } - - // Fill in later (maybe). - result->containing_oneof_ = nullptr; } else { if (proto.has_extendee()) { AddError(result->full_name(), proto, @@ -4999,12 +5483,11 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, strings::Substitute("FieldDescriptorProto.oneof_index $0 is " "out of range for type \"$1\".", proto.oneof_index(), parent->name())); - result->containing_oneof_ = nullptr; } else { - result->containing_oneof_ = parent->oneof_decl(proto.oneof_index()); + result->is_oneof_ = true; + result->scope_.containing_oneof = + parent->oneof_decl(proto.oneof_index()); } - } else { - result->containing_oneof_ = nullptr; } } @@ -5083,12 +5566,8 @@ void DescriptorBuilder::BuildReservedRange( void DescriptorBuilder::BuildOneof(const OneofDescriptorProto& proto, Descriptor* parent, OneofDescriptor* result) { - TProtoStringType* full_name = - AllocateNameString(parent->full_name(), proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + result->all_names_ = AllocateNameStrings(parent->full_name(), proto.name()); + ValidateSymbolName(proto.name(), result->full_name(), proto); result->containing_type_ = parent; @@ -5178,11 +5657,9 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, EnumDescriptor* result) { const TProtoStringType& scope = (parent == nullptr) ? file_->package() : parent->full_name(); - TProtoStringType* full_name = AllocateNameString(scope, proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + result->all_names_ = AllocateNameStrings(scope, proto.name()); + ValidateSymbolName(proto.name(), result->full_name(), proto); result->file_ = file_; result->containing_type_ = parent; result->is_placeholder_ = false; @@ -5272,20 +5749,20 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, const EnumDescriptor* parent, EnumValueDescriptor* result) { - result->name_ = tables_->AllocateString(proto.name()); - result->number_ = proto.number(); - result->type_ = parent; - // Note: full_name for enum values is a sibling to the parent's name, not a // child of it. - TProtoStringType* full_name = tables_->AllocateEmptyString(); - size_t scope_len = parent->full_name_->size() - parent->name_->size(); - full_name->reserve(scope_len + result->name_->size()); - full_name->append(parent->full_name_->data(), scope_len); - full_name->append(*result->name_); - result->full_name_ = full_name; + TProtoStringType full_name; + size_t scope_len = parent->full_name().size() - parent->name().size(); + full_name.reserve(scope_len + proto.name().size()); + full_name.append(parent->full_name().data(), scope_len); + full_name.append(proto.name()); + + result->all_names_ = + tables_->AllocateStringArray(proto.name(), std::move(full_name)); + result->number_ = proto.number(); + result->type_ = parent; - ValidateSymbolName(proto.name(), *full_name, proto); + ValidateSymbolName(proto.name(), result->full_name(), proto); // Copy options. result->options_ = nullptr; // Set to default_instance later if necessary. @@ -5300,14 +5777,14 @@ void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, // parent->containing_type() as the value's parent. bool added_to_outer_scope = AddSymbol(result->full_name(), parent->containing_type(), result->name(), - proto, Symbol(result)); + proto, Symbol::EnumValue(result, 0)); // However, we also want to be able to search for values within a single // enum type, so we add it as a child of the enum type itself, too. // Note: This could fail, but if it does, the error has already been // reported by the above AddSymbol() call, so we ignore the return code. - bool added_to_inner_scope = - file_tables_->AddAliasUnderParent(parent, result->name(), Symbol(result)); + bool added_to_inner_scope = file_tables_->AddAliasUnderParent( + parent, result->name(), Symbol::EnumValue(result, 1)); if (added_to_inner_scope && !added_to_outer_scope) { // This value did not conflict with any values defined in the same enum, @@ -5343,12 +5820,9 @@ void DescriptorBuilder::BuildEnumValue(const EnumValueDescriptorProto& proto, void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto, const void* /* dummy */, ServiceDescriptor* result) { - TProtoStringType* full_name = AllocateNameString(file_->package(), proto.name()); - ValidateSymbolName(proto.name(), *full_name, proto); - - result->name_ = tables_->AllocateString(proto.name()); - result->full_name_ = full_name; + result->all_names_ = AllocateNameStrings(file_->package(), proto.name()); result->file_ = file_; + ValidateSymbolName(proto.name(), result->full_name(), proto); BUILD_ARRAY(proto, result, method, BuildMethod, result); @@ -5367,14 +5841,10 @@ void DescriptorBuilder::BuildService(const ServiceDescriptorProto& proto, void DescriptorBuilder::BuildMethod(const MethodDescriptorProto& proto, const ServiceDescriptor* parent, MethodDescriptor* result) { - result->name_ = tables_->AllocateString(proto.name()); result->service_ = parent; + result->all_names_ = AllocateNameStrings(parent->full_name(), proto.name()); - TProtoStringType* full_name = - AllocateNameString(parent->full_name(), *result->name_); - result->full_name_ = full_name; - - ValidateSymbolName(proto.name(), *full_name, proto); + ValidateSymbolName(proto.name(), result->full_name(), proto); // These will be filled in when cross-linking. result->input_type_.Init(); @@ -5570,13 +6040,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, DescriptorPool::ErrorCollector::EXTENDEE, proto.extendee()); return; - } else if (extendee.type != Symbol::MESSAGE) { + } else if (extendee.type() != Symbol::MESSAGE) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::EXTENDEE, "\"" + proto.extendee() + "\" is not a message type."); return; } - field->containing_type_ = extendee.descriptor; + field->containing_type_ = extendee.descriptor(); const Descriptor::ExtensionRange* extension_range = field->containing_type()->FindExtensionRangeContainingNumber( @@ -5637,10 +6107,10 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, // Save the symbol names for later for lookup, and allocate the once // object needed for the accessors. TProtoStringType name = proto.type_name(); - field->type_once_ = tables_->AllocateOnceDynamic(); - field->type_name_ = tables_->AllocateString(name); + field->type_once_ = tables_->AllocateLazyInit(); + field->type_once_->field.type_name = tables_->AllocateString(name); if (proto.has_default_value()) { - field->default_value_enum_name_ = + field->type_once_->field.default_value_enum_name = tables_->AllocateString(proto.default_value()); } // AddFieldByNumber and AddExtension are done later in this function, @@ -5670,9 +6140,9 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, if (!proto.has_type()) { // Choose field type based on symbol. - if (type.type == Symbol::MESSAGE) { + if (type.type() == Symbol::MESSAGE) { field->type_ = FieldDescriptor::TYPE_MESSAGE; - } else if (type.type == Symbol::ENUM) { + } else if (type.type() == Symbol::ENUM) { field->type_ = FieldDescriptor::TYPE_ENUM; } else { AddError(field->full_name(), proto, @@ -5683,13 +6153,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, } if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - if (type.type != Symbol::MESSAGE) { + field->type_descriptor_.message_type = type.descriptor(); + if (field->type_descriptor_.message_type == nullptr) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, "\"" + proto.type_name() + "\" is not a message type."); return; } - field->message_type_ = type.descriptor; if (field->has_default_value()) { AddError(field->full_name(), proto, @@ -5697,13 +6167,13 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, "Messages can't have default values."); } } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { - if (type.type != Symbol::ENUM) { + field->type_descriptor_.enum_type = type.enum_descriptor(); + if (field->type_descriptor_.enum_type == nullptr) { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, "\"" + proto.type_name() + "\" is not an enum type."); return; } - field->enum_type_ = type.enum_descriptor; if (field->enum_type()->is_placeholder_) { // We can't look up default values for placeholder types. We'll have @@ -5725,13 +6195,14 @@ void DescriptorBuilder::CrossLinkField(FieldDescriptor* field, // We can't just use field->enum_type()->FindValueByName() here // because that locks the pool's mutex, which we have already locked // at this point. - Symbol default_value = LookupSymbolNoPlaceholder( - proto.default_value(), field->enum_type()->full_name()); - - if (default_value.type == Symbol::ENUM_VALUE && - default_value.enum_value_descriptor->type() == - field->enum_type()) { - field->default_value_enum_ = default_value.enum_value_descriptor; + const EnumValueDescriptor* default_value = + LookupSymbolNoPlaceholder(proto.default_value(), + field->enum_type()->full_name()) + .enum_value_descriptor(); + + if (default_value != nullptr && + default_value->type() == field->enum_type()) { + field->default_value_enum_ = default_value; } else { AddError(field->full_name(), proto, DescriptorPool::ErrorCollector::DEFAULT_VALUE, @@ -5859,12 +6330,12 @@ void DescriptorBuilder::CrossLinkMethod(MethodDescriptor* method, } else { method->input_type_.SetLazy(proto.input_type(), file_); } - } else if (input_type.type != Symbol::MESSAGE) { + } else if (input_type.type() != Symbol::MESSAGE) { AddError(method->full_name(), proto, DescriptorPool::ErrorCollector::INPUT_TYPE, "\"" + proto.input_type() + "\" is not a message type."); } else { - method->input_type_.Set(input_type.descriptor); + method->input_type_.Set(input_type.descriptor()); } Symbol output_type = @@ -5879,12 +6350,12 @@ void DescriptorBuilder::CrossLinkMethod(MethodDescriptor* method, } else { method->output_type_.SetLazy(proto.output_type(), file_); } - } else if (output_type.type != Symbol::MESSAGE) { + } else if (output_type.type() != Symbol::MESSAGE) { AddError(method->full_name(), proto, DescriptorPool::ErrorCollector::OUTPUT_TYPE, "\"" + proto.output_type() + "\" is not a message type."); } else { - method->output_type_.Set(output_type.descriptor); + method->output_type_.Set(output_type.descriptor()); } } @@ -6056,10 +6527,10 @@ void DescriptorBuilder::ValidateMessageOptions(Descriptor* message, VALIDATE_OPTIONS_FROM_ARRAY(message, enum_type, Enum); VALIDATE_OPTIONS_FROM_ARRAY(message, extension, Field); - const int64 max_extension_range = - static_cast<int64>(message->options().message_set_wire_format() - ? kint32max - : FieldDescriptor::kMaxNumber); + const int64_t max_extension_range = + static_cast<int64_t>(message->options().message_set_wire_format() + ? kint32max + : FieldDescriptor::kMaxNumber); for (int i = 0; i < message->extension_range_count(); ++i) { if (message->extension_range(i)->end > max_extension_range + 1) { AddError(message->full_name(), proto.extension_range(i), @@ -6497,9 +6968,8 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // the file that defines the option, not descriptor.proto itself. Symbol symbol = builder_->FindSymbolNotEnforcingDeps( options->GetDescriptor()->full_name()); - if (!symbol.IsNull() && symbol.type == Symbol::MESSAGE) { - options_descriptor = symbol.descriptor; - } else { + options_descriptor = symbol.descriptor(); + if (options_descriptor == nullptr) { // The options message's descriptor was not in the builder's pool, so use // the standard version from the generated pool. We're not holding the // generated pool's mutex, so we can search it the straightforward way. @@ -6535,9 +7005,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // mutex, and the latter method locks it again. symbol = builder_->LookupSymbol(name_part, options_to_interpret_->name_scope); - if (!symbol.IsNull() && symbol.type == Symbol::FIELD) { - field = symbol.field_descriptor; - } + field = symbol.field_descriptor(); // If we don't find the field then the field's descriptor was not in the // builder's pool, but there's no point in looking in the generated // pool. We require that you import the file that defines any extensions @@ -6708,7 +7176,7 @@ void DescriptorBuilder::OptionInterpreter::UpdateSourceCodeInfo( if (matched) { // see if this location is in the range to remove bool loc_matches = true; - if (loc->path_size() < static_cast<int64>(pathv.size())) { + if (loc->path_size() < static_cast<int64_t>(pathv.size())) { loc_matches = false; } else { for (size_t j = 0; j < pathv.size(); j++) { @@ -6851,7 +7319,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT32: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast<uint64>(kint32max)) { + static_cast<uint64_t>(kint32max)) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -6861,7 +7329,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } } else if (uninterpreted_option_->has_negative_int_value()) { if (uninterpreted_option_->negative_int_value() < - static_cast<int64>(kint32min)) { + static_cast<int64_t>(kint32min)) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -6878,7 +7346,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT64: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast<uint64>(kint64max)) { + static_cast<uint64_t>(kint64max)) { return AddValueError("Value out of range for int64 option \"" + option_field->full_name() + "\"."); } else { @@ -6962,7 +7430,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } case FieldDescriptor::CPPTYPE_BOOL: - uint64 value; + uint64_t value; if (!uninterpreted_option_->has_identifier_value()) { return AddValueError( "Value must be identifier for boolean option " @@ -7007,15 +7475,15 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( // the pool's mutex, and the latter method locks it again. Symbol symbol = builder_->FindSymbolNotEnforcingDeps(fully_qualified_name); - if (!symbol.IsNull() && symbol.type == Symbol::ENUM_VALUE) { - if (symbol.enum_value_descriptor->type() != enum_type) { + if (auto* candicate_descriptor = symbol.enum_value_descriptor()) { + if (candicate_descriptor->type() != enum_type) { return AddValueError( "Enum type \"" + enum_type->full_name() + "\" has no value named \"" + value_name + "\" for option \"" + option_field->full_name() + "\". This appears to be a value from a sibling type."); } else { - enum_value = symbol.enum_value_descriptor; + enum_value = candicate_descriptor; } } } else { @@ -7032,11 +7500,11 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( "option \"" + option_field->full_name() + "\"."); } else { - // Sign-extension is not a problem, since we cast directly from int32 to - // uint64, without first going through uint32. + // Sign-extension is not a problem, since we cast directly from int32_t + // to uint64_t, without first going through uint32_t. unknown_fields->AddVarint( option_field->number(), - static_cast<uint64>(static_cast<int64>(enum_value->number()))); + static_cast<uint64_t>(static_cast<int64_t>(enum_value->number()))); } break; } @@ -7076,8 +7544,7 @@ class DescriptorBuilder::OptionInterpreter::AggregateOptionFinder return nullptr; } assert_mutex_held(builder_->pool_); - Symbol result = builder_->FindSymbol(name); - return result.type == Symbol::MESSAGE ? result.descriptor : nullptr; + return builder_->FindSymbol(name).descriptor(); } const FieldDescriptor* FindExtension(Message* message, @@ -7086,12 +7553,11 @@ class DescriptorBuilder::OptionInterpreter::AggregateOptionFinder const Descriptor* descriptor = message->GetDescriptor(); Symbol result = builder_->LookupSymbolNoPlaceholder(name, descriptor->full_name()); - if (result.type == Symbol::FIELD && - result.field_descriptor->is_extension()) { - return result.field_descriptor; - } else if (result.type == Symbol::MESSAGE && + if (auto* field = result.field_descriptor()) { + return field; + } else if (result.type() == Symbol::MESSAGE && descriptor->options().message_set_wire_format()) { - const Descriptor* foreign_type = result.descriptor; + const Descriptor* foreign_type = result.descriptor(); // The text format allows MessageSet items to be specified using // the type name, rather than the extension identifier. If the symbol // lookup returned a Message, and the enclosing Message has @@ -7180,16 +7646,16 @@ bool DescriptorBuilder::OptionInterpreter::SetAggregateOption( } void DescriptorBuilder::OptionInterpreter::SetInt32( - int number, int32 value, FieldDescriptor::Type type, + int number, int32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_INT32: - unknown_fields->AddVarint(number, - static_cast<uint64>(static_cast<int64>(value))); + unknown_fields->AddVarint( + number, static_cast<uint64_t>(static_cast<int64_t>(value))); break; case FieldDescriptor::TYPE_SFIXED32: - unknown_fields->AddFixed32(number, static_cast<uint32>(value)); + unknown_fields->AddFixed32(number, static_cast<uint32_t>(value)); break; case FieldDescriptor::TYPE_SINT32: @@ -7204,15 +7670,15 @@ void DescriptorBuilder::OptionInterpreter::SetInt32( } void DescriptorBuilder::OptionInterpreter::SetInt64( - int number, int64 value, FieldDescriptor::Type type, + int number, int64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_INT64: - unknown_fields->AddVarint(number, static_cast<uint64>(value)); + unknown_fields->AddVarint(number, static_cast<uint64_t>(value)); break; case FieldDescriptor::TYPE_SFIXED64: - unknown_fields->AddFixed64(number, static_cast<uint64>(value)); + unknown_fields->AddFixed64(number, static_cast<uint64_t>(value)); break; case FieldDescriptor::TYPE_SINT64: @@ -7227,15 +7693,15 @@ void DescriptorBuilder::OptionInterpreter::SetInt64( } void DescriptorBuilder::OptionInterpreter::SetUInt32( - int number, uint32 value, FieldDescriptor::Type type, + int number, uint32_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_UINT32: - unknown_fields->AddVarint(number, static_cast<uint64>(value)); + unknown_fields->AddVarint(number, static_cast<uint64_t>(value)); break; case FieldDescriptor::TYPE_FIXED32: - unknown_fields->AddFixed32(number, static_cast<uint32>(value)); + unknown_fields->AddFixed32(number, static_cast<uint32_t>(value)); break; default: @@ -7245,7 +7711,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt32( } void DescriptorBuilder::OptionInterpreter::SetUInt64( - int number, uint64 value, FieldDescriptor::Type type, + int number, uint64_t value, FieldDescriptor::Type type, UnknownFieldSet* unknown_fields) { switch (type) { case FieldDescriptor::TYPE_UINT64: @@ -7300,39 +7766,39 @@ Symbol DescriptorPool::CrossLinkOnDemandHelper(StringPiece name, // enum_type_, message_type_, and default_value_enum_ appropriately. void FieldDescriptor::InternalTypeOnceInit() const { GOOGLE_CHECK(file()->finished_building_ == true); - if (type_name_) { + const EnumDescriptor* enum_type = nullptr; + if (type_once_->field.type_name) { Symbol result = file()->pool()->CrossLinkOnDemandHelper( - *type_name_, type_ == FieldDescriptor::TYPE_ENUM); - if (result.type == Symbol::MESSAGE) { + *type_once_->field.type_name, type_ == FieldDescriptor::TYPE_ENUM); + if (result.type() == Symbol::MESSAGE) { type_ = FieldDescriptor::TYPE_MESSAGE; - message_type_ = result.descriptor; - } else if (result.type == Symbol::ENUM) { + type_descriptor_.message_type = result.descriptor(); + } else if (result.type() == Symbol::ENUM) { type_ = FieldDescriptor::TYPE_ENUM; - enum_type_ = result.enum_descriptor; + enum_type = type_descriptor_.enum_type = result.enum_descriptor(); } } - if (enum_type_ && !default_value_enum_) { - if (default_value_enum_name_) { + if (enum_type && !default_value_enum_) { + if (type_once_->field.default_value_enum_name) { // Have to build the full name now instead of at CrossLink time, - // because enum_type_ may not be known at the time. - TProtoStringType name = enum_type_->full_name(); + // because enum_type may not be known at the time. + TProtoStringType name = enum_type->full_name(); // Enum values reside in the same scope as the enum type. TProtoStringType::size_type last_dot = name.find_last_of('.'); if (last_dot != TProtoStringType::npos) { - name = name.substr(0, last_dot) + "." + *default_value_enum_name_; + name = name.substr(0, last_dot) + "." + + *type_once_->field.default_value_enum_name; } else { - name = *default_value_enum_name_; + name = *type_once_->field.default_value_enum_name; } Symbol result = file()->pool()->CrossLinkOnDemandHelper(name, true); - if (result.type == Symbol::ENUM_VALUE) { - default_value_enum_ = result.enum_value_descriptor; - } + default_value_enum_ = result.enum_value_descriptor(); } 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()); - default_value_enum_ = enum_type_->value(0); + GOOGLE_CHECK(enum_type->value_count()); + default_value_enum_ = enum_type->value(0); } } } @@ -7346,21 +7812,23 @@ void FieldDescriptor::TypeOnceInit(const FieldDescriptor* to_init) { // import building and cross linking of a field of a message. const Descriptor* FieldDescriptor::message_type() const { if (type_once_) { - internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); + internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this); } - return message_type_; + return type_ == TYPE_MESSAGE || type_ == TYPE_GROUP + ? type_descriptor_.message_type + : nullptr; } const EnumDescriptor* FieldDescriptor::enum_type() const { if (type_once_) { - internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); + internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this); } - return enum_type_; + return type_ == TYPE_ENUM ? type_descriptor_.enum_type : nullptr; } const EnumValueDescriptor* FieldDescriptor::default_value_enum() const { if (type_once_) { - internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); + internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this); } return default_value_enum_; } @@ -7376,9 +7844,10 @@ const TProtoStringType& FieldDescriptor::PrintableNameForExtension() const { void FileDescriptor::InternalDependenciesOnceInit() const { GOOGLE_CHECK(finished_building_ == true); + auto* names = dependencies_once_->file.dependencies_names; for (int i = 0; i < dependency_count(); i++) { - if (dependencies_names_[i]) { - dependencies_[i] = pool_->FindFileByName(*dependencies_names_[i]); + if (names[i]) { + dependencies_[i] = pool_->FindFileByName(*names[i]); } } } @@ -7391,7 +7860,7 @@ const FileDescriptor* FileDescriptor::dependency(int index) const { if (dependencies_once_) { // Do once init for all indices, as it's unlikely only a single index would // be called, and saves on internal::call_once allocations. - internal::call_once(*dependencies_once_, + internal::call_once(dependencies_once_->once, FileDescriptor::DependenciesOnceInit, this); } return dependencies_[index]; @@ -7408,9 +7877,7 @@ const Descriptor* MethodDescriptor::output_type() const { namespace internal { void LazyDescriptor::Set(const Descriptor* descriptor) { - GOOGLE_CHECK(!name_); GOOGLE_CHECK(!once_); - GOOGLE_CHECK(!file_); descriptor_ = descriptor; } @@ -7418,31 +7885,32 @@ void LazyDescriptor::SetLazy(StringPiece name, const FileDescriptor* file) { // verify Init() has been called and Set hasn't been called yet. GOOGLE_CHECK(!descriptor_); - GOOGLE_CHECK(!file_); - GOOGLE_CHECK(!name_); GOOGLE_CHECK(!once_); GOOGLE_CHECK(file && file->pool_); GOOGLE_CHECK(file->pool_->lazily_build_dependencies_); GOOGLE_CHECK(!file->finished_building_); - file_ = file; - name_ = file->pool_->tables_->AllocateString(name); - once_ = file->pool_->tables_->AllocateOnceDynamic(); + once_ = file->pool_->tables_->AllocateLazyInit(); + once_->descriptor.file = file; + once_->descriptor.name = file->pool_->tables_->AllocateString(name); } void LazyDescriptor::Once() { if (once_) { - internal::call_once(*once_, LazyDescriptor::OnceStatic, this); + internal::call_once(once_->once, LazyDescriptor::OnceStatic, this); } } void LazyDescriptor::OnceStatic(LazyDescriptor* lazy) { lazy->OnceInternal(); } void LazyDescriptor::OnceInternal() { - GOOGLE_CHECK(file_->finished_building_); - if (!descriptor_ && name_) { - Symbol result = file_->pool_->CrossLinkOnDemandHelper(*name_, false); - if (!result.IsNull() && result.type == Symbol::MESSAGE) { - descriptor_ = result.descriptor; + auto* file = once_->descriptor.file; + auto* name = once_->descriptor.name; + GOOGLE_CHECK(file->finished_building_); + if (!descriptor_ && name) { + auto* descriptor = + file->pool_->CrossLinkOnDemandHelper(*name, false).descriptor(); + if (descriptor != nullptr) { + descriptor_ = descriptor; } } } diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.h index 3e2ddfe663..6739e8075b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.h @@ -62,6 +62,7 @@ #include <vector> #include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/mutex.h> #include <google/protobuf/stubs/once.h> #include <google/protobuf/port.h> @@ -121,7 +122,7 @@ class Reflection; // Defined in descriptor.cc class DescriptorBuilder; class FileDescriptorTables; -struct Symbol; +class Symbol; // Defined in unknown_field_set.h. class UnknownField; @@ -182,15 +183,37 @@ struct DebugStringOptions { // which is needed when a pool has lazily_build_dependencies_ set. // Must be instantiated as mutable in a descriptor. namespace internal { + +// Data required to do lazy initialization. +struct PROTOBUF_EXPORT LazyInitData { +#ifndef SWIG + internal::once_flag once; +#endif + struct Field { + const TProtoStringType* type_name; + const TProtoStringType* default_value_enum_name; + }; + struct Descriptor { + const TProtoStringType* name; + const FileDescriptor* file; + }; + struct File { + const TProtoStringType** dependencies_names; + }; + union { + Field field; + Descriptor descriptor; + File file; + }; +}; + class PROTOBUF_EXPORT LazyDescriptor { public: // Init function to be called at init time of a descriptor containing // a LazyDescriptor. void Init() { descriptor_ = nullptr; - name_ = nullptr; once_ = nullptr; - file_ = nullptr; } // Sets the value of the descriptor if it is known during the descriptor @@ -220,10 +243,22 @@ class PROTOBUF_EXPORT LazyDescriptor { void Once(); const Descriptor* descriptor_; - const TProtoStringType* name_; - internal::once_flag* once_; - const FileDescriptor* file_; + LazyInitData* once_; }; + +class PROTOBUF_EXPORT SymbolBase { + private: + friend class google::protobuf::Symbol; + uint8_t symbol_type_; +}; + +// Some types have more than one SymbolBase because they have multiple +// identities in the table. We can't have duplicate direct bases, so we use this +// intermediate base to do so. +// See BuildEnumValue for details. +template <int N> +class PROTOBUF_EXPORT SymbolBaseN : public SymbolBase {}; + } // namespace internal // Describes a type of protocol message, or a particular group within a @@ -231,7 +266,7 @@ class PROTOBUF_EXPORT LazyDescriptor { // Message::GetDescriptor(). Generated message classes also have a // static method called descriptor() which returns the type's descriptor. // Use DescriptorPool to construct your own descriptors. -class PROTOBUF_EXPORT Descriptor { +class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase { public: typedef DescriptorProto Proto; @@ -500,6 +535,7 @@ class PROTOBUF_EXPORT Descriptor { const FieldDescriptor* map_value() const; private: + friend class Symbol; typedef MessageOptions OptionsType; // Allows tests to test CopyTo(proto, true). @@ -524,8 +560,16 @@ class PROTOBUF_EXPORT Descriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; + // True if this is a placeholder for an unknown type. + bool is_placeholder_ : 1; + // True if this is a placeholder and the type name wasn't fully-qualified. + bool is_unqualified_placeholder_ : 1; + // Well known type. Stored as char to conserve space. + char well_known_type_; + int field_count_; + + // all_names_ = [name, full_name] + const TProtoStringType* all_names_; const FileDescriptor* file_; const Descriptor* containing_type_; const MessageOptions* options_; @@ -540,7 +584,6 @@ class PROTOBUF_EXPORT Descriptor { ReservedRange* reserved_ranges_; const TProtoStringType** reserved_names_; - int field_count_; int oneof_decl_count_; int real_oneof_decl_count_; int nested_type_count_; @@ -550,13 +593,6 @@ class PROTOBUF_EXPORT Descriptor { int reserved_range_count_; int reserved_name_count_; - // True if this is a placeholder for an unknown type. - bool is_placeholder_; - // True if this is a placeholder and the type name wasn't fully-qualified. - bool is_unqualified_placeholder_; - // Well known type. Stored as char to conserve space. - char well_known_type_; - // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate<Descriptor>() and AllocateArray<Descriptor>() in descriptor.cc // and update them to initialize the field. @@ -584,7 +620,7 @@ class PROTOBUF_EXPORT Descriptor { // - Given a DescriptorPool, call DescriptorPool::FindExtensionByNumber() or // DescriptorPool::FindExtensionByPrintableName(). // Use DescriptorPool to construct your own descriptors. -class PROTOBUF_EXPORT FieldDescriptor { +class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { public: typedef FieldDescriptorProto Proto; @@ -727,16 +763,20 @@ class PROTOBUF_EXPORT FieldDescriptor { // Get the field default value if cpp_type() == CPPTYPE_INT32. If no // explicit default was defined, the default is 0. - int32 default_value_int32() const; + int32_t default_value_int32_t() const; + int32_t default_value_int32() const { return default_value_int32_t(); } // Get the field default value if cpp_type() == CPPTYPE_INT64. If no // explicit default was defined, the default is 0. - int64 default_value_int64() const; + int64_t default_value_int64_t() const; + int64 default_value_int64() const { return default_value_int64_t(); } // Get the field default value if cpp_type() == CPPTYPE_UINT32. If no // explicit default was defined, the default is 0. - uint32 default_value_uint32() const; + uint32_t default_value_uint32_t() const; + uint32_t default_value_uint32() const { return default_value_uint32_t(); } // Get the field default value if cpp_type() == CPPTYPE_UINT64. If no // explicit default was defined, the default is 0. - uint64 default_value_uint64() const; + uint64_t default_value_uint64_t() const; + uint64 default_value_uint64() const { return default_value_uint64_t(); } // Get the field default value if cpp_type() == CPPTYPE_FLOAT. If no // explicit default was defined, the default is 0.0. float default_value_float() const; @@ -835,6 +875,7 @@ class PROTOBUF_EXPORT FieldDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef FieldOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -864,44 +905,57 @@ class PROTOBUF_EXPORT FieldDescriptor { // Returns true if this is a map message type. bool is_map_message_type() const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; - const TProtoStringType* lowercase_name_; - const TProtoStringType* camelcase_name_; - // If has_json_name_ is true, it's the value specified by the user. - // Otherwise, it has the same value as camelcase_name_. - const TProtoStringType* json_name_; - const FileDescriptor* file_; - internal::once_flag* type_once_; - static void TypeOnceInit(const FieldDescriptor* to_init); - void InternalTypeOnceInit() const; - mutable Type type_; - Label label_; bool has_default_value_; bool proto3_optional_; // Whether the user has specified the json_name field option in the .proto // file. bool has_json_name_; bool is_extension_; + + // Actually a `Type`, but stored as uint8_t to save space. + mutable uint8_t type_; + // Actually a `Label` but stored as uint8_t to save space. + uint8_t label_; + + bool is_oneof_ : 1; + + // Logically: + // all_names_ = [name, full_name, lower, camel, json] + // However: + // duplicates will be omitted, so lower/camel/json might be in the same + // position. + // We store the true offset for each name here, and the bit width must be + // large enough to account for the worst case where all names are present. + uint8_t lowercase_name_index_ : 2; + uint8_t camelcase_name_index_ : 2; + uint8_t json_name_index_ : 3; + const TProtoStringType* all_names_; + const FileDescriptor* file_; + + internal::LazyInitData* type_once_; + static void TypeOnceInit(const FieldDescriptor* to_init); + void InternalTypeOnceInit() const; int number_; int index_in_oneof_; const Descriptor* containing_type_; - const OneofDescriptor* containing_oneof_; - const Descriptor* extension_scope_; - mutable const Descriptor* message_type_; - mutable const EnumDescriptor* enum_type_; + union { + const OneofDescriptor* containing_oneof; + const Descriptor* extension_scope; + } scope_; + union { + mutable const Descriptor* message_type; + mutable const EnumDescriptor* enum_type; + } type_descriptor_; const FieldOptions* options_; - const TProtoStringType* type_name_; - const TProtoStringType* default_value_enum_name_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate<FieldDescriptor>() and AllocateArray<FieldDescriptor>() in // descriptor.cc and update them to initialize the field. union { - int32 default_value_int32_; - int64 default_value_int64_; - uint32 default_value_uint32_; - uint64 default_value_uint64_; + int32_t default_value_int32_t_; + int64_t default_value_int64_t_; + uint32_t default_value_uint32_t_; + uint64_t default_value_uint64_t_; float default_value_float_; double default_value_double_; bool default_value_bool_; @@ -930,7 +984,7 @@ class PROTOBUF_EXPORT FieldDescriptor { // Describes a oneof defined in a message type. -class PROTOBUF_EXPORT OneofDescriptor { +class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase { public: typedef OneofDescriptorProto Proto; @@ -974,6 +1028,7 @@ class PROTOBUF_EXPORT OneofDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef OneofOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -988,10 +1043,11 @@ class PROTOBUF_EXPORT OneofDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; - const Descriptor* containing_type_; int field_count_; + + // all_names_ = [name, full_name] + const TProtoStringType* all_names_; + const Descriptor* containing_type_; const FieldDescriptor** fields_; const OneofOptions* options_; @@ -1009,7 +1065,7 @@ class PROTOBUF_EXPORT OneofDescriptor { // Describes an enum type defined in a .proto file. To get the EnumDescriptor // for a generated enum type, call TypeName_descriptor(). Use DescriptorPool // to construct your own descriptors. -class PROTOBUF_EXPORT EnumDescriptor { +class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { public: typedef EnumDescriptorProto Proto; @@ -1101,6 +1157,7 @@ class PROTOBUF_EXPORT EnumDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef EnumOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1126,18 +1183,18 @@ class PROTOBUF_EXPORT EnumDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; - const FileDescriptor* file_; - const Descriptor* containing_type_; - const EnumOptions* options_; - // True if this is a placeholder for an unknown type. bool is_placeholder_; // True if this is a placeholder and the type name wasn't fully-qualified. bool is_unqualified_placeholder_; int value_count_; + + // all_names_ = [name, full_name] + const TProtoStringType* all_names_; + const FileDescriptor* file_; + const Descriptor* containing_type_; + const EnumOptions* options_; EnumValueDescriptor* values_; int reserved_range_count_; @@ -1166,7 +1223,8 @@ class PROTOBUF_EXPORT EnumDescriptor { // for its type, then use EnumDescriptor::FindValueByName() or // EnumDescriptor::FindValueByNumber(). Use DescriptorPool to construct // your own descriptors. -class PROTOBUF_EXPORT EnumValueDescriptor { +class PROTOBUF_EXPORT EnumValueDescriptor : private internal::SymbolBaseN<0>, + private internal::SymbolBaseN<1> { public: typedef EnumValueDescriptorProto Proto; @@ -1209,6 +1267,7 @@ class PROTOBUF_EXPORT EnumValueDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef EnumValueOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1223,9 +1282,9 @@ class PROTOBUF_EXPORT EnumValueDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; int number_; + // all_names_ = [name, full_name] + const TProtoStringType* all_names_; const EnumDescriptor* type_; const EnumValueOptions* options_; // IMPORTANT: If you add a new field, make sure to search for all instances @@ -1244,7 +1303,7 @@ class PROTOBUF_EXPORT EnumValueDescriptor { // Describes an RPC service. Use DescriptorPool to construct your own // descriptors. -class PROTOBUF_EXPORT ServiceDescriptor { +class PROTOBUF_EXPORT ServiceDescriptor : private internal::SymbolBase { public: typedef ServiceDescriptorProto Proto; @@ -1289,6 +1348,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef ServiceOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1303,8 +1363,8 @@ class PROTOBUF_EXPORT ServiceDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; + // all_names_ = [name, full_name] + const TProtoStringType* all_names_; const FileDescriptor* file_; const ServiceOptions* options_; MethodDescriptor* methods_; @@ -1326,7 +1386,7 @@ class PROTOBUF_EXPORT ServiceDescriptor { // a service, first get its ServiceDescriptor, then call // ServiceDescriptor::FindMethodByName(). Use DescriptorPool to construct your // own descriptors. -class PROTOBUF_EXPORT MethodDescriptor { +class PROTOBUF_EXPORT MethodDescriptor : private internal::SymbolBase { public: typedef MethodDescriptorProto Proto; @@ -1375,6 +1435,7 @@ class PROTOBUF_EXPORT MethodDescriptor { bool GetSourceLocation(SourceLocation* out_location) const; private: + friend class Symbol; typedef MethodOptions OptionsType; // Allows access to GetLocationPath for annotations. @@ -1389,14 +1450,14 @@ class PROTOBUF_EXPORT MethodDescriptor { // to this descriptor from the file root. void GetLocationPath(std::vector<int>* output) const; - const TProtoStringType* name_; - const TProtoStringType* full_name_; + bool client_streaming_; + bool server_streaming_; + // all_names_ = [name, full_name] + const TProtoStringType* all_names_; const ServiceDescriptor* service_; mutable internal::LazyDescriptor input_type_; mutable internal::LazyDescriptor output_type_; const MethodOptions* options_; - bool client_streaming_; - bool server_streaming_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate<MethodDescriptor>() and AllocateArray<MethodDescriptor>() in // descriptor.cc and update them to initialize the field. @@ -1554,7 +1615,7 @@ class PROTOBUF_EXPORT FileDescriptor { const TProtoStringType* name_; const TProtoStringType* package_; const DescriptorPool* pool_; - internal::once_flag* dependencies_once_; + internal::LazyInitData* dependencies_once_; static void DependenciesOnceInit(const FileDescriptor* to_init); void InternalDependenciesOnceInit() const; @@ -1565,17 +1626,18 @@ class PROTOBUF_EXPORT FileDescriptor { int message_type_count_; int enum_type_count_; int service_count_; - int extension_count_; - Syntax syntax_; - bool is_placeholder_; + bool is_placeholder_; // Indicates the FileDescriptor is completed building. Used to verify // that type accessor functions that can possibly build a dependent file // aren't called during the process of building the file. bool finished_building_; + // Actually a `Syntax` but stored as uint8_t to save space. + uint8_t syntax_; + // This one is here to fill the padding. + int extension_count_; mutable const FileDescriptor** dependencies_; - const TProtoStringType** dependencies_names_; int* public_dependencies_; int* weak_dependencies_; Descriptor* message_types_; @@ -1988,6 +2050,11 @@ class PROTOBUF_EXPORT DescriptorPool { #define PROTOBUF_DEFINE_STRING_ACCESSOR(CLASS, FIELD) \ inline const TProtoStringType& CLASS::FIELD() const { return *FIELD##_; } +// Name and full name are stored in a single array to save space. +#define PROTOBUF_DEFINE_NAME_ACCESSOR(CLASS) \ + inline const TProtoStringType& CLASS::name() const { return all_names_[0]; } \ + inline const TProtoStringType& CLASS::full_name() const { return all_names_[1]; } + // Arrays take an index parameter, obviously. #define PROTOBUF_DEFINE_ARRAY_ACCESSOR(CLASS, FIELD, TYPE) \ inline TYPE CLASS::FIELD(int index) const { return FIELD##s_ + index; } @@ -1995,8 +2062,7 @@ class PROTOBUF_EXPORT DescriptorPool { #define PROTOBUF_DEFINE_OPTIONS_ACCESSOR(CLASS, TYPE) \ inline const TYPE& CLASS::options() const { return *options_; } -PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(Descriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(Descriptor) PROTOBUF_DEFINE_ACCESSOR(Descriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(Descriptor, containing_type, const Descriptor*) @@ -2025,40 +2091,30 @@ PROTOBUF_DEFINE_ACCESSOR(Descriptor, reserved_name_count, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(Descriptor, MessageOptions) PROTOBUF_DEFINE_ACCESSOR(Descriptor, is_placeholder, bool) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, full_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, json_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, lowercase_name) -PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, camelcase_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(FieldDescriptor) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, label, FieldDescriptor::Label) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_oneof, - const OneofDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, extension_scope, const Descriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32, int32) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64, int64) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32, uint32) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64, uint64) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int32_t, int32_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_int64_t, int64_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint32_t, uint32_t) +PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_uint64_t, uint64_t) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_float, float) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_double, double) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, default_value_bool, bool) PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) -PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(OneofDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(OneofDescriptor) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(EnumDescriptor) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, value_count, int) @@ -2071,22 +2127,19 @@ PROTOBUF_DEFINE_ARRAY_ACCESSOR(EnumDescriptor, reserved_range, const EnumDescriptor::ReservedRange*) PROTOBUF_DEFINE_ACCESSOR(EnumDescriptor, reserved_name_count, int) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(EnumValueDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(EnumValueDescriptor) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(EnumValueDescriptor, type, const EnumDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(EnumValueDescriptor, EnumValueOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(ServiceDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(ServiceDescriptor) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(ServiceDescriptor, method_count, int) PROTOBUF_DEFINE_ARRAY_ACCESSOR(ServiceDescriptor, method, const MethodDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(ServiceDescriptor, ServiceOptions) -PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, name) -PROTOBUF_DEFINE_STRING_ACCESSOR(MethodDescriptor, full_name) +PROTOBUF_DEFINE_NAME_ACCESSOR(MethodDescriptor) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, service, const ServiceDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(MethodDescriptor, MethodOptions) PROTOBUF_DEFINE_ACCESSOR(MethodDescriptor, client_streaming, bool) @@ -2164,11 +2217,36 @@ inline const TProtoStringType& EnumDescriptor::reserved_name(int index) const { return *reserved_names_[index]; } +inline const TProtoStringType& FieldDescriptor::lowercase_name() const { + return all_names_[lowercase_name_index_]; +} + +inline const TProtoStringType& FieldDescriptor::camelcase_name() const { + return all_names_[camelcase_name_index_]; +} + +inline const TProtoStringType& FieldDescriptor::json_name() const { + return all_names_[json_name_index_]; +} + +inline const OneofDescriptor* FieldDescriptor::containing_oneof() const { + return is_oneof_ ? scope_.containing_oneof : nullptr; +} + +inline const Descriptor* FieldDescriptor::extension_scope() const { + GOOGLE_CHECK(is_extension_); + return scope_.extension_scope; +} + +inline FieldDescriptor::Label FieldDescriptor::label() const { + return static_cast<Label>(label_); +} + inline FieldDescriptor::Type FieldDescriptor::type() const { if (type_once_) { - internal::call_once(*type_once_, &FieldDescriptor::TypeOnceInit, this); + internal::call_once(type_once_->once, &FieldDescriptor::TypeOnceInit, this); } - return type_; + return static_cast<Type>(type_); } inline bool FieldDescriptor::is_required() const { @@ -2198,9 +2276,8 @@ inline bool FieldDescriptor::has_optional_keyword() const { } inline const OneofDescriptor* FieldDescriptor::real_containing_oneof() const { - return containing_oneof_ && !containing_oneof_->is_synthetic() - ? containing_oneof_ - : nullptr; + auto* oneof = containing_oneof(); + return oneof && !oneof->is_synthetic() ? oneof : nullptr; } inline bool FieldDescriptor::has_presence() const { @@ -2214,8 +2291,8 @@ inline bool FieldDescriptor::has_presence() const { inline int FieldDescriptor::index() const { if (!is_extension_) { return static_cast<int>(this - containing_type()->fields_); - } else if (extension_scope_ != nullptr) { - return static_cast<int>(this - extension_scope_->extensions_); + } else if (extension_scope() != nullptr) { + return static_cast<int>(this - extension_scope()->extensions_); } else { return static_cast<int>(this - file_->extensions_); } @@ -2309,7 +2386,9 @@ inline const FileDescriptor* FileDescriptor::weak_dependency(int index) const { return dependency(weak_dependencies_[index]); } -inline FileDescriptor::Syntax FileDescriptor::syntax() const { return syntax_; } +inline FileDescriptor::Syntax FileDescriptor::syntax() const { + return static_cast<Syntax>(syntax_); +} // Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array // of pointers rather than the usual array of objects. diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc index 2e91b7c1ab..ef67494573 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc @@ -455,28 +455,30 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorSet, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorSet, file_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _internal_metadata_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet, file_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, package_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, dependency_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, public_dependency_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, weak_dependency_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, message_type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, enum_type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, service_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, extension_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, source_code_info_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileDescriptorProto, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, package_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, dependency_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, public_dependency_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, weak_dependency_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, message_type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, enum_type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, service_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, extension_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, source_code_info_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto, syntax_), 0, 1, ~0u, @@ -489,41 +491,44 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor 3, 4, 2, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, start_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, end_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, options_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, start_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, end_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange, options_), 1, 2, 0, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, start_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, end_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, start_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange, end_), 0, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, field_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, extension_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, nested_type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, enum_type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, extension_range_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, oneof_decl_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, reserved_range_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DescriptorProto, reserved_name_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, field_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, extension_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, nested_type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, enum_type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, extension_range_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, oneof_decl_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, reserved_range_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DescriptorProto, reserved_name_), 0, ~0u, ~0u, @@ -535,27 +540,29 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor ~0u, ~0u, ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, uninterpreted_option_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _internal_metadata_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions, uninterpreted_option_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, number_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, label_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, type_name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, extendee_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, default_value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, oneof_index_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, json_name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, proto3_optional_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, number_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, label_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, type_name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, extendee_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, default_value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, oneof_index_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, json_name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto, proto3_optional_), 0, 6, 9, @@ -567,104 +574,111 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor 4, 5, 8, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, options_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto, options_), 0, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, start_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, end_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, start_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange, end_), 0, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, reserved_range_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, reserved_name_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, reserved_range_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto, reserved_name_), 0, ~0u, 1, ~0u, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, number_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, options_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, number_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto, options_), 0, 2, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, method_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, options_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, method_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto, options_), 0, ~0u, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, input_type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, output_type_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, client_streaming_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, server_streaming_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, input_type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, output_type_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, client_streaming_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto, server_streaming_), 0, 1, 2, 3, 4, 5, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, java_package_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, java_outer_classname_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, java_multiple_files_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, java_generate_equals_and_hash_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, java_string_check_utf8_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, optimize_for_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, go_package_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, cc_generic_services_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, java_generic_services_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, py_generic_services_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, php_generic_services_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, cc_enable_arenas_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, objc_class_prefix_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, csharp_namespace_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, swift_prefix_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, php_class_prefix_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, php_namespace_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, php_metadata_namespace_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, ruby_package_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FileOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, java_package_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, java_outer_classname_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, java_multiple_files_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, java_generate_equals_and_hash_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, java_string_check_utf8_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, optimize_for_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, go_package_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, cc_generic_services_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, java_generic_services_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, py_generic_services_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, php_generic_services_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, cc_enable_arenas_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, objc_class_prefix_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, csharp_namespace_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, swift_prefix_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, php_class_prefix_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, php_namespace_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, php_metadata_namespace_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, ruby_package_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileOptions, uninterpreted_option_), 0, 1, 10, @@ -686,33 +700,35 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor 8, 9, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, message_set_wire_format_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, no_standard_descriptor_accessor_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, map_entry_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MessageOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, message_set_wire_format_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, no_standard_descriptor_accessor_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, map_entry_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MessageOptions, uninterpreted_option_), 0, 1, 2, 3, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, ctype_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, packed_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, jstype_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, lazy_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, weak_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, ctype_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, packed_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, jstype_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, lazy_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, weak_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldOptions, uninterpreted_option_), 0, 1, 5, @@ -721,72 +737,79 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor 4, ~0u, ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::OneofOptions, uninterpreted_option_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumOptions, _extensions_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::OneofOptions, uninterpreted_option_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumOptions, allow_alias_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, allow_alias_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumOptions, uninterpreted_option_), 0, 1, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValueOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValueOptions, uninterpreted_option_), 0, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ServiceOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ServiceOptions, uninterpreted_option_), 0, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodOptions, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodOptions, _internal_metadata_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodOptions, _extensions_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodOptions, deprecated_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodOptions, idempotency_level_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::MethodOptions, uninterpreted_option_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, deprecated_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, idempotency_level_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::MethodOptions, uninterpreted_option_), 0, 1, ~0u, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, name_part_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, is_extension_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, name_part_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart, is_extension_), 0, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, identifier_value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, positive_int_value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, negative_int_value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, double_value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, string_value_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UninterpretedOption, aggregate_value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, identifier_value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, positive_int_value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, negative_int_value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, double_value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, string_value_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UninterpretedOption, aggregate_value_), ~0u, 0, 3, @@ -794,105 +817,109 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor 5, 1, 2, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, path_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, span_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, leading_comments_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, trailing_comments_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, leading_detached_comments_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, path_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, span_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, leading_comments_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, trailing_comments_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location, leading_detached_comments_), ~0u, ~0u, 0, 1, ~0u, ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceCodeInfo, location_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _internal_metadata_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo, location_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, path_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, source_file_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, begin_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, end_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, path_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, source_file_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, begin_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation, end_), ~0u, 0, 1, 2, ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo, annotation_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo, annotation_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::FileDescriptorSet)}, - { 6, 23, sizeof(PROTOBUF_NAMESPACE_ID::FileDescriptorProto)}, - { 35, 43, sizeof(PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange)}, - { 46, 53, sizeof(PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange)}, - { 55, 70, sizeof(PROTOBUF_NAMESPACE_ID::DescriptorProto)}, - { 80, -1, sizeof(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions)}, - { 86, 102, sizeof(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto)}, - { 113, 120, sizeof(PROTOBUF_NAMESPACE_ID::OneofDescriptorProto)}, - { 122, 129, sizeof(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange)}, - { 131, 141, sizeof(PROTOBUF_NAMESPACE_ID::EnumDescriptorProto)}, - { 146, 154, sizeof(PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto)}, - { 157, 165, sizeof(PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto)}, - { 168, 179, sizeof(PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)}, - { 185, 211, sizeof(PROTOBUF_NAMESPACE_ID::FileOptions)}, - { 232, 242, sizeof(PROTOBUF_NAMESPACE_ID::MessageOptions)}, - { 247, 259, sizeof(PROTOBUF_NAMESPACE_ID::FieldOptions)}, - { 266, -1, sizeof(PROTOBUF_NAMESPACE_ID::OneofOptions)}, - { 272, 280, sizeof(PROTOBUF_NAMESPACE_ID::EnumOptions)}, - { 283, 290, sizeof(PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, - { 292, 299, sizeof(PROTOBUF_NAMESPACE_ID::ServiceOptions)}, - { 301, 309, sizeof(PROTOBUF_NAMESPACE_ID::MethodOptions)}, - { 312, 319, sizeof(PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, - { 321, 333, sizeof(PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, - { 340, 350, sizeof(PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, - { 355, -1, sizeof(PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, - { 361, 370, sizeof(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, - { 374, -1, sizeof(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet)}, + { 7, 25, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileDescriptorProto)}, + { 37, 46, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange)}, + { 49, 57, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange)}, + { 59, 75, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DescriptorProto)}, + { 85, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions)}, + { 92, 109, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto)}, + { 120, 128, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto)}, + { 130, 138, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange)}, + { 140, 151, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto)}, + { 156, 165, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto)}, + { 168, 177, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto)}, + { 180, 192, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto)}, + { 198, 225, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FileOptions)}, + { 246, 257, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MessageOptions)}, + { 262, 275, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldOptions)}, + { 282, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::OneofOptions)}, + { 289, 298, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumOptions)}, + { 301, 309, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValueOptions)}, + { 311, 319, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ServiceOptions)}, + { 321, 330, -1, sizeof(::PROTOBUF_NAMESPACE_ID::MethodOptions)}, + { 333, 341, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart)}, + { 343, 356, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UninterpretedOption)}, + { 363, 374, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location)}, + { 379, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo)}, + { 386, 396, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation)}, + { 400, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FileDescriptorSet_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FileDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_DescriptorProto_ExtensionRange_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_DescriptorProto_ReservedRange_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_DescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_ExtensionRangeOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FieldDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_OneofDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_EnumDescriptorProto_EnumReservedRange_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_EnumDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_EnumValueDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_ServiceDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_MethodDescriptorProto_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FileOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_MessageOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FieldOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_OneofOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_EnumOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_EnumValueOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_ServiceOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_MethodOptions_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_UninterpretedOption_NamePart_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_UninterpretedOption_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_Location_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_Annotation_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FileDescriptorSet_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FileDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_DescriptorProto_ExtensionRange_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_DescriptorProto_ReservedRange_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_DescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_ExtensionRangeOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FieldDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_OneofDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_EnumDescriptorProto_EnumReservedRange_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_EnumDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_EnumValueDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_ServiceDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_MethodDescriptorProto_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FileOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_MessageOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FieldOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_OneofOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_EnumOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_EnumValueOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_ServiceOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_MethodOptions_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_UninterpretedOption_NamePart_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_UninterpretedOption_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_Location_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_Annotation_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -1305,28 +1332,29 @@ const char* FileDescriptorSet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1367,13 +1395,7 @@ size_t FileDescriptorSet::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FileDescriptorSet::_class_data_ = { @@ -1382,8 +1404,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FileDescriptorSet::_class_data }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FileDescriptorSet::GetClassData() const { return &_class_data_; } -void FileDescriptorSet::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FileDescriptorSet::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FileDescriptorSet *>(to)->MergeFrom( static_cast<const FileDescriptorSet &>(from)); } @@ -1434,11 +1456,11 @@ class FileDescriptorProto::_Internal { static void set_has_package(HasBits* has_bits) { (*has_bits)[0] |= 2u; } - static const PROTOBUF_NAMESPACE_ID::FileOptions& options(const FileDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::FileOptions& options(const FileDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 8u; } - static const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info(const FileDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info(const FileDescriptorProto* msg); static void set_has_source_code_info(HasBits* has_bits) { (*has_bits)[0] |= 16u; } @@ -1447,11 +1469,11 @@ class FileDescriptorProto::_Internal { } }; -const PROTOBUF_NAMESPACE_ID::FileOptions& +const ::PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::_Internal::options(const FileDescriptorProto* msg) { return *msg->options_; } -const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& +const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::_Internal::source_code_info(const FileDescriptorProto* msg) { return *msg->source_code_info_; } @@ -1498,12 +1520,12 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::FileOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::FileOptions(*from.options_); } else { options_ = nullptr; } if (from._internal_has_source_code_info()) { - source_code_info_ = new PROTOBUF_NAMESPACE_ID::SourceCodeInfo(*from.source_code_info_); + source_code_info_ = new ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo(*from.source_code_info_); } else { source_code_info_ = nullptr; } @@ -1599,7 +1621,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string package = 2; case 2: @@ -1610,7 +1633,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileDescriptorProto.package"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated string dependency = 3; case 3: @@ -1626,7 +1650,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.DescriptorProto message_type = 4; case 4: @@ -1638,7 +1663,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; case 5: @@ -1650,7 +1676,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.ServiceDescriptorProto service = 6; case 6: @@ -1662,7 +1689,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.FieldDescriptorProto extension = 7; case 7: @@ -1674,21 +1702,24 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<58>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.FileOptions options = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.SourceCodeInfo source_code_info = 9; case 9: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { ptr = ctx->ParseMessage(_internal_mutable_source_code_info(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated int32 public_dependency = 10; case 10: @@ -1703,7 +1734,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_public_dependency(), ptr, ctx); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated int32 weak_dependency = 11; case 11: @@ -1718,7 +1750,8 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_weak_dependency(), ptr, ctx); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string syntax = 12; case 12: @@ -1729,29 +1762,30 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileDescriptorProto.syntax"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1970,13 +2004,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FileDescriptorProto::_class_data_ = { @@ -1985,8 +2013,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FileDescriptorProto::_class_da }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FileDescriptorProto::GetClassData() const { return &_class_data_; } -void FileDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FileDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FileDescriptorProto *>(to)->MergeFrom( static_cast<const FileDescriptorProto &>(from)); } @@ -2017,10 +2045,10 @@ void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) { _internal_set_syntax(from._internal_syntax()); } if (cached_has_bits & 0x00000008u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::FileOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::FileOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000010u) { - _internal_mutable_source_code_info()->PROTOBUF_NAMESPACE_ID::SourceCodeInfo::MergeFrom(from._internal_source_code_info()); + _internal_mutable_source_code_info()->::PROTOBUF_NAMESPACE_ID::SourceCodeInfo::MergeFrom(from._internal_source_code_info()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -2046,6 +2074,8 @@ bool FileDescriptorProto::IsInitialized() const { void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); dependency_.InternalSwap(&other->dependency_); @@ -2057,18 +2087,18 @@ void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) { weak_dependency_.InternalSwap(&other->weak_dependency_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &package_, GetArenaForAllocation(), - &other->package_, other->GetArenaForAllocation() + &package_, lhs_arena, + &other->package_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &syntax_, GetArenaForAllocation(), - &other->syntax_, other->GetArenaForAllocation() + &syntax_, lhs_arena, + &other->syntax_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(FileDescriptorProto, source_code_info_) @@ -2095,13 +2125,13 @@ class DescriptorProto_ExtensionRange::_Internal { static void set_has_end(HasBits* has_bits) { (*has_bits)[0] |= 4u; } - static const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options(const DescriptorProto_ExtensionRange* msg); + static const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options(const DescriptorProto_ExtensionRange* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; -const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& +const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::_Internal::options(const DescriptorProto_ExtensionRange* msg) { return *msg->options_; } @@ -2119,7 +2149,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions(*from.options_); } else { options_ = nullptr; } @@ -2191,7 +2221,8 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR _Internal::set_has_start(&has_bits); start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 end = 2; case 2: @@ -2199,36 +2230,38 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR _Internal::set_has_end(&has_bits); end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.ExtensionRangeOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -2286,26 +2319,16 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const { // optional int32 start = 1; if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_start()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_start()); } // optional int32 end = 2; if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_end()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_end()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DescriptorProto_ExtensionRange::_class_data_ = { @@ -2314,8 +2337,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DescriptorProto_ExtensionRange }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DescriptorProto_ExtensionRange::GetClassData() const { return &_class_data_; } -void DescriptorProto_ExtensionRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void DescriptorProto_ExtensionRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<DescriptorProto_ExtensionRange *>(to)->MergeFrom( static_cast<const DescriptorProto_ExtensionRange &>(from)); } @@ -2330,7 +2353,7 @@ void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRa cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000002u) { start_ = from.start_; @@ -2464,7 +2487,8 @@ const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PRO _Internal::set_has_start(&has_bits); start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 end = 2; case 2: @@ -2472,29 +2496,30 @@ const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PRO _Internal::set_has_end(&has_bits); end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -2537,26 +2562,16 @@ size_t DescriptorProto_ReservedRange::ByteSizeLong() const { if (cached_has_bits & 0x00000003u) { // optional int32 start = 1; if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_start()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_start()); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_end()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_end()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DescriptorProto_ReservedRange::_class_data_ = { @@ -2565,8 +2580,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DescriptorProto_ReservedRange: }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DescriptorProto_ReservedRange::GetClassData() const { return &_class_data_; } -void DescriptorProto_ReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void DescriptorProto_ReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<DescriptorProto_ReservedRange *>(to)->MergeFrom( static_cast<const DescriptorProto_ReservedRange &>(from)); } @@ -2628,13 +2643,13 @@ class DescriptorProto::_Internal { static void set_has_name(HasBits* has_bits) { (*has_bits)[0] |= 1u; } - static const PROTOBUF_NAMESPACE_ID::MessageOptions& options(const DescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::MessageOptions& options(const DescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 2u; } }; -const PROTOBUF_NAMESPACE_ID::MessageOptions& +const ::PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::_Internal::options(const DescriptorProto* msg) { return *msg->options_; } @@ -2673,7 +2688,7 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from) GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::MessageOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::MessageOptions(*from.options_); } else { options_ = nullptr; } @@ -2752,7 +2767,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.DescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.FieldDescriptorProto field = 2; case 2: @@ -2764,7 +2780,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.DescriptorProto nested_type = 3; case 3: @@ -2776,7 +2793,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; case 4: @@ -2788,7 +2806,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; case 5: @@ -2800,7 +2819,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.FieldDescriptorProto extension = 6; case 6: @@ -2812,14 +2832,16 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.MessageOptions options = 7; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; case 8: @@ -2831,7 +2853,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<66>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; case 9: @@ -2843,7 +2866,8 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated string reserved_name = 10; case 10: @@ -2859,29 +2883,30 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<82>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -3066,13 +3091,7 @@ size_t DescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DescriptorProto::_class_data_ = { @@ -3081,8 +3100,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DescriptorProto::_class_data_ }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DescriptorProto::GetClassData() const { return &_class_data_; } -void DescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void DescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<DescriptorProto *>(to)->MergeFrom( static_cast<const DescriptorProto &>(from)); } @@ -3108,7 +3127,7 @@ void DescriptorProto::MergeFrom(const DescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::MessageOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::MessageOptions::MergeFrom(from._internal_options()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -3136,6 +3155,8 @@ bool DescriptorProto::IsInitialized() const { void DescriptorProto::InternalSwap(DescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); field_.InternalSwap(&other->field_); @@ -3148,8 +3169,8 @@ void DescriptorProto::InternalSwap(DescriptorProto* other) { reserved_name_.InternalSwap(&other->reserved_name_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); swap(options_, other->options_); } @@ -3236,34 +3257,34 @@ const char* ExtensionRangeOptions::_InternalParse(const char* ptr, ::PROTOBUF_NA CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -3283,7 +3304,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -3310,13 +3331,7 @@ size_t ExtensionRangeOptions::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ExtensionRangeOptions::_class_data_ = { @@ -3325,8 +3340,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ExtensionRangeOptions::_class_ }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ExtensionRangeOptions::GetClassData() const { return &_class_data_; } -void ExtensionRangeOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void ExtensionRangeOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<ExtensionRangeOptions *>(to)->MergeFrom( static_cast<const ExtensionRangeOptions &>(from)); } @@ -3404,7 +3419,7 @@ class FieldDescriptorProto::_Internal { static void set_has_json_name(HasBits* has_bits) { (*has_bits)[0] |= 16u; } - static const PROTOBUF_NAMESPACE_ID::FieldOptions& options(const FieldDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::FieldOptions& options(const FieldDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 32u; } @@ -3413,7 +3428,7 @@ class FieldDescriptorProto::_Internal { } }; -const PROTOBUF_NAMESPACE_ID::FieldOptions& +const ::PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::_Internal::options(const FieldDescriptorProto* msg) { return *msg->options_; } @@ -3456,7 +3471,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::FieldOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::FieldOptions(*from.options_); } else { options_ = nullptr; } @@ -3565,7 +3580,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FieldDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string extendee = 2; case 2: @@ -3576,7 +3592,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FieldDescriptorProto.extendee"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 number = 3; case 3: @@ -3584,31 +3601,34 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM _Internal::set_has_number(&has_bits); number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.FieldDescriptorProto.Label label = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(val))) { - _internal_set_label(static_cast<PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label>(val)); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(val))) { + _internal_set_label(static_cast<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); } - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.FieldDescriptorProto.Type type = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(val))) { - _internal_set_type(static_cast<PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type>(val)); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(val))) { + _internal_set_type(static_cast<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(5, val, mutable_unknown_fields()); } - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string type_name = 6; case 6: @@ -3619,7 +3639,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FieldDescriptorProto.type_name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string default_value = 7; case 7: @@ -3630,14 +3651,16 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FieldDescriptorProto.default_value"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.FieldOptions options = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 oneof_index = 9; case 9: @@ -3645,7 +3668,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM _Internal::set_has_oneof_index(&has_bits); oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string json_name = 10; case 10: @@ -3656,7 +3680,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FieldDescriptorProto.json_name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool proto3_optional = 17; case 17: @@ -3664,29 +3689,30 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM _Internal::set_has_proto3_optional(&has_bits); proto3_optional_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -3849,16 +3875,12 @@ size_t FieldDescriptorProto::ByteSizeLong() const { // optional int32 number = 3; if (cached_has_bits & 0x00000040u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_number()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number()); } // optional int32 oneof_index = 9; if (cached_has_bits & 0x00000080u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_oneof_index()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_oneof_index()); } } @@ -3881,13 +3903,7 @@ size_t FieldDescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldDescriptorProto::_class_data_ = { @@ -3896,8 +3912,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldDescriptorProto::_class_d }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FieldDescriptorProto::GetClassData() const { return &_class_data_; } -void FieldDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FieldDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FieldDescriptorProto *>(to)->MergeFrom( static_cast<const FieldDescriptorProto &>(from)); } @@ -3927,7 +3943,7 @@ void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) { _internal_set_json_name(from._internal_json_name()); } if (cached_has_bits & 0x00000020u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::FieldOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::FieldOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000040u) { number_ = from.number_; @@ -3968,32 +3984,34 @@ bool FieldDescriptorProto::IsInitialized() const { void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &extendee_, GetArenaForAllocation(), - &other->extendee_, other->GetArenaForAllocation() + &extendee_, lhs_arena, + &other->extendee_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &type_name_, GetArenaForAllocation(), - &other->type_name_, other->GetArenaForAllocation() + &type_name_, lhs_arena, + &other->type_name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &default_value_, GetArenaForAllocation(), - &other->default_value_, other->GetArenaForAllocation() + &default_value_, lhs_arena, + &other->default_value_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &json_name_, GetArenaForAllocation(), - &other->json_name_, other->GetArenaForAllocation() + &json_name_, lhs_arena, + &other->json_name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, proto3_optional_) @@ -4019,13 +4037,13 @@ class OneofDescriptorProto::_Internal { static void set_has_name(HasBits* has_bits) { (*has_bits)[0] |= 1u; } - static const PROTOBUF_NAMESPACE_ID::OneofOptions& options(const OneofDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::OneofOptions& options(const OneofDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 2u; } }; -const PROTOBUF_NAMESPACE_ID::OneofOptions& +const ::PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::_Internal::options(const OneofDescriptorProto* msg) { return *msg->options_; } @@ -4048,7 +4066,7 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::OneofOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::OneofOptions(*from.options_); } else { options_ = nullptr; } @@ -4119,36 +4137,38 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.OneofDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.OneofOptions options = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -4210,13 +4230,7 @@ size_t OneofDescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData OneofDescriptorProto::_class_data_ = { @@ -4225,8 +4239,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData OneofDescriptorProto::_class_d }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*OneofDescriptorProto::GetClassData() const { return &_class_data_; } -void OneofDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void OneofDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<OneofDescriptorProto *>(to)->MergeFrom( static_cast<const OneofDescriptorProto &>(from)); } @@ -4244,7 +4258,7 @@ void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::OneofOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::OneofOptions::MergeFrom(from._internal_options()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -4266,12 +4280,14 @@ bool OneofDescriptorProto::IsInitialized() const { void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); swap(options_, other->options_); } @@ -4371,7 +4387,8 @@ const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* pt _Internal::set_has_start(&has_bits); start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 end = 2; case 2: @@ -4379,29 +4396,30 @@ const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* pt _Internal::set_has_end(&has_bits); end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -4444,26 +4462,16 @@ size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const { if (cached_has_bits & 0x00000003u) { // optional int32 start = 1; if (cached_has_bits & 0x00000001u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_start()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_start()); } // optional int32 end = 2; if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_end()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_end()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumDescriptorProto_EnumReservedRange::_class_data_ = { @@ -4472,8 +4480,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumDescriptorProto_EnumReserv }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumDescriptorProto_EnumReservedRange::GetClassData() const { return &_class_data_; } -void EnumDescriptorProto_EnumReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void EnumDescriptorProto_EnumReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<EnumDescriptorProto_EnumReservedRange *>(to)->MergeFrom( static_cast<const EnumDescriptorProto_EnumReservedRange &>(from)); } @@ -4535,13 +4543,13 @@ class EnumDescriptorProto::_Internal { static void set_has_name(HasBits* has_bits) { (*has_bits)[0] |= 1u; } - static const PROTOBUF_NAMESPACE_ID::EnumOptions& options(const EnumDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::EnumOptions& options(const EnumDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 2u; } }; -const PROTOBUF_NAMESPACE_ID::EnumOptions& +const ::PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::_Internal::options(const EnumDescriptorProto* msg) { return *msg->options_; } @@ -4570,7 +4578,7 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::EnumOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::EnumOptions(*from.options_); } else { options_ = nullptr; } @@ -4644,7 +4652,8 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.EnumDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.EnumValueDescriptorProto value = 2; case 2: @@ -4656,14 +4665,16 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.EnumOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; case 4: @@ -4675,7 +4686,8 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated string reserved_name = 5; case 5: @@ -4691,29 +4703,30 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -4823,13 +4836,7 @@ size_t EnumDescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumDescriptorProto::_class_data_ = { @@ -4838,8 +4845,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumDescriptorProto::_class_da }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumDescriptorProto::GetClassData() const { return &_class_data_; } -void EnumDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void EnumDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<EnumDescriptorProto *>(to)->MergeFrom( static_cast<const EnumDescriptorProto &>(from)); } @@ -4860,7 +4867,7 @@ void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::EnumOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::EnumOptions::MergeFrom(from._internal_options()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -4883,6 +4890,8 @@ bool EnumDescriptorProto::IsInitialized() const { void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); value_.InternalSwap(&other->value_); @@ -4890,8 +4899,8 @@ void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) { reserved_name_.InternalSwap(&other->reserved_name_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); swap(options_, other->options_); } @@ -4913,13 +4922,13 @@ class EnumValueDescriptorProto::_Internal { static void set_has_number(HasBits* has_bits) { (*has_bits)[0] |= 4u; } - static const PROTOBUF_NAMESPACE_ID::EnumValueOptions& options(const EnumValueDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& options(const EnumValueDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 2u; } }; -const PROTOBUF_NAMESPACE_ID::EnumValueOptions& +const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::_Internal::options(const EnumValueDescriptorProto* msg) { return *msg->options_; } @@ -4942,7 +4951,7 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::EnumValueOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::EnumValueOptions(*from.options_); } else { options_ = nullptr; } @@ -5018,7 +5027,8 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.EnumValueDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 number = 2; case 2: @@ -5026,36 +5036,38 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF _Internal::set_has_number(&has_bits); number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.EnumValueOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -5124,19 +5136,11 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const { // optional int32 number = 2; if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_number()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValueDescriptorProto::_class_data_ = { @@ -5145,8 +5149,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValueDescriptorProto::_cla }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumValueDescriptorProto::GetClassData() const { return &_class_data_; } -void EnumValueDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void EnumValueDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<EnumValueDescriptorProto *>(to)->MergeFrom( static_cast<const EnumValueDescriptorProto &>(from)); } @@ -5164,7 +5168,7 @@ void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::EnumValueOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::EnumValueOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000004u) { number_ = from.number_; @@ -5190,12 +5194,14 @@ bool EnumValueDescriptorProto::IsInitialized() const { void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, number_) @@ -5219,13 +5225,13 @@ class ServiceDescriptorProto::_Internal { static void set_has_name(HasBits* has_bits) { (*has_bits)[0] |= 1u; } - static const PROTOBUF_NAMESPACE_ID::ServiceOptions& options(const ServiceDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& options(const ServiceDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 2u; } }; -const PROTOBUF_NAMESPACE_ID::ServiceOptions& +const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::_Internal::options(const ServiceDescriptorProto* msg) { return *msg->options_; } @@ -5250,7 +5256,7 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::ServiceOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::ServiceOptions(*from.options_); } else { options_ = nullptr; } @@ -5322,7 +5328,8 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.ServiceDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.MethodDescriptorProto method = 2; case 2: @@ -5334,36 +5341,38 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.ServiceOptions options = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -5440,13 +5449,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ServiceDescriptorProto::_class_data_ = { @@ -5455,8 +5458,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ServiceDescriptorProto::_class }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ServiceDescriptorProto::GetClassData() const { return &_class_data_; } -void ServiceDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void ServiceDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<ServiceDescriptorProto *>(to)->MergeFrom( static_cast<const ServiceDescriptorProto &>(from)); } @@ -5475,7 +5478,7 @@ void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) { _internal_set_name(from._internal_name()); } if (cached_has_bits & 0x00000002u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::ServiceOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::ServiceOptions::MergeFrom(from._internal_options()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -5498,13 +5501,15 @@ bool ServiceDescriptorProto::IsInitialized() const { void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); method_.InternalSwap(&other->method_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); swap(options_, other->options_); } @@ -5529,7 +5534,7 @@ class MethodDescriptorProto::_Internal { static void set_has_output_type(HasBits* has_bits) { (*has_bits)[0] |= 4u; } - static const PROTOBUF_NAMESPACE_ID::MethodOptions& options(const MethodDescriptorProto* msg); + static const ::PROTOBUF_NAMESPACE_ID::MethodOptions& options(const MethodDescriptorProto* msg); static void set_has_options(HasBits* has_bits) { (*has_bits)[0] |= 8u; } @@ -5541,7 +5546,7 @@ class MethodDescriptorProto::_Internal { } }; -const PROTOBUF_NAMESPACE_ID::MethodOptions& +const ::PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::_Internal::options(const MethodDescriptorProto* msg) { return *msg->options_; } @@ -5574,7 +5579,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) GetArenaForAllocation()); } if (from._internal_has_options()) { - options_ = new PROTOBUF_NAMESPACE_ID::MethodOptions(*from.options_); + options_ = new ::PROTOBUF_NAMESPACE_ID::MethodOptions(*from.options_); } else { options_ = nullptr; } @@ -5664,7 +5669,8 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.MethodDescriptorProto.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string input_type = 2; case 2: @@ -5675,7 +5681,8 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.MethodDescriptorProto.input_type"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string output_type = 3; case 3: @@ -5686,14 +5693,16 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.MethodDescriptorProto.output_type"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.MethodOptions options = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool client_streaming = 5 [default = false]; case 5: @@ -5701,7 +5710,8 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA _Internal::set_has_client_streaming(&has_bits); client_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool server_streaming = 6 [default = false]; case 6: @@ -5709,29 +5719,30 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA _Internal::set_has_server_streaming(&has_bits); server_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -5849,13 +5860,7 @@ size_t MethodDescriptorProto::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MethodDescriptorProto::_class_data_ = { @@ -5864,8 +5869,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MethodDescriptorProto::_class_ }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MethodDescriptorProto::GetClassData() const { return &_class_data_; } -void MethodDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void MethodDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<MethodDescriptorProto *>(to)->MergeFrom( static_cast<const MethodDescriptorProto &>(from)); } @@ -5889,7 +5894,7 @@ void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) { _internal_set_output_type(from._internal_output_type()); } if (cached_has_bits & 0x00000008u) { - _internal_mutable_options()->PROTOBUF_NAMESPACE_ID::MethodOptions::MergeFrom(from._internal_options()); + _internal_mutable_options()->::PROTOBUF_NAMESPACE_ID::MethodOptions::MergeFrom(from._internal_options()); } if (cached_has_bits & 0x00000010u) { client_streaming_ = from.client_streaming_; @@ -5918,22 +5923,24 @@ bool MethodDescriptorProto::IsInitialized() const { void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &input_type_, GetArenaForAllocation(), - &other->input_type_, other->GetArenaForAllocation() + &input_type_, lhs_arena, + &other->input_type_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &output_type_, GetArenaForAllocation(), - &other->output_type_, other->GetArenaForAllocation() + &output_type_, lhs_arena, + &other->output_type_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, server_streaming_) @@ -6214,7 +6221,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.java_package"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string java_outer_classname = 8; case 8: @@ -6225,19 +6233,21 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.java_outer_classname"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED]; case 9: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(val))) { - _internal_set_optimize_for(static_cast<PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode>(val)); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(val))) { + _internal_set_optimize_for(static_cast<::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(9, val, mutable_unknown_fields()); } - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool java_multiple_files = 10 [default = false]; case 10: @@ -6245,7 +6255,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_java_multiple_files(&has_bits); java_multiple_files_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string go_package = 11; case 11: @@ -6256,7 +6267,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.go_package"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool cc_generic_services = 16 [default = false]; case 16: @@ -6264,7 +6276,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_cc_generic_services(&has_bits); cc_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool java_generic_services = 17 [default = false]; case 17: @@ -6272,7 +6285,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_java_generic_services(&has_bits); java_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool py_generic_services = 18 [default = false]; case 18: @@ -6280,7 +6294,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_py_generic_services(&has_bits); py_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; case 20: @@ -6288,7 +6303,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_java_generate_equals_and_hash(&has_bits); java_generate_equals_and_hash_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool deprecated = 23 [default = false]; case 23: @@ -6296,7 +6312,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool java_string_check_utf8 = 27 [default = false]; case 27: @@ -6304,7 +6321,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_java_string_check_utf8(&has_bits); java_string_check_utf8_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool cc_enable_arenas = 31 [default = true]; case 31: @@ -6312,7 +6330,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_cc_enable_arenas(&has_bits); cc_enable_arenas_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string objc_class_prefix = 36; case 36: @@ -6323,7 +6342,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.objc_class_prefix"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string csharp_namespace = 37; case 37: @@ -6334,7 +6354,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.csharp_namespace"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string swift_prefix = 39; case 39: @@ -6345,7 +6366,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.swift_prefix"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string php_class_prefix = 40; case 40: @@ -6356,7 +6378,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.php_class_prefix"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string php_namespace = 41; case 41: @@ -6367,7 +6390,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.php_namespace"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool php_generic_services = 42 [default = false]; case 42: @@ -6375,7 +6399,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_php_generic_services(&has_bits); php_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string php_metadata_namespace = 44; case 44: @@ -6386,7 +6411,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.php_metadata_namespace"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string ruby_package = 45; case 45: @@ -6397,7 +6423,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.FileOptions.ruby_package"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -6409,35 +6436,35 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); - continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -6619,7 +6646,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -6774,13 +6801,7 @@ size_t FileOptions::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FileOptions::_class_data_ = { @@ -6789,8 +6810,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FileOptions::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FileOptions::GetClassData() const { return &_class_data_; } -void FileOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FileOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FileOptions *>(to)->MergeFrom( static_cast<const FileOptions &>(from)); } @@ -6895,58 +6916,60 @@ bool FileOptions::IsInitialized() const { void FileOptions::InternalSwap(FileOptions* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); uninterpreted_option_.InternalSwap(&other->uninterpreted_option_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &java_package_, GetArenaForAllocation(), - &other->java_package_, other->GetArenaForAllocation() + &java_package_, lhs_arena, + &other->java_package_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &java_outer_classname_, GetArenaForAllocation(), - &other->java_outer_classname_, other->GetArenaForAllocation() + &java_outer_classname_, lhs_arena, + &other->java_outer_classname_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &go_package_, GetArenaForAllocation(), - &other->go_package_, other->GetArenaForAllocation() + &go_package_, lhs_arena, + &other->go_package_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &objc_class_prefix_, GetArenaForAllocation(), - &other->objc_class_prefix_, other->GetArenaForAllocation() + &objc_class_prefix_, lhs_arena, + &other->objc_class_prefix_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &csharp_namespace_, GetArenaForAllocation(), - &other->csharp_namespace_, other->GetArenaForAllocation() + &csharp_namespace_, lhs_arena, + &other->csharp_namespace_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &swift_prefix_, GetArenaForAllocation(), - &other->swift_prefix_, other->GetArenaForAllocation() + &swift_prefix_, lhs_arena, + &other->swift_prefix_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &php_class_prefix_, GetArenaForAllocation(), - &other->php_class_prefix_, other->GetArenaForAllocation() + &php_class_prefix_, lhs_arena, + &other->php_class_prefix_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &php_namespace_, GetArenaForAllocation(), - &other->php_namespace_, other->GetArenaForAllocation() + &php_namespace_, lhs_arena, + &other->php_namespace_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &php_metadata_namespace_, GetArenaForAllocation(), - &other->php_metadata_namespace_, other->GetArenaForAllocation() + &php_metadata_namespace_, lhs_arena, + &other->php_metadata_namespace_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &ruby_package_, GetArenaForAllocation(), - &other->ruby_package_, other->GetArenaForAllocation() + &ruby_package_, lhs_arena, + &other->ruby_package_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(FileOptions, deprecated_) @@ -7062,7 +7085,8 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE _Internal::set_has_message_set_wire_format(&has_bits); message_set_wire_format_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool no_standard_descriptor_accessor = 2 [default = false]; case 2: @@ -7070,7 +7094,8 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE _Internal::set_has_no_standard_descriptor_accessor(&has_bits); no_standard_descriptor_accessor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool deprecated = 3 [default = false]; case 3: @@ -7078,7 +7103,8 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool map_entry = 7; case 7: @@ -7086,7 +7112,8 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE _Internal::set_has_map_entry(&has_bits); map_entry_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -7098,35 +7125,35 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); - continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -7171,7 +7198,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -7221,13 +7248,7 @@ size_t MessageOptions::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MessageOptions::_class_data_ = { @@ -7236,8 +7257,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MessageOptions::_class_data_ = }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MessageOptions::GetClassData() const { return &_class_data_; } -void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<MessageOptions *>(to)->MergeFrom( static_cast<const MessageOptions &>(from)); } @@ -7412,12 +7433,13 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(val))) { - _internal_set_ctype(static_cast<PROTOBUF_NAMESPACE_ID::FieldOptions_CType>(val)); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(val))) { + _internal_set_ctype(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_CType>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); } - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool packed = 2; case 2: @@ -7425,7 +7447,8 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I _Internal::set_has_packed(&has_bits); packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool deprecated = 3 [default = false]; case 3: @@ -7433,7 +7456,8 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool lazy = 5 [default = false]; case 5: @@ -7441,19 +7465,21 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I _Internal::set_has_lazy(&has_bits); lazy_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL]; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(val))) { - _internal_set_jstype(static_cast<PROTOBUF_NAMESPACE_ID::FieldOptions_JSType>(val)); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(val))) { + _internal_set_jstype(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(6, val, mutable_unknown_fields()); } - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool weak = 10 [default = false]; case 10: @@ -7461,7 +7487,8 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I _Internal::set_has_weak(&has_bits); weak_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -7473,35 +7500,35 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -7560,7 +7587,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -7622,13 +7649,7 @@ size_t FieldOptions::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldOptions::_class_data_ = { @@ -7637,8 +7658,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldOptions::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FieldOptions::GetClassData() const { return &_class_data_; } -void FieldOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FieldOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FieldOptions *>(to)->MergeFrom( static_cast<const FieldOptions &>(from)); } @@ -7789,34 +7810,34 @@ const char* OneofOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); - continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -7836,7 +7857,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -7863,13 +7884,7 @@ size_t OneofOptions::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData OneofOptions::_class_data_ = { @@ -7878,8 +7893,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData OneofOptions::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*OneofOptions::GetClassData() const { return &_class_data_; } -void OneofOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void OneofOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<OneofOptions *>(to)->MergeFrom( static_cast<const OneofOptions &>(from)); } @@ -8017,7 +8032,8 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_allow_alias(&has_bits); allow_alias_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bool deprecated = 3 [default = false]; case 3: @@ -8025,7 +8041,8 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -8037,35 +8054,35 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); - continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -8098,7 +8115,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -8138,13 +8155,7 @@ size_t EnumOptions::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumOptions::_class_data_ = { @@ -8153,8 +8164,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumOptions::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumOptions::GetClassData() const { return &_class_data_; } -void EnumOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void EnumOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<EnumOptions *>(to)->MergeFrom( static_cast<const EnumOptions &>(from)); } @@ -8299,7 +8310,8 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -8311,35 +8323,35 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -8366,7 +8378,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -8399,13 +8411,7 @@ size_t EnumValueOptions::ByteSizeLong() const { total_size += 1 + 1; } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValueOptions::_class_data_ = { @@ -8414,8 +8420,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValueOptions::_class_data_ }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumValueOptions::GetClassData() const { return &_class_data_; } -void EnumValueOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void EnumValueOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<EnumValueOptions *>(to)->MergeFrom( static_cast<const EnumValueOptions &>(from)); } @@ -8548,7 +8554,8 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -8560,35 +8567,35 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); - continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -8615,7 +8622,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -8648,13 +8655,7 @@ size_t ServiceOptions::ByteSizeLong() const { total_size += 2 + 1; } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ServiceOptions::_class_data_ = { @@ -8663,8 +8664,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ServiceOptions::_class_data_ = }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ServiceOptions::GetClassData() const { return &_class_data_; } -void ServiceOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void ServiceOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<ServiceOptions *>(to)->MergeFrom( static_cast<const ServiceOptions &>(from)); } @@ -8810,19 +8811,21 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN]; case 34: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - if (PROTOBUF_PREDICT_TRUE(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(val))) { - _internal_set_idempotency_level(static_cast<PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel>(val)); + if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(val))) { + _internal_set_idempotency_level(static_cast<::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(34, val, mutable_unknown_fields()); } - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: @@ -8834,35 +8837,35 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - if ((8000u <= tag)) { - ptr = _extensions_.ParseField(tag, ptr, - internal_default_instance(), &_internal_metadata_, ctx); - CHK_(ptr != nullptr); - continue; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + if ((8000u <= tag)) { + ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); + CHK_(ptr != nullptr); + continue; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -8896,7 +8899,7 @@ failure: // Extension range [1000, 536870912) target = _extensions_._InternalSerialize( - 1000, 536870912, target, stream); + internal_default_instance(), 1000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( @@ -8937,13 +8940,7 @@ size_t MethodOptions::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MethodOptions::_class_data_ = { @@ -8952,8 +8949,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MethodOptions::_class_data_ = }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MethodOptions::GetClassData() const { return &_class_data_; } -void MethodOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void MethodOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<MethodOptions *>(to)->MergeFrom( static_cast<const MethodOptions &>(from)); } @@ -9112,7 +9109,8 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.UninterpretedOption.NamePart.name_part"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // required bool is_extension = 2; case 2: @@ -9120,29 +9118,30 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT _Internal::set_has_is_extension(&has_bits); is_extension_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -9215,13 +9214,7 @@ size_t UninterpretedOption_NamePart::ByteSizeLong() const { // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UninterpretedOption_NamePart::_class_data_ = { @@ -9230,8 +9223,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UninterpretedOption_NamePart:: }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UninterpretedOption_NamePart::GetClassData() const { return &_class_data_; } -void UninterpretedOption_NamePart::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void UninterpretedOption_NamePart::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<UninterpretedOption_NamePart *>(to)->MergeFrom( static_cast<const UninterpretedOption_NamePart &>(from)); } @@ -9270,12 +9263,14 @@ bool UninterpretedOption_NamePart::IsInitialized() const { void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_part_, GetArenaForAllocation(), - &other->name_part_, other->GetArenaForAllocation() + &name_part_, lhs_arena, + &other->name_part_, rhs_arena ); swap(is_extension_, other->is_extension_); } @@ -9426,7 +9421,8 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string identifier_value = 3; case 3: @@ -9437,7 +9433,8 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.UninterpretedOption.identifier_value"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional uint64 positive_int_value = 4; case 4: @@ -9445,7 +9442,8 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME _Internal::set_has_positive_int_value(&has_bits); positive_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int64 negative_int_value = 5; case 5: @@ -9453,7 +9451,8 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME _Internal::set_has_negative_int_value(&has_bits); negative_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional double double_value = 6; case 6: @@ -9461,7 +9460,8 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME _Internal::set_has_double_value(&has_bits); double_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional bytes string_value = 7; case 7: @@ -9469,7 +9469,8 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME auto str = _internal_mutable_string_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string aggregate_value = 8; case 8: @@ -9480,29 +9481,30 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.UninterpretedOption.aggregate_value"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -9613,16 +9615,12 @@ size_t UninterpretedOption::ByteSizeLong() const { // optional uint64 positive_int_value = 4; if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( - this->_internal_positive_int_value()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_positive_int_value()); } // optional int64 negative_int_value = 5; if (cached_has_bits & 0x00000010u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_negative_int_value()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_negative_int_value()); } // optional double double_value = 6; @@ -9631,13 +9629,7 @@ size_t UninterpretedOption::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UninterpretedOption::_class_data_ = { @@ -9646,8 +9638,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UninterpretedOption::_class_da }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UninterpretedOption::GetClassData() const { return &_class_data_; } -void UninterpretedOption::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void UninterpretedOption::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<UninterpretedOption *>(to)->MergeFrom( static_cast<const UninterpretedOption &>(from)); } @@ -9699,23 +9691,25 @@ bool UninterpretedOption::IsInitialized() const { void UninterpretedOption::InternalSwap(UninterpretedOption* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); name_.InternalSwap(&other->name_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &identifier_value_, GetArenaForAllocation(), - &other->identifier_value_, other->GetArenaForAllocation() + &identifier_value_, lhs_arena, + &other->identifier_value_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &string_value_, GetArenaForAllocation(), - &other->string_value_, other->GetArenaForAllocation() + &string_value_, lhs_arena, + &other->string_value_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &aggregate_value_, GetArenaForAllocation(), - &other->aggregate_value_, other->GetArenaForAllocation() + &aggregate_value_, lhs_arena, + &other->aggregate_value_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(UninterpretedOption, double_value_) @@ -9841,7 +9835,8 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated int32 span = 2 [packed = true]; case 2: @@ -9851,7 +9846,8 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { _internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string leading_comments = 3; case 3: @@ -9862,7 +9858,8 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceCodeInfo.Location.leading_comments"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string trailing_comments = 4; case 4: @@ -9873,7 +9870,8 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceCodeInfo.Location.trailing_comments"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated string leading_detached_comments = 6; case 6: @@ -9889,29 +9887,30 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -10041,13 +10040,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceCodeInfo_Location::_class_data_ = { @@ -10056,8 +10049,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceCodeInfo_Location::_clas }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SourceCodeInfo_Location::GetClassData() const { return &_class_data_; } -void SourceCodeInfo_Location::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void SourceCodeInfo_Location::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<SourceCodeInfo_Location *>(to)->MergeFrom( static_cast<const SourceCodeInfo_Location &>(from)); } @@ -10097,6 +10090,8 @@ bool SourceCodeInfo_Location::IsInitialized() const { void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); path_.InternalSwap(&other->path_); @@ -10104,13 +10099,13 @@ void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) { leading_detached_comments_.InternalSwap(&other->leading_detached_comments_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &leading_comments_, GetArenaForAllocation(), - &other->leading_comments_, other->GetArenaForAllocation() + &leading_comments_, lhs_arena, + &other->leading_comments_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &trailing_comments_, GetArenaForAllocation(), - &other->trailing_comments_, other->GetArenaForAllocation() + &trailing_comments_, lhs_arena, + &other->trailing_comments_, rhs_arena ); } @@ -10193,28 +10188,29 @@ const char* SourceCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -10255,13 +10251,7 @@ size_t SourceCodeInfo::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceCodeInfo::_class_data_ = { @@ -10270,8 +10260,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceCodeInfo::_class_data_ = }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SourceCodeInfo::GetClassData() const { return &_class_data_; } -void SourceCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void SourceCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<SourceCodeInfo *>(to)->MergeFrom( static_cast<const SourceCodeInfo &>(from)); } @@ -10417,7 +10407,8 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string source_file = 2; case 2: @@ -10428,7 +10419,8 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 begin = 3; case 3: @@ -10436,7 +10428,8 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT _Internal::set_has_begin(&has_bits); begin_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 end = 4; case 4: @@ -10444,29 +10437,30 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT _Internal::set_has_end(&has_bits); end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -10550,26 +10544,16 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { // optional int32 begin = 3; if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_begin()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_begin()); } // optional int32 end = 4; if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_end()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_end()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GeneratedCodeInfo_Annotation::_class_data_ = { @@ -10578,8 +10562,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GeneratedCodeInfo_Annotation:: }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GeneratedCodeInfo_Annotation::GetClassData() const { return &_class_data_; } -void GeneratedCodeInfo_Annotation::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void GeneratedCodeInfo_Annotation::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<GeneratedCodeInfo_Annotation *>(to)->MergeFrom( static_cast<const GeneratedCodeInfo_Annotation &>(from)); } @@ -10621,13 +10605,15 @@ bool GeneratedCodeInfo_Annotation::IsInitialized() const { void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); path_.InternalSwap(&other->path_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &source_file_, GetArenaForAllocation(), - &other->source_file_, other->GetArenaForAllocation() + &source_file_, lhs_arena, + &other->source_file_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_) @@ -10716,28 +10702,29 @@ const char* GeneratedCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -10778,13 +10765,7 @@ size_t GeneratedCodeInfo::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GeneratedCodeInfo::_class_data_ = { @@ -10793,8 +10774,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GeneratedCodeInfo::_class_data }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GeneratedCodeInfo::GetClassData() const { return &_class_data_; } -void GeneratedCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void GeneratedCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<GeneratedCodeInfo *>(to)->MergeFrom( static_cast<const GeneratedCodeInfo &>(from)); } @@ -10836,86 +10817,86 @@ void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FileDescriptorSet* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FileDescriptorSet >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FileDescriptorSet >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FileDescriptorSet* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FileDescriptorSet >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FileDescriptorSet >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FileDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::DescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::DescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::DescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::DescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FileOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FileOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FileOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FileOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FileOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FileOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::MessageOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::MessageOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::MessageOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::MessageOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::MessageOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::MessageOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FieldOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FieldOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FieldOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FieldOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FieldOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FieldOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::OneofOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::OneofOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::OneofOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::OneofOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::OneofOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::OneofOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::EnumOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::EnumOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::EnumOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::EnumOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::EnumOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::EnumOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::EnumValueOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::EnumValueOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::EnumValueOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::EnumValueOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::EnumValueOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::ServiceOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ServiceOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::ServiceOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::ServiceOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::ServiceOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::ServiceOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::MethodOptions* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::MethodOptions >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::MethodOptions >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::MethodOptions* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::MethodOptions >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::MethodOptions >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::UninterpretedOption* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::UninterpretedOption >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::UninterpretedOption >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::SourceCodeInfo* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::SourceCodeInfo >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::SourceCodeInfo >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h index 0df49109cd..87523484d2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -138,33 +138,33 @@ struct UninterpretedOption_NamePartDefaultTypeInternal; PROTOBUF_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _UninterpretedOption_NamePart_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::DescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::DescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::EnumOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::EnumValueOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumValueOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FieldOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FileDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FileDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FileDescriptorSet* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FileDescriptorSet>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FileOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FileOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::MessageOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MessageOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MethodDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::MethodOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MethodOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::OneofDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::OneofOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::OneofOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::ServiceOptions* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ServiceOptions>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::SourceCodeInfo* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceCodeInfo>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::UninterpretedOption* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::UninterpretedOption>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::DescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::DescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::EnumOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumValueOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FieldOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FieldOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FileDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FileDescriptorSet* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FileDescriptorSet>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FileOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FileOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::MessageOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::MessageOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::MethodOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::MethodOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::OneofOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::OneofOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::ServiceOptions* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ServiceOptions>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceCodeInfo>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::UninterpretedOption>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -348,7 +348,11 @@ class PROTOBUF_EXPORT FileDescriptorSet final : } inline FileDescriptorSet& operator=(FileDescriptorSet&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -413,7 +417,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FileDescriptorSet& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -459,16 +463,16 @@ class PROTOBUF_EXPORT FileDescriptorSet final : int _internal_file_size() const; public: void clear_file(); - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* mutable_file(); private: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_file(); + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_file(); public: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& file() const; // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorSet) @@ -478,7 +482,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto > file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto > file_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -503,7 +507,11 @@ class PROTOBUF_EXPORT FileDescriptorProto final : } inline FileDescriptorProto& operator=(FileDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -568,7 +576,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FileDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -649,16 +657,16 @@ class PROTOBUF_EXPORT FileDescriptorProto final : int _internal_message_type_size() const; public: void clear_message_type(); - PROTOBUF_NAMESPACE_ID::DescriptorProto* mutable_message_type(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* mutable_message_type(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >* mutable_message_type(); private: - const PROTOBUF_NAMESPACE_ID::DescriptorProto& _internal_message_type(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto* _internal_add_message_type(); + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& _internal_message_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* _internal_add_message_type(); public: - const PROTOBUF_NAMESPACE_ID::DescriptorProto& message_type(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto* add_message_type(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& message_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* add_message_type(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >& message_type() const; // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; @@ -667,16 +675,16 @@ class PROTOBUF_EXPORT FileDescriptorProto final : int _internal_enum_type_size() const; public: void clear_enum_type(); - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* mutable_enum_type(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* mutable_enum_type(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* mutable_enum_type(); private: - const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& _internal_enum_type(int index) const; - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _internal_add_enum_type(); + const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& _internal_enum_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _internal_add_enum_type(); public: - const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& enum_type(int index) const; - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* add_enum_type(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& enum_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* add_enum_type(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& enum_type() const; // repeated .google.protobuf.ServiceDescriptorProto service = 6; @@ -685,16 +693,16 @@ class PROTOBUF_EXPORT FileDescriptorProto final : int _internal_service_size() const; public: void clear_service(); - PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* mutable_service(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* mutable_service(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >* mutable_service(); private: - const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& _internal_service(int index) const; - PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* _internal_add_service(); + const ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& _internal_service(int index) const; + ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* _internal_add_service(); public: - const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& service(int index) const; - PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* add_service(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& service(int index) const; + ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* add_service(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >& service() const; // repeated .google.protobuf.FieldDescriptorProto extension = 7; @@ -703,16 +711,16 @@ class PROTOBUF_EXPORT FileDescriptorProto final : int _internal_extension_size() const; public: void clear_extension(); - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_extension(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_extension(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* mutable_extension(); private: - const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_extension(int index) const; - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_extension(); + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_extension(int index) const; + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_extension(); public: - const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& extension(int index) const; - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_extension(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& extension(int index) const; + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_extension(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& extension() const; // repeated int32 public_dependency = 10; @@ -819,17 +827,17 @@ class PROTOBUF_EXPORT FileDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::FileOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::FileOptions* release_options(); - PROTOBUF_NAMESPACE_ID::FileOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::FileOptions* options); + const ::PROTOBUF_NAMESPACE_ID::FileOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::FileOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::FileOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::FileOptions* options); private: - const PROTOBUF_NAMESPACE_ID::FileOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::FileOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::FileOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::FileOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::FileOptions* options); - PROTOBUF_NAMESPACE_ID::FileOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::FileOptions* options); + ::PROTOBUF_NAMESPACE_ID::FileOptions* unsafe_arena_release_options(); // optional .google.protobuf.SourceCodeInfo source_code_info = 9; bool has_source_code_info() const; @@ -837,17 +845,17 @@ class PROTOBUF_EXPORT FileDescriptorProto final : bool _internal_has_source_code_info() const; public: void clear_source_code_info(); - const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info(); - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* mutable_source_code_info(); - void set_allocated_source_code_info(PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info); + const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info(); + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* mutable_source_code_info(); + void set_allocated_source_code_info(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info); private: - const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& _internal_source_code_info() const; - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* _internal_mutable_source_code_info(); + const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& _internal_source_code_info() const; + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* _internal_mutable_source_code_info(); public: void unsafe_arena_set_allocated_source_code_info( - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info); - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* unsafe_arena_release_source_code_info(); + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info); + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* unsafe_arena_release_source_code_info(); // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto) private: @@ -859,17 +867,17 @@ class PROTOBUF_EXPORT FileDescriptorProto final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<TProtoStringType> dependency_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto > message_type_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto > enum_type_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto > service_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > extension_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto > message_type_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto > enum_type_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto > service_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > extension_; ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > public_dependency_; ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > weak_dependency_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr package_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr syntax_; - PROTOBUF_NAMESPACE_ID::FileOptions* options_; - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info_; + ::PROTOBUF_NAMESPACE_ID::FileOptions* options_; + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -893,7 +901,11 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : } inline DescriptorProto_ExtensionRange& operator=(DescriptorProto_ExtensionRange&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -958,7 +970,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const DescriptorProto_ExtensionRange& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1006,17 +1018,17 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options(); - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); + const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); private: - const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* unsafe_arena_release_options(); // optional int32 start = 1; bool has_start() const; @@ -1053,7 +1065,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options_; + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options_; ::PROTOBUF_NAMESPACE_ID::int32 start_; ::PROTOBUF_NAMESPACE_ID::int32 end_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; @@ -1079,7 +1091,11 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : } inline DescriptorProto_ReservedRange& operator=(DescriptorProto_ReservedRange&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1144,7 +1160,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const DescriptorProto_ReservedRange& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1245,7 +1261,11 @@ class PROTOBUF_EXPORT DescriptorProto final : } inline DescriptorProto& operator=(DescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1310,7 +1330,7 @@ class PROTOBUF_EXPORT DescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const DescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1368,16 +1388,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_field_size() const; public: void clear_field(); - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_field(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_field(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* mutable_field(); private: - const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_field(int index) const; - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_field(); + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_field(int index) const; + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_field(); public: - const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& field(int index) const; - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_field(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& field(int index) const; + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_field(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& field() const; // repeated .google.protobuf.DescriptorProto nested_type = 3; @@ -1386,16 +1406,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_nested_type_size() const; public: void clear_nested_type(); - PROTOBUF_NAMESPACE_ID::DescriptorProto* mutable_nested_type(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* mutable_nested_type(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >* mutable_nested_type(); private: - const PROTOBUF_NAMESPACE_ID::DescriptorProto& _internal_nested_type(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto* _internal_add_nested_type(); + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& _internal_nested_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* _internal_add_nested_type(); public: - const PROTOBUF_NAMESPACE_ID::DescriptorProto& nested_type(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto* add_nested_type(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& nested_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* add_nested_type(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >& nested_type() const; // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; @@ -1404,16 +1424,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_enum_type_size() const; public: void clear_enum_type(); - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* mutable_enum_type(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* mutable_enum_type(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* mutable_enum_type(); private: - const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& _internal_enum_type(int index) const; - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _internal_add_enum_type(); + const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& _internal_enum_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _internal_add_enum_type(); public: - const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& enum_type(int index) const; - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* add_enum_type(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& enum_type(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* add_enum_type(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& enum_type() const; // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; @@ -1422,16 +1442,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_extension_range_size() const; public: void clear_extension_range(); - PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* mutable_extension_range(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >* + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* mutable_extension_range(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >* mutable_extension_range(); private: - const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& _internal_extension_range(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* _internal_add_extension_range(); + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& _internal_extension_range(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* _internal_add_extension_range(); public: - const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& extension_range(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* add_extension_range(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >& + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& extension_range(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* add_extension_range(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >& extension_range() const; // repeated .google.protobuf.FieldDescriptorProto extension = 6; @@ -1440,16 +1460,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_extension_size() const; public: void clear_extension(); - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_extension(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* mutable_extension(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* mutable_extension(); private: - const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_extension(int index) const; - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_extension(); + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& _internal_extension(int index) const; + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _internal_add_extension(); public: - const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& extension(int index) const; - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_extension(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& extension(int index) const; + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* add_extension(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& extension() const; // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; @@ -1458,16 +1478,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_oneof_decl_size() const; public: void clear_oneof_decl(); - PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* mutable_oneof_decl(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* mutable_oneof_decl(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >* mutable_oneof_decl(); private: - const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& _internal_oneof_decl(int index) const; - PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* _internal_add_oneof_decl(); + const ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& _internal_oneof_decl(int index) const; + ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* _internal_add_oneof_decl(); public: - const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& oneof_decl(int index) const; - PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* add_oneof_decl(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& oneof_decl(int index) const; + ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* add_oneof_decl(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >& oneof_decl() const; // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; @@ -1476,16 +1496,16 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_reserved_range_size() const; public: void clear_reserved_range(); - PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* mutable_reserved_range(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >* + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* mutable_reserved_range(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >* mutable_reserved_range(); private: - const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& _internal_reserved_range(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* _internal_add_reserved_range(); + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& _internal_reserved_range(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* _internal_add_reserved_range(); public: - const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& reserved_range(int index) const; - PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* add_reserved_range(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >& + const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& reserved_range(int index) const; + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* add_reserved_range(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >& reserved_range() const; // repeated string reserved_name = 10; @@ -1536,17 +1556,17 @@ class PROTOBUF_EXPORT DescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::MessageOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::MessageOptions* release_options(); - PROTOBUF_NAMESPACE_ID::MessageOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::MessageOptions* options); + const ::PROTOBUF_NAMESPACE_ID::MessageOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::MessageOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::MessageOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::MessageOptions* options); private: - const PROTOBUF_NAMESPACE_ID::MessageOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::MessageOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::MessageOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::MessageOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::MessageOptions* options); - PROTOBUF_NAMESPACE_ID::MessageOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::MessageOptions* options); + ::PROTOBUF_NAMESPACE_ID::MessageOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto) private: @@ -1557,16 +1577,16 @@ class PROTOBUF_EXPORT DescriptorProto final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > field_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto > nested_type_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto > enum_type_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange > extension_range_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > extension_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto > oneof_decl_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange > reserved_range_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > field_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto > nested_type_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto > enum_type_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange > extension_range_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > extension_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto > oneof_decl_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange > reserved_range_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<TProtoStringType> reserved_name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::MessageOptions* options_; + ::PROTOBUF_NAMESPACE_ID::MessageOptions* options_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -1590,7 +1610,11 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : } inline ExtensionRangeOptions& operator=(ExtensionRangeOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1655,7 +1679,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const ExtensionRangeOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1701,19 +1725,208 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ExtensionRangeOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ExtensionRangeOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.ExtensionRangeOptions) private: class _Internal; @@ -1723,7 +1936,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -1748,7 +1961,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : } inline FieldDescriptorProto& operator=(FieldDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1813,7 +2030,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FieldDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -2053,17 +2270,17 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::FieldOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::FieldOptions* release_options(); - PROTOBUF_NAMESPACE_ID::FieldOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::FieldOptions* options); + const ::PROTOBUF_NAMESPACE_ID::FieldOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::FieldOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::FieldOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::FieldOptions* options); private: - const PROTOBUF_NAMESPACE_ID::FieldOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::FieldOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::FieldOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::FieldOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::FieldOptions* options); - PROTOBUF_NAMESPACE_ID::FieldOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::FieldOptions* options); + ::PROTOBUF_NAMESPACE_ID::FieldOptions* unsafe_arena_release_options(); // optional int32 number = 3; bool has_number() const; @@ -2110,11 +2327,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_label() const; public: void clear_label(); - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label label() const; - void set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value); + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label label() const; + void set_label(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value); private: - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label _internal_label() const; - void _internal_set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value); + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label _internal_label() const; + void _internal_set_label(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value); public: // optional .google.protobuf.FieldDescriptorProto.Type type = 5; @@ -2123,11 +2340,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_type() const; public: void clear_type(); - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type type() const; - void set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value); + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type type() const; + void set_type(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value); private: - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type _internal_type() const; - void _internal_set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value); + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type _internal_type() const; + void _internal_set_type(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value); public: // @@protoc_insertion_point(class_scope:google.protobuf.FieldDescriptorProto) @@ -2144,7 +2361,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr default_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr json_name_; - PROTOBUF_NAMESPACE_ID::FieldOptions* options_; + ::PROTOBUF_NAMESPACE_ID::FieldOptions* options_; ::PROTOBUF_NAMESPACE_ID::int32 number_; ::PROTOBUF_NAMESPACE_ID::int32 oneof_index_; bool proto3_optional_; @@ -2173,7 +2390,11 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : } inline OneofDescriptorProto& operator=(OneofDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -2238,7 +2459,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const OneofDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -2303,17 +2524,17 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::OneofOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::OneofOptions* release_options(); - PROTOBUF_NAMESPACE_ID::OneofOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::OneofOptions* options); + const ::PROTOBUF_NAMESPACE_ID::OneofOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::OneofOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::OneofOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::OneofOptions* options); private: - const PROTOBUF_NAMESPACE_ID::OneofOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::OneofOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::OneofOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::OneofOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::OneofOptions* options); - PROTOBUF_NAMESPACE_ID::OneofOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::OneofOptions* options); + ::PROTOBUF_NAMESPACE_ID::OneofOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.OneofDescriptorProto) private: @@ -2325,7 +2546,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::OneofOptions* options_; + ::PROTOBUF_NAMESPACE_ID::OneofOptions* options_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -2349,7 +2570,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : } inline EnumDescriptorProto_EnumReservedRange& operator=(EnumDescriptorProto_EnumReservedRange&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -2414,7 +2639,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const EnumDescriptorProto_EnumReservedRange& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -2515,7 +2740,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : } inline EnumDescriptorProto& operator=(EnumDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -2580,7 +2809,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const EnumDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -2632,16 +2861,16 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : int _internal_value_size() const; public: void clear_value(); - PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* mutable_value(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* mutable_value(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >* mutable_value(); private: - const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& _internal_value(int index) const; - PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* _internal_add_value(); + const ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& _internal_value(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* _internal_add_value(); public: - const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& value(int index) const; - PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* add_value(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& value(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* add_value(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >& value() const; // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; @@ -2650,16 +2879,16 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : int _internal_reserved_range_size() const; public: void clear_reserved_range(); - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >* + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >* mutable_reserved_range(); private: - const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& _internal_reserved_range(int index) const; - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* _internal_add_reserved_range(); + const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& _internal_reserved_range(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* _internal_add_reserved_range(); public: - const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const; - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* add_reserved_range(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >& + const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* add_reserved_range(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >& reserved_range() const; // repeated string reserved_name = 5; @@ -2710,17 +2939,17 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::EnumOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::EnumOptions* release_options(); - PROTOBUF_NAMESPACE_ID::EnumOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumOptions* options); + const ::PROTOBUF_NAMESPACE_ID::EnumOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::EnumOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::EnumOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumOptions* options); private: - const PROTOBUF_NAMESPACE_ID::EnumOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::EnumOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::EnumOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::EnumOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::EnumOptions* options); - PROTOBUF_NAMESPACE_ID::EnumOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::EnumOptions* options); + ::PROTOBUF_NAMESPACE_ID::EnumOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto) private: @@ -2731,11 +2960,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto > value_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange > reserved_range_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto > value_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange > reserved_range_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<TProtoStringType> reserved_name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::EnumOptions* options_; + ::PROTOBUF_NAMESPACE_ID::EnumOptions* options_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -2759,7 +2988,11 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : } inline EnumValueDescriptorProto& operator=(EnumValueDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -2824,7 +3057,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const EnumValueDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -2890,17 +3123,17 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::EnumValueOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options(); - PROTOBUF_NAMESPACE_ID::EnumValueOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); + const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); private: - const PROTOBUF_NAMESPACE_ID::EnumValueOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::EnumValueOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); - PROTOBUF_NAMESPACE_ID::EnumValueOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* unsafe_arena_release_options(); // optional int32 number = 2; bool has_number() const; @@ -2925,7 +3158,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::EnumValueOptions* options_; + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options_; ::PROTOBUF_NAMESPACE_ID::int32 number_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -2950,7 +3183,11 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : } inline ServiceDescriptorProto& operator=(ServiceDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -3015,7 +3252,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const ServiceDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -3063,16 +3300,16 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : int _internal_method_size() const; public: void clear_method(); - PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* mutable_method(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* mutable_method(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >* mutable_method(); private: - const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& _internal_method(int index) const; - PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* _internal_add_method(); + const ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& _internal_method(int index) const; + ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* _internal_add_method(); public: - const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& method(int index) const; - PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* add_method(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& method(int index) const; + ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* add_method(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >& method() const; // optional string name = 1; @@ -3099,17 +3336,17 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::ServiceOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options(); - PROTOBUF_NAMESPACE_ID::ServiceOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::ServiceOptions* options); + const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::ServiceOptions* options); private: - const PROTOBUF_NAMESPACE_ID::ServiceOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::ServiceOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::ServiceOptions* options); - PROTOBUF_NAMESPACE_ID::ServiceOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* options); + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* unsafe_arena_release_options(); // @@protoc_insertion_point(class_scope:google.protobuf.ServiceDescriptorProto) private: @@ -3120,9 +3357,9 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto > method_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto > method_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::ServiceOptions* options_; + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* options_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -3146,7 +3383,11 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : } inline MethodDescriptorProto& operator=(MethodDescriptorProto&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -3211,7 +3452,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const MethodDescriptorProto& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -3316,17 +3557,17 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : bool _internal_has_options() const; public: void clear_options(); - const PROTOBUF_NAMESPACE_ID::MethodOptions& options() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::MethodOptions* release_options(); - PROTOBUF_NAMESPACE_ID::MethodOptions* mutable_options(); - void set_allocated_options(PROTOBUF_NAMESPACE_ID::MethodOptions* options); + const ::PROTOBUF_NAMESPACE_ID::MethodOptions& options() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::MethodOptions* release_options(); + ::PROTOBUF_NAMESPACE_ID::MethodOptions* mutable_options(); + void set_allocated_options(::PROTOBUF_NAMESPACE_ID::MethodOptions* options); private: - const PROTOBUF_NAMESPACE_ID::MethodOptions& _internal_options() const; - PROTOBUF_NAMESPACE_ID::MethodOptions* _internal_mutable_options(); + const ::PROTOBUF_NAMESPACE_ID::MethodOptions& _internal_options() const; + ::PROTOBUF_NAMESPACE_ID::MethodOptions* _internal_mutable_options(); public: void unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::MethodOptions* options); - PROTOBUF_NAMESPACE_ID::MethodOptions* unsafe_arena_release_options(); + ::PROTOBUF_NAMESPACE_ID::MethodOptions* options); + ::PROTOBUF_NAMESPACE_ID::MethodOptions* unsafe_arena_release_options(); // optional bool client_streaming = 5 [default = false]; bool has_client_streaming() const; @@ -3366,7 +3607,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr input_type_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr output_type_; - PROTOBUF_NAMESPACE_ID::MethodOptions* options_; + ::PROTOBUF_NAMESPACE_ID::MethodOptions* options_; bool client_streaming_; bool server_streaming_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; @@ -3392,7 +3633,11 @@ class PROTOBUF_EXPORT FileOptions final : } inline FileOptions& operator=(FileOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -3457,7 +3702,7 @@ class PROTOBUF_EXPORT FileOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FileOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -3555,16 +3800,16 @@ class PROTOBUF_EXPORT FileOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional string java_package = 1; @@ -3857,11 +4102,11 @@ class PROTOBUF_EXPORT FileOptions final : bool _internal_has_optimize_for() const; public: void clear_optimize_for(); - PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode optimize_for() const; - void set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value); + ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode optimize_for() const; + void set_optimize_for(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value); private: - PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode _internal_optimize_for() const; - void _internal_set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value); + ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode _internal_optimize_for() const; + void _internal_set_optimize_for(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value); public: // optional bool cc_enable_arenas = 31 [default = true]; @@ -3877,7 +4122,196 @@ class PROTOBUF_EXPORT FileOptions final : void _internal_set_cc_enable_arenas(bool value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FileOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FileOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.FileOptions) private: class _Internal; @@ -3889,7 +4323,7 @@ class PROTOBUF_EXPORT FileOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr java_package_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr java_outer_classname_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr go_package_; @@ -3933,7 +4367,11 @@ class PROTOBUF_EXPORT MessageOptions final : } inline MessageOptions& operator=(MessageOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -3998,7 +4436,7 @@ class PROTOBUF_EXPORT MessageOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const MessageOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -4048,16 +4486,16 @@ class PROTOBUF_EXPORT MessageOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional bool message_set_wire_format = 1 [default = false]; @@ -4112,7 +4550,196 @@ class PROTOBUF_EXPORT MessageOptions final : void _internal_set_map_entry(bool value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MessageOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MessageOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.MessageOptions) private: class _Internal; @@ -4124,7 +4751,7 @@ class PROTOBUF_EXPORT MessageOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; bool message_set_wire_format_; bool no_standard_descriptor_accessor_; bool deprecated_; @@ -4152,7 +4779,11 @@ class PROTOBUF_EXPORT FieldOptions final : } inline FieldOptions& operator=(FieldOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -4217,7 +4848,7 @@ class PROTOBUF_EXPORT FieldOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FieldOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -4333,16 +4964,16 @@ class PROTOBUF_EXPORT FieldOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; @@ -4351,11 +4982,11 @@ class PROTOBUF_EXPORT FieldOptions final : bool _internal_has_ctype() const; public: void clear_ctype(); - PROTOBUF_NAMESPACE_ID::FieldOptions_CType ctype() const; - void set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value); + ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType ctype() const; + void set_ctype(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType value); private: - PROTOBUF_NAMESPACE_ID::FieldOptions_CType _internal_ctype() const; - void _internal_set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value); + ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType _internal_ctype() const; + void _internal_set_ctype(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType value); public: // optional bool packed = 2; @@ -4416,14 +5047,203 @@ class PROTOBUF_EXPORT FieldOptions final : bool _internal_has_jstype() const; public: void clear_jstype(); - PROTOBUF_NAMESPACE_ID::FieldOptions_JSType jstype() const; - void set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value); + ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType jstype() const; + void set_jstype(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value); private: - PROTOBUF_NAMESPACE_ID::FieldOptions_JSType _internal_jstype() const; - void _internal_set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value); + ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType _internal_jstype() const; + void _internal_set_jstype(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FieldOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + FieldOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.FieldOptions) private: class _Internal; @@ -4435,7 +5255,7 @@ class PROTOBUF_EXPORT FieldOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; int ctype_; bool packed_; bool lazy_; @@ -4465,7 +5285,11 @@ class PROTOBUF_EXPORT OneofOptions final : } inline OneofOptions& operator=(OneofOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -4530,7 +5354,7 @@ class PROTOBUF_EXPORT OneofOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const OneofOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -4576,19 +5400,208 @@ class PROTOBUF_EXPORT OneofOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(OneofOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + OneofOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.OneofOptions) private: class _Internal; @@ -4598,7 +5611,7 @@ class PROTOBUF_EXPORT OneofOptions final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -4623,7 +5636,11 @@ class PROTOBUF_EXPORT EnumOptions final : } inline EnumOptions& operator=(EnumOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -4688,7 +5705,7 @@ class PROTOBUF_EXPORT EnumOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const EnumOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -4736,16 +5753,16 @@ class PROTOBUF_EXPORT EnumOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional bool allow_alias = 2; @@ -4774,7 +5791,196 @@ class PROTOBUF_EXPORT EnumOptions final : void _internal_set_deprecated(bool value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.EnumOptions) private: class _Internal; @@ -4786,7 +5992,7 @@ class PROTOBUF_EXPORT EnumOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; bool allow_alias_; bool deprecated_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; @@ -4812,7 +6018,11 @@ class PROTOBUF_EXPORT EnumValueOptions final : } inline EnumValueOptions& operator=(EnumValueOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -4877,7 +6087,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const EnumValueOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -4924,16 +6134,16 @@ class PROTOBUF_EXPORT EnumValueOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional bool deprecated = 1 [default = false]; @@ -4949,7 +6159,196 @@ class PROTOBUF_EXPORT EnumValueOptions final : void _internal_set_deprecated(bool value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumValueOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + EnumValueOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueOptions) private: class _Internal; @@ -4961,7 +6360,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; bool deprecated_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -4986,7 +6385,11 @@ class PROTOBUF_EXPORT ServiceOptions final : } inline ServiceOptions& operator=(ServiceOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -5051,7 +6454,7 @@ class PROTOBUF_EXPORT ServiceOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const ServiceOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -5098,16 +6501,16 @@ class PROTOBUF_EXPORT ServiceOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional bool deprecated = 33 [default = false]; @@ -5123,7 +6526,196 @@ class PROTOBUF_EXPORT ServiceOptions final : void _internal_set_deprecated(bool value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ServiceOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + ServiceOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.ServiceOptions) private: class _Internal; @@ -5135,7 +6727,7 @@ class PROTOBUF_EXPORT ServiceOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; bool deprecated_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -5160,7 +6752,11 @@ class PROTOBUF_EXPORT MethodOptions final : } inline MethodOptions& operator=(MethodOptions&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -5225,7 +6821,7 @@ class PROTOBUF_EXPORT MethodOptions final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const MethodOptions& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -5305,16 +6901,16 @@ class PROTOBUF_EXPORT MethodOptions final : int _internal_uninterpreted_option_size() const; public: void clear_uninterpreted_option(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* mutable_uninterpreted_option(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* mutable_uninterpreted_option(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& _internal_uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _internal_add_uninterpreted_option(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& uninterpreted_option(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* add_uninterpreted_option(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& uninterpreted_option() const; // optional bool deprecated = 33 [default = false]; @@ -5336,14 +6932,203 @@ class PROTOBUF_EXPORT MethodOptions final : bool _internal_has_idempotency_level() const; public: void clear_idempotency_level(); - PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel idempotency_level() const; - void set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value); + ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel idempotency_level() const; + void set_idempotency_level(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value); private: - PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel _internal_idempotency_level() const; - void _internal_set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value); + ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel _internal_idempotency_level() const; + void _internal_set_idempotency_level(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value); public: - GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MethodOptions) + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.Has(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _extensions_.ExtensionSize(id.number()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); + + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); + } + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Singular::MutableType + UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { + + return _proto_TypeTraits::Get(id.number(), _extensions_, index); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { + + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); + + return to_add; + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); + + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& + GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) const { + + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); + } + + template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> + inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* + MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + MethodOptions, _proto_TypeTraits, _field_type, _is_packed>& id) { + + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); + } + // @@protoc_insertion_point(class_scope:google.protobuf.MethodOptions) private: class _Internal; @@ -5355,7 +7140,7 @@ class PROTOBUF_EXPORT MethodOptions final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption > uninterpreted_option_; bool deprecated_; int idempotency_level_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; @@ -5381,7 +7166,11 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : } inline UninterpretedOption_NamePart& operator=(UninterpretedOption_NamePart&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -5446,7 +7235,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const UninterpretedOption_NamePart& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -5555,7 +7344,11 @@ class PROTOBUF_EXPORT UninterpretedOption final : } inline UninterpretedOption& operator=(UninterpretedOption&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -5620,7 +7413,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const UninterpretedOption& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -5674,16 +7467,16 @@ class PROTOBUF_EXPORT UninterpretedOption final : int _internal_name_size() const; public: void clear_name(); - PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* mutable_name(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >* + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* mutable_name(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >* mutable_name(); private: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& _internal_name(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* _internal_add_name(); + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& _internal_name(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* _internal_add_name(); public: - const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& name(int index) const; - PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* add_name(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >& + const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& name(int index) const; + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* add_name(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >& name() const; // optional string identifier_value = 3; @@ -5788,7 +7581,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart > name_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart > name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr identifier_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr aggregate_value_; @@ -5818,7 +7611,11 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : } inline SourceCodeInfo_Location& operator=(SourceCodeInfo_Location&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -5883,7 +7680,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const SourceCodeInfo_Location& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -6070,7 +7867,11 @@ class PROTOBUF_EXPORT SourceCodeInfo final : } inline SourceCodeInfo& operator=(SourceCodeInfo&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -6135,7 +7936,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const SourceCodeInfo& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -6183,16 +7984,16 @@ class PROTOBUF_EXPORT SourceCodeInfo final : int _internal_location_size() const; public: void clear_location(); - PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* mutable_location(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >* + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* mutable_location(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >* mutable_location(); private: - const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& _internal_location(int index) const; - PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* _internal_add_location(); + const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& _internal_location(int index) const; + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* _internal_add_location(); public: - const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& location(int index) const; - PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* add_location(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >& + const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& location(int index) const; + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* add_location(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >& location() const; // @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo) @@ -6202,7 +8003,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location > location_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location > location_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -6227,7 +8028,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : } inline GeneratedCodeInfo_Annotation& operator=(GeneratedCodeInfo_Annotation&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -6292,7 +8097,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const GeneratedCodeInfo_Annotation& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -6438,7 +8243,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : } inline GeneratedCodeInfo& operator=(GeneratedCodeInfo&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -6503,7 +8312,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const GeneratedCodeInfo& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -6551,16 +8360,16 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : int _internal_annotation_size() const; public: void clear_annotation(); - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* mutable_annotation(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >* + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* mutable_annotation(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >* mutable_annotation(); private: - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& _internal_annotation(int index) const; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* _internal_add_annotation(); + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& _internal_annotation(int index) const; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* _internal_add_annotation(); public: - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& annotation(int index) const; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* add_annotation(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >& + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& annotation(int index) const; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* add_annotation(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >& annotation() const; // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo) @@ -6570,7 +8379,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation > annotation_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation > annotation_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -6595,31 +8404,31 @@ inline int FileDescriptorSet::file_size() const { inline void FileDescriptorSet::clear_file() { file_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file) return file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* FileDescriptorSet::mutable_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file) return &file_; } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& FileDescriptorSet::_internal_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& FileDescriptorSet::_internal_file(int index) const { return file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& FileDescriptorSet::file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& FileDescriptorSet::file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file) return _internal_file(index); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::_internal_add_file() { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::_internal_add_file() { return file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::add_file() { - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_file(); +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* FileDescriptorSet::add_file() { + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_file(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& FileDescriptorSet::file() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorSet.file) return file_; @@ -6924,31 +8733,31 @@ inline int FileDescriptorProto::message_type_size() const { inline void FileDescriptorProto::clear_message_type() { message_type_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type) return message_type_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >* FileDescriptorProto::mutable_message_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type) return &message_type_; } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& FileDescriptorProto::_internal_message_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& FileDescriptorProto::_internal_message_type(int index) const { return message_type_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& FileDescriptorProto::message_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& FileDescriptorProto::message_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type) return _internal_message_type(index); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::_internal_add_message_type() { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::_internal_add_message_type() { return message_type_.Add(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::add_message_type() { - PROTOBUF_NAMESPACE_ID::DescriptorProto* _add = _internal_add_message_type(); +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto* FileDescriptorProto::add_message_type() { + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* _add = _internal_add_message_type(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >& FileDescriptorProto::message_type() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.message_type) return message_type_; @@ -6964,31 +8773,31 @@ inline int FileDescriptorProto::enum_type_size() const { inline void FileDescriptorProto::clear_enum_type() { enum_type_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) { +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type) return enum_type_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* FileDescriptorProto::mutable_enum_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type) return &enum_type_; } -inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& FileDescriptorProto::_internal_enum_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& FileDescriptorProto::_internal_enum_type(int index) const { return enum_type_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type) return _internal_enum_type(index); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::_internal_add_enum_type() { +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::_internal_add_enum_type() { return enum_type_.Add(); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::add_enum_type() { - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _add = _internal_add_enum_type(); +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* FileDescriptorProto::add_enum_type() { + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _add = _internal_add_enum_type(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& FileDescriptorProto::enum_type() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.enum_type) return enum_type_; @@ -7004,31 +8813,31 @@ inline int FileDescriptorProto::service_size() const { inline void FileDescriptorProto::clear_service() { service_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) { +inline ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service) return service_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >* FileDescriptorProto::mutable_service() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service) return &service_; } -inline const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& FileDescriptorProto::_internal_service(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& FileDescriptorProto::_internal_service(int index) const { return service_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& FileDescriptorProto::service(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto& FileDescriptorProto::service(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service) return _internal_service(index); } -inline PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::_internal_add_service() { +inline ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::_internal_add_service() { return service_.Add(); } -inline PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::add_service() { - PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* _add = _internal_add_service(); +inline ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* FileDescriptorProto::add_service() { + ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto* _add = _internal_add_service(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto >& FileDescriptorProto::service() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.service) return service_; @@ -7044,31 +8853,31 @@ inline int FileDescriptorProto::extension_size() const { inline void FileDescriptorProto::clear_extension() { extension_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension) return extension_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* FileDescriptorProto::mutable_extension() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension) return &extension_; } -inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& FileDescriptorProto::_internal_extension(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& FileDescriptorProto::_internal_extension(int index) const { return extension_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& FileDescriptorProto::extension(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& FileDescriptorProto::extension(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension) return _internal_extension(index); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::_internal_add_extension() { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::_internal_add_extension() { return extension_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::add_extension() { - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _add = _internal_add_extension(); +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* FileDescriptorProto::add_extension() { + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _add = _internal_add_extension(); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& FileDescriptorProto::extension() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.extension) return extension_; @@ -7087,17 +8896,17 @@ inline void FileDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000008u; } -inline const PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::FileOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::FileOptions&>( - PROTOBUF_NAMESPACE_ID::_FileOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::FileOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::FileOptions&>( + ::PROTOBUF_NAMESPACE_ID::_FileOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::FileOptions& FileDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.options) return _internal_options(); } inline void FileDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::FileOptions* options) { + ::PROTOBUF_NAMESPACE_ID::FileOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -7109,9 +8918,9 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -7124,34 +8933,34 @@ inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::release_options( #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options) _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000008u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FileOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FileOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::FileOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::FileOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options) return _msg; } -inline void FileDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::FileOptions* options) { +inline void FileDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::FileOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::FileOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::FileOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -7177,17 +8986,17 @@ inline void FileDescriptorProto::clear_source_code_info() { if (source_code_info_ != nullptr) source_code_info_->Clear(); _has_bits_[0] &= ~0x00000010u; } -inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::_internal_source_code_info() const { - const PROTOBUF_NAMESPACE_ID::SourceCodeInfo* p = source_code_info_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::SourceCodeInfo&>( - PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::_internal_source_code_info() const { + const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* p = source_code_info_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo&>( + ::PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::source_code_info() const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& FileDescriptorProto::source_code_info() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.source_code_info) return _internal_source_code_info(); } inline void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info( - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) { + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_code_info_); } @@ -7199,9 +9008,9 @@ inline void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.source_code_info) } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::release_source_code_info() { _has_bits_[0] &= ~0x00000010u; - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_; + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_; source_code_info_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -7214,34 +9023,34 @@ inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::release_sourc #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::unsafe_arena_release_source_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::unsafe_arena_release_source_code_info() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info) _has_bits_[0] &= ~0x00000010u; - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_; + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_; source_code_info_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::_internal_mutable_source_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::_internal_mutable_source_code_info() { _has_bits_[0] |= 0x00000010u; if (source_code_info_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceCodeInfo>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceCodeInfo>(GetArenaForAllocation()); source_code_info_ = p; } return source_code_info_; } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { - PROTOBUF_NAMESPACE_ID::SourceCodeInfo* _msg = _internal_mutable_source_code_info(); +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() { + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* _msg = _internal_mutable_source_code_info(); // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info) return _msg; } -inline void FileDescriptorProto::set_allocated_source_code_info(PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) { +inline void FileDescriptorProto::set_allocated_source_code_info(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete source_code_info_; } if (source_code_info) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::SourceCodeInfo>::GetOwningArena(source_code_info); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::SourceCodeInfo>::GetOwningArena(source_code_info); if (message_arena != submessage_arena) { source_code_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, source_code_info, submessage_arena); @@ -7385,17 +9194,17 @@ inline void DescriptorProto_ExtensionRange::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000001u; } -inline const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions&>( - PROTOBUF_NAMESPACE_ID::_ExtensionRangeOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions&>( + ::PROTOBUF_NAMESPACE_ID::_ExtensionRangeOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& DescriptorProto_ExtensionRange::options() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.options) return _internal_options(); } inline void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) { + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -7407,9 +9216,9 @@ inline void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.ExtensionRange.options) } -inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() { _has_bits_[0] &= ~0x00000001u; - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -7422,34 +9231,34 @@ inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRa #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options) _has_bits_[0] &= ~0x00000001u; - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::_internal_mutable_options() { _has_bits_[0] |= 0x00000001u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { - PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options) return _msg; } -inline void DescriptorProto_ExtensionRange::set_allocated_options(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) { +inline void DescriptorProto_ExtensionRange::set_allocated_options(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -7594,31 +9403,31 @@ inline int DescriptorProto::field_size() const { inline void DescriptorProto::clear_field() { field_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::mutable_field(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::mutable_field(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field) return field_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* DescriptorProto::mutable_field() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field) return &field_; } -inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::_internal_field(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::_internal_field(int index) const { return field_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::field(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::field(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field) return _internal_field(index); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::_internal_add_field() { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::_internal_add_field() { return field_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::add_field() { - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _add = _internal_add_field(); +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::add_field() { + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _add = _internal_add_field(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& DescriptorProto::field() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.field) return field_; @@ -7634,31 +9443,31 @@ inline int DescriptorProto::extension_size() const { inline void DescriptorProto::clear_extension() { extension_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension) return extension_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >* DescriptorProto::mutable_extension() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension) return &extension_; } -inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::_internal_extension(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::_internal_extension(int index) const { return extension_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::extension(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto& DescriptorProto::extension(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension) return _internal_extension(index); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::_internal_add_extension() { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::_internal_add_extension() { return extension_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::add_extension() { - PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _add = _internal_add_extension(); +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* DescriptorProto::add_extension() { + ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto* _add = _internal_add_extension(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto >& DescriptorProto::extension() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension) return extension_; @@ -7674,31 +9483,31 @@ inline int DescriptorProto::nested_type_size() const { inline void DescriptorProto::clear_nested_type() { nested_type_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::mutable_nested_type(int index) { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::mutable_nested_type(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type) return nested_type_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >* DescriptorProto::mutable_nested_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type) return &nested_type_; } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& DescriptorProto::_internal_nested_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& DescriptorProto::_internal_nested_type(int index) const { return nested_type_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto& DescriptorProto::nested_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto& DescriptorProto::nested_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type) return _internal_nested_type(index); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::_internal_add_nested_type() { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::_internal_add_nested_type() { return nested_type_.Add(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::add_nested_type() { - PROTOBUF_NAMESPACE_ID::DescriptorProto* _add = _internal_add_nested_type(); +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto* DescriptorProto::add_nested_type() { + ::PROTOBUF_NAMESPACE_ID::DescriptorProto* _add = _internal_add_nested_type(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto >& DescriptorProto::nested_type() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.nested_type) return nested_type_; @@ -7714,31 +9523,31 @@ inline int DescriptorProto::enum_type_size() const { inline void DescriptorProto::clear_enum_type() { enum_type_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) { +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type) return enum_type_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >* DescriptorProto::mutable_enum_type() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type) return &enum_type_; } -inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& DescriptorProto::_internal_enum_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& DescriptorProto::_internal_enum_type(int index) const { return enum_type_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& DescriptorProto::enum_type(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto& DescriptorProto::enum_type(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type) return _internal_enum_type(index); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::_internal_add_enum_type() { +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::_internal_add_enum_type() { return enum_type_.Add(); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::add_enum_type() { - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _add = _internal_add_enum_type(); +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* DescriptorProto::add_enum_type() { + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto* _add = _internal_add_enum_type(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto >& DescriptorProto::enum_type() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.enum_type) return enum_type_; @@ -7754,31 +9563,31 @@ inline int DescriptorProto::extension_range_size() const { inline void DescriptorProto::clear_extension_range() { extension_range_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension_range) return extension_range_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >* DescriptorProto::mutable_extension_range() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range) return &extension_range_; } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& DescriptorProto::_internal_extension_range(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& DescriptorProto::_internal_extension_range(int index) const { return extension_range_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range) return _internal_extension_range(index); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::_internal_add_extension_range() { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::_internal_add_extension_range() { return extension_range_.Add(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() { - PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* _add = _internal_add_extension_range(); +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() { + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange* _add = _internal_add_extension_range(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ExtensionRange >& DescriptorProto::extension_range() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension_range) return extension_range_; @@ -7794,31 +9603,31 @@ inline int DescriptorProto::oneof_decl_size() const { inline void DescriptorProto::clear_oneof_decl() { oneof_decl_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) { +inline ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl) return oneof_decl_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >* DescriptorProto::mutable_oneof_decl() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl) return &oneof_decl_; } -inline const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& DescriptorProto::_internal_oneof_decl(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& DescriptorProto::_internal_oneof_decl(int index) const { return oneof_decl_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl) return _internal_oneof_decl(index); } -inline PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::_internal_add_oneof_decl() { +inline ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::_internal_add_oneof_decl() { return oneof_decl_.Add(); } -inline PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::add_oneof_decl() { - PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* _add = _internal_add_oneof_decl(); +inline ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* DescriptorProto::add_oneof_decl() { + ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto* _add = _internal_add_oneof_decl(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::OneofDescriptorProto >& DescriptorProto::oneof_decl() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.oneof_decl) return oneof_decl_; @@ -7837,17 +9646,17 @@ inline void DescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::MessageOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::MessageOptions&>( - PROTOBUF_NAMESPACE_ID::_MessageOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::MessageOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::MessageOptions&>( + ::PROTOBUF_NAMESPACE_ID::_MessageOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::MessageOptions& DescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.options) return _internal_options(); } inline void DescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::MessageOptions* options) { + ::PROTOBUF_NAMESPACE_ID::MessageOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -7859,9 +9668,9 @@ inline void DescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::release_options() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -7874,34 +9683,34 @@ inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::release_options() #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MessageOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::MessageOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::MessageOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::MessageOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options) return _msg; } -inline void DescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::MessageOptions* options) { +inline void DescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::MessageOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::MessageOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::MessageOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -7924,31 +9733,31 @@ inline int DescriptorProto::reserved_range_size() const { inline void DescriptorProto::clear_reserved_range() { reserved_range_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::mutable_reserved_range(int index) { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::mutable_reserved_range(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_range) return reserved_range_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >* DescriptorProto::mutable_reserved_range() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_range) return &reserved_range_; } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& DescriptorProto::_internal_reserved_range(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& DescriptorProto::_internal_reserved_range(int index) const { return reserved_range_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range) return _internal_reserved_range(index); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::_internal_add_reserved_range() { +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::_internal_add_reserved_range() { return reserved_range_.Add(); } -inline PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() { - PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* _add = _internal_add_reserved_range(); +inline ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() { + ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange* _add = _internal_add_reserved_range(); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::DescriptorProto_ReservedRange >& DescriptorProto::reserved_range() const { // @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_range) return reserved_range_; @@ -8043,31 +9852,31 @@ inline int ExtensionRangeOptions::uninterpreted_option_size() const { inline void ExtensionRangeOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* ExtensionRangeOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ExtensionRangeOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& ExtensionRangeOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ExtensionRangeOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& ExtensionRangeOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& ExtensionRangeOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option) return uninterpreted_option_; @@ -8175,19 +9984,19 @@ inline void FieldDescriptorProto::clear_label() { label_ = 1; _has_bits_[0] &= ~0x00000200u; } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label FieldDescriptorProto::_internal_label() const { - return static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label >(label_); +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label FieldDescriptorProto::_internal_label() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label >(label_); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label FieldDescriptorProto::label() const { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label FieldDescriptorProto::label() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.label) return _internal_label(); } -inline void FieldDescriptorProto::_internal_set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { - assert(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(value)); +inline void FieldDescriptorProto::_internal_set_label(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { + assert(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(value)); _has_bits_[0] |= 0x00000200u; label_ = value; } -inline void FieldDescriptorProto::set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { +inline void FieldDescriptorProto::set_label(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value) { _internal_set_label(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.label) } @@ -8204,19 +10013,19 @@ inline void FieldDescriptorProto::clear_type() { type_ = 1; _has_bits_[0] &= ~0x00000400u; } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type FieldDescriptorProto::_internal_type() const { - return static_cast< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type >(type_); +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type FieldDescriptorProto::_internal_type() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type >(type_); } -inline PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type FieldDescriptorProto::type() const { +inline ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type FieldDescriptorProto::type() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type) return _internal_type(); } -inline void FieldDescriptorProto::_internal_set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { - assert(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(value)); +inline void FieldDescriptorProto::_internal_set_type(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { + assert(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(value)); _has_bits_[0] |= 0x00000400u; type_ = value; } -inline void FieldDescriptorProto::set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { +inline void FieldDescriptorProto::set_type(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value) { _internal_set_type(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type) } @@ -8494,17 +10303,17 @@ inline void FieldDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000020u; } -inline const PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::FieldOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::FieldOptions&>( - PROTOBUF_NAMESPACE_ID::_FieldOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::FieldOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::FieldOptions&>( + ::PROTOBUF_NAMESPACE_ID::_FieldOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::FieldOptions& FieldDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.options) return _internal_options(); } inline void FieldDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::FieldOptions* options) { + ::PROTOBUF_NAMESPACE_ID::FieldOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -8516,9 +10325,9 @@ inline void FieldDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000020u; - PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -8531,34 +10340,34 @@ inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::release_option #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options) _has_bits_[0] &= ~0x00000020u; - PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000020u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FieldOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::FieldOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::FieldOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options) return _msg; } -inline void FieldDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::FieldOptions* options) { +inline void FieldDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::FieldOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::FieldOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::FieldOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -8674,17 +10483,17 @@ inline void OneofDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::OneofOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::OneofOptions&>( - PROTOBUF_NAMESPACE_ID::_OneofOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::OneofOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::OneofOptions&>( + ::PROTOBUF_NAMESPACE_ID::_OneofOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::OneofOptions& OneofDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.options) return _internal_options(); } inline void OneofDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::OneofOptions* options) { + ::PROTOBUF_NAMESPACE_ID::OneofOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -8696,9 +10505,9 @@ inline void OneofDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -8711,34 +10520,34 @@ inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::release_option #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::OneofOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::OneofOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::OneofOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::OneofOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options) return _msg; } -inline void OneofDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::OneofOptions* options) { +inline void OneofDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::OneofOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::OneofOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::OneofOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -8883,31 +10692,31 @@ inline int EnumDescriptorProto::value_size() const { inline void EnumDescriptorProto::clear_value() { value_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) { +inline ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value) return value_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >* EnumDescriptorProto::mutable_value() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value) return &value_; } -inline const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& EnumDescriptorProto::_internal_value(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& EnumDescriptorProto::_internal_value(int index) const { return value_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value) return _internal_value(index); } -inline PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::_internal_add_value() { +inline ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::_internal_add_value() { return value_.Add(); } -inline PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::add_value() { - PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* _add = _internal_add_value(); +inline ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* EnumDescriptorProto::add_value() { + ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto* _add = _internal_add_value(); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValueDescriptorProto >& EnumDescriptorProto::value() const { // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.value) return value_; @@ -8926,17 +10735,17 @@ inline void EnumDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::EnumOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::EnumOptions&>( - PROTOBUF_NAMESPACE_ID::_EnumOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::EnumOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::EnumOptions&>( + ::PROTOBUF_NAMESPACE_ID::_EnumOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumOptions& EnumDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.options) return _internal_options(); } inline void EnumDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::EnumOptions* options) { + ::PROTOBUF_NAMESPACE_ID::EnumOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -8948,9 +10757,9 @@ inline void EnumDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -8963,34 +10772,34 @@ inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::release_options( #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::EnumOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::EnumOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options) return _msg; } -inline void EnumDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumOptions* options) { +inline void EnumDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::EnumOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::EnumOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -9013,31 +10822,31 @@ inline int EnumDescriptorProto::reserved_range_size() const { inline void EnumDescriptorProto::clear_reserved_range() { reserved_range_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::mutable_reserved_range(int index) { +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::mutable_reserved_range(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_range) return reserved_range_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >* EnumDescriptorProto::mutable_reserved_range() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_range) return &reserved_range_; } -inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::_internal_reserved_range(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::_internal_reserved_range(int index) const { return reserved_range_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::reserved_range(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::reserved_range(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_range) return _internal_reserved_range(index); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::_internal_add_reserved_range() { +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::_internal_add_reserved_range() { return reserved_range_.Add(); } -inline PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() { - PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* _add = _internal_add_reserved_range(); +inline ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() { + ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange* _add = _internal_add_reserved_range(); // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto_EnumReservedRange >& EnumDescriptorProto::reserved_range() const { // @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.reserved_range) return reserved_range_; @@ -9221,17 +11030,17 @@ inline void EnumValueDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::EnumValueOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::EnumValueOptions&>( - PROTOBUF_NAMESPACE_ID::_EnumValueOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions&>( + ::PROTOBUF_NAMESPACE_ID::_EnumValueOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& EnumValueDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.options) return _internal_options(); } inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) { + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -9243,9 +11052,9 @@ inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -9258,34 +11067,34 @@ inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::releas #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumValueOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumValueOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::EnumValueOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options) return _msg; } -inline void EnumValueDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) { +inline void EnumValueDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::EnumValueOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::EnumValueOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -9370,31 +11179,31 @@ inline int ServiceDescriptorProto::method_size() const { inline void ServiceDescriptorProto::clear_method() { method_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) { +inline ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method) return method_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >* ServiceDescriptorProto::mutable_method() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method) return &method_; } -inline const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& ServiceDescriptorProto::_internal_method(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& ServiceDescriptorProto::_internal_method(int index) const { return method_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method) return _internal_method(index); } -inline PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::_internal_add_method() { +inline ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::_internal_add_method() { return method_.Add(); } -inline PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::add_method() { - PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* _add = _internal_add_method(); +inline ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* ServiceDescriptorProto::add_method() { + ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto* _add = _internal_add_method(); // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::MethodDescriptorProto >& ServiceDescriptorProto::method() const { // @@protoc_insertion_point(field_list:google.protobuf.ServiceDescriptorProto.method) return method_; @@ -9413,17 +11222,17 @@ inline void ServiceDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::ServiceOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::ServiceOptions&>( - PROTOBUF_NAMESPACE_ID::_ServiceOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::ServiceOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::ServiceOptions&>( + ::PROTOBUF_NAMESPACE_ID::_ServiceOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& ServiceDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.options) return _internal_options(); } inline void ServiceDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::ServiceOptions* options) { + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -9435,9 +11244,9 @@ inline void ServiceDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -9450,34 +11259,34 @@ inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::release_op #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000002u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ServiceOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ServiceOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::ServiceOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::ServiceOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options) return _msg; } -inline void ServiceDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::ServiceOptions* options) { +inline void ServiceDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::ServiceOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::ServiceOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::ServiceOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -9681,17 +11490,17 @@ inline void MethodDescriptorProto::clear_options() { if (options_ != nullptr) options_->Clear(); _has_bits_[0] &= ~0x00000008u; } -inline const PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::_internal_options() const { - const PROTOBUF_NAMESPACE_ID::MethodOptions* p = options_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::MethodOptions&>( - PROTOBUF_NAMESPACE_ID::_MethodOptions_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::_internal_options() const { + const ::PROTOBUF_NAMESPACE_ID::MethodOptions* p = options_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::MethodOptions&>( + ::PROTOBUF_NAMESPACE_ID::_MethodOptions_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::options() const { +inline const ::PROTOBUF_NAMESPACE_ID::MethodOptions& MethodDescriptorProto::options() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.options) return _internal_options(); } inline void MethodDescriptorProto::unsafe_arena_set_allocated_options( - PROTOBUF_NAMESPACE_ID::MethodOptions* options) { + ::PROTOBUF_NAMESPACE_ID::MethodOptions* options) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_); } @@ -9703,9 +11512,9 @@ inline void MethodDescriptorProto::unsafe_arena_set_allocated_options( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.options) } -inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::release_options() { +inline ::PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::release_options() { _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_; options_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -9718,34 +11527,34 @@ inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::release_opti #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::unsafe_arena_release_options() { +inline ::PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::unsafe_arena_release_options() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options) _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_; + ::PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_; options_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::_internal_mutable_options() { +inline ::PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::_internal_mutable_options() { _has_bits_[0] |= 0x00000008u; if (options_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MethodOptions>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::MethodOptions>(GetArenaForAllocation()); options_ = p; } return options_; } -inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::mutable_options() { - PROTOBUF_NAMESPACE_ID::MethodOptions* _msg = _internal_mutable_options(); +inline ::PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::mutable_options() { + ::PROTOBUF_NAMESPACE_ID::MethodOptions* _msg = _internal_mutable_options(); // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options) return _msg; } -inline void MethodDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::MethodOptions* options) { +inline void MethodDescriptorProto::set_allocated_options(::PROTOBUF_NAMESPACE_ID::MethodOptions* options) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete options_; } if (options) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::MethodOptions>::GetOwningArena(options); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::MethodOptions>::GetOwningArena(options); if (message_arena != submessage_arena) { options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, options, submessage_arena); @@ -10030,19 +11839,19 @@ inline void FileOptions::clear_optimize_for() { optimize_for_ = 1; _has_bits_[0] &= ~0x00040000u; } -inline PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode FileOptions::_internal_optimize_for() const { - return static_cast< PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode >(optimize_for_); +inline ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode FileOptions::_internal_optimize_for() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode >(optimize_for_); } -inline PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode FileOptions::optimize_for() const { +inline ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode FileOptions::optimize_for() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.optimize_for) return _internal_optimize_for(); } -inline void FileOptions::_internal_set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { - assert(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(value)); +inline void FileOptions::_internal_set_optimize_for(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { + assert(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(value)); _has_bits_[0] |= 0x00040000u; optimize_for_ = value; } -inline void FileOptions::set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { +inline void FileOptions::set_optimize_for(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value) { _internal_set_optimize_for(value); // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.optimize_for) } @@ -10689,31 +12498,31 @@ inline int FileOptions::uninterpreted_option_size() const { inline void FileOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* FileOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FileOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& FileOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FileOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& FileOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* FileOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& FileOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.FileOptions.uninterpreted_option) return uninterpreted_option_; @@ -10845,31 +12654,31 @@ inline int MessageOptions::uninterpreted_option_size() const { inline void MessageOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* MessageOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MessageOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& MessageOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* MessageOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& MessageOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.MessageOptions.uninterpreted_option) return uninterpreted_option_; @@ -10891,19 +12700,19 @@ inline void FieldOptions::clear_ctype() { ctype_ = 0; _has_bits_[0] &= ~0x00000001u; } -inline PROTOBUF_NAMESPACE_ID::FieldOptions_CType FieldOptions::_internal_ctype() const { - return static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_CType >(ctype_); +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType FieldOptions::_internal_ctype() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType >(ctype_); } -inline PROTOBUF_NAMESPACE_ID::FieldOptions_CType FieldOptions::ctype() const { +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType FieldOptions::ctype() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.ctype) return _internal_ctype(); } -inline void FieldOptions::_internal_set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { - assert(PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(value)); +inline void FieldOptions::_internal_set_ctype(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { + assert(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(value)); _has_bits_[0] |= 0x00000001u; ctype_ = value; } -inline void FieldOptions::set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { +inline void FieldOptions::set_ctype(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType value) { _internal_set_ctype(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.ctype) } @@ -10948,19 +12757,19 @@ inline void FieldOptions::clear_jstype() { jstype_ = 0; _has_bits_[0] &= ~0x00000020u; } -inline PROTOBUF_NAMESPACE_ID::FieldOptions_JSType FieldOptions::_internal_jstype() const { - return static_cast< PROTOBUF_NAMESPACE_ID::FieldOptions_JSType >(jstype_); +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType FieldOptions::_internal_jstype() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType >(jstype_); } -inline PROTOBUF_NAMESPACE_ID::FieldOptions_JSType FieldOptions::jstype() const { +inline ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType FieldOptions::jstype() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.jstype) return _internal_jstype(); } -inline void FieldOptions::_internal_set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { - assert(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(value)); +inline void FieldOptions::_internal_set_jstype(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { + assert(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(value)); _has_bits_[0] |= 0x00000020u; jstype_ = value; } -inline void FieldOptions::set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { +inline void FieldOptions::set_jstype(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value) { _internal_set_jstype(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldOptions.jstype) } @@ -11059,31 +12868,31 @@ inline int FieldOptions::uninterpreted_option_size() const { inline void FieldOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* FieldOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FieldOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& FieldOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* FieldOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& FieldOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.uninterpreted_option) return uninterpreted_option_; @@ -11103,31 +12912,31 @@ inline int OneofOptions::uninterpreted_option_size() const { inline void OneofOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* OneofOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& OneofOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& OneofOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* OneofOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& OneofOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.OneofOptions.uninterpreted_option) return uninterpreted_option_; @@ -11203,31 +13012,31 @@ inline int EnumOptions::uninterpreted_option_size() const { inline void EnumOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* EnumOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& EnumOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.EnumOptions.uninterpreted_option) return uninterpreted_option_; @@ -11275,31 +13084,31 @@ inline int EnumValueOptions::uninterpreted_option_size() const { inline void EnumValueOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* EnumValueOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumValueOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumValueOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& EnumValueOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.EnumValueOptions.uninterpreted_option) return uninterpreted_option_; @@ -11347,31 +13156,31 @@ inline int ServiceOptions::uninterpreted_option_size() const { inline void ServiceOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* ServiceOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ServiceOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& ServiceOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* ServiceOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& ServiceOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.ServiceOptions.uninterpreted_option) return uninterpreted_option_; @@ -11421,19 +13230,19 @@ inline void MethodOptions::clear_idempotency_level() { idempotency_level_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel MethodOptions::_internal_idempotency_level() const { - return static_cast< PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel >(idempotency_level_); +inline ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel MethodOptions::_internal_idempotency_level() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel >(idempotency_level_); } -inline PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel MethodOptions::idempotency_level() const { +inline ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel MethodOptions::idempotency_level() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.idempotency_level) return _internal_idempotency_level(); } -inline void MethodOptions::_internal_set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { - assert(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(value)); +inline void MethodOptions::_internal_set_idempotency_level(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { + assert(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(value)); _has_bits_[0] |= 0x00000002u; idempotency_level_ = value; } -inline void MethodOptions::set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { +inline void MethodOptions::set_idempotency_level(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value) { _internal_set_idempotency_level(value); // @@protoc_insertion_point(field_set:google.protobuf.MethodOptions.idempotency_level) } @@ -11448,31 +13257,31 @@ inline int MethodOptions::uninterpreted_option_size() const { inline void MethodOptions::clear_uninterpreted_option() { uninterpreted_option_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option) return uninterpreted_option_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >* MethodOptions::mutable_uninterpreted_option() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option) return &uninterpreted_option_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MethodOptions::_internal_uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& MethodOptions::_internal_uninterpreted_option(int index) const { return uninterpreted_option_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option) return _internal_uninterpreted_option(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::_internal_add_uninterpreted_option() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::_internal_add_uninterpreted_option() { return uninterpreted_option_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::add_uninterpreted_option() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* MethodOptions::add_uninterpreted_option() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption* _add = _internal_add_uninterpreted_option(); // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption >& MethodOptions::uninterpreted_option() const { // @@protoc_insertion_point(field_list:google.protobuf.MethodOptions.uninterpreted_option) return uninterpreted_option_; @@ -11582,31 +13391,31 @@ inline int UninterpretedOption::name_size() const { inline void UninterpretedOption::clear_name() { name_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name) return name_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >* UninterpretedOption::mutable_name() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name) return &name_; } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& UninterpretedOption::_internal_name(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& UninterpretedOption::_internal_name(int index) const { return name_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name) return _internal_name(index); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::_internal_add_name() { +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::_internal_add_name() { return name_.Add(); } -inline PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::add_name() { - PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* _add = _internal_add_name(); +inline ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* UninterpretedOption::add_name() { + ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart* _add = _internal_add_name(); // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::UninterpretedOption_NamePart >& UninterpretedOption::name() const { // @@protoc_insertion_point(field_list:google.protobuf.UninterpretedOption.name) return name_; @@ -12173,31 +13982,31 @@ inline int SourceCodeInfo::location_size() const { inline void SourceCodeInfo::clear_location() { location_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) { +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location) return location_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >* SourceCodeInfo::mutable_location() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location) return &location_; } -inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& SourceCodeInfo::_internal_location(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& SourceCodeInfo::_internal_location(int index) const { return location_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location) return _internal_location(index); } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::_internal_add_location() { +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::_internal_add_location() { return location_.Add(); } -inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::add_location() { - PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* _add = _internal_add_location(); +inline ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* SourceCodeInfo::add_location() { + ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location* _add = _internal_add_location(); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo_Location >& SourceCodeInfo::location() const { // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.location) return location_; @@ -12382,31 +14191,31 @@ inline int GeneratedCodeInfo::annotation_size() const { inline void GeneratedCodeInfo::clear_annotation() { annotation_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) return annotation_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >* GeneratedCodeInfo::mutable_annotation() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) return &annotation_; } -inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::_internal_annotation(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::_internal_annotation(int index) const { return annotation_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) return _internal_annotation(index); } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::_internal_add_annotation() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::_internal_add_annotation() { return annotation_.Add(); } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* _add = _internal_add_annotation(); +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation* _add = _internal_add_annotation(); // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo_Annotation >& GeneratedCodeInfo::annotation() const { // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation) return annotation_; @@ -12474,35 +14283,35 @@ PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type>() { - return PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type>() { + return ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label>() { - return PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label>() { + return ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode>() { - return PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode>() { + return ::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::FieldOptions_CType> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::FieldOptions_CType>() { - return PROTOBUF_NAMESPACE_ID::FieldOptions_CType_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType>() { + return ::PROTOBUF_NAMESPACE_ID::FieldOptions_CType_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::FieldOptions_JSType> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::FieldOptions_JSType>() { - return PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType>() { + return ::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel>() { - return PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel>() { + return ::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_descriptor(); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc index d9104f8a2e..33a7c9d01e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc @@ -587,10 +587,10 @@ bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol( // Optimization: The name should be the first field in the encoded message. // Try to just read it directly. - io::CodedInputStream input(static_cast<const uint8*>(encoded_file.first), + io::CodedInputStream input(static_cast<const uint8_t*>(encoded_file.first), encoded_file.second); - const uint32 kNameTag = internal::WireFormatLite::MakeTag( + const uint32_t kNameTag = internal::WireFormatLite::MakeTag( FileDescriptorProto::kNameFieldNumber, internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED); diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc index 2f02356645..2326c68ef2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc @@ -37,19 +37,20 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, seconds_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Duration, nanos_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, seconds_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, nanos_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Duration)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Duration)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Duration_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Duration_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fduration_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -150,35 +151,37 @@ const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::i if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // int32 nanos = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -218,25 +221,15 @@ size_t Duration::ByteSizeLong() const { // int64 seconds = 1; if (this->_internal_seconds() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_seconds()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_seconds()); } // int32 nanos = 2; if (this->_internal_nanos() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_nanos()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_nanos()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Duration::_class_data_ = { @@ -245,8 +238,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Duration::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Duration::GetClassData() const { return &_class_data_; } -void Duration::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Duration::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Duration *>(to)->MergeFrom( static_cast<const Duration &>(from)); } @@ -298,8 +291,8 @@ void Duration::InternalSwap(Duration* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Duration >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Duration >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Duration >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Duration >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.h b/contrib/libs/protobuf/src/google/protobuf/duration.pb.h index 7a5caa0555..4e7d6adc97 100644 --- a/contrib/libs/protobuf/src/google/protobuf/duration.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/duration.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -59,7 +59,7 @@ struct DurationDefaultTypeInternal; PROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Duration>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Duration* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Duration>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Duration final : } inline Duration& operator=(Duration&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -142,7 +146,7 @@ class PROTOBUF_EXPORT Duration final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Duration& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc index 0d79fbe571..9394521119 100644 --- a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc @@ -55,8 +55,8 @@ // // Note on memory allocation: This module often calls "operator new()" // to allocate untyped memory, rather than calling something like -// "new uint8[]". This is because "operator new()" means "Give me some -// space which I can use as I please." while "new uint8[]" means "Give +// "new uint8_t[]". This is because "operator new()" means "Give me some +// space which I can use as I please." while "new uint8_t[]" means "Give // me an array of 8-bit integers.". In practice, the later may return // a pointer that is not aligned correctly for general use. I believe // Item 8 of "More Effective C++" discusses this in more detail, though @@ -100,6 +100,14 @@ using internal::ArenaStringPtr; // =================================================================== // Some helper tables and functions... +class DynamicMessageReflectionHelper { + public: + static bool IsLazyField(const Reflection* reflection, + const FieldDescriptor* field) { + return reflection->IsLazyField(field); + } +}; + namespace { bool IsMapFieldInApi(const FieldDescriptor* field) { return field->is_map(); } @@ -132,13 +140,13 @@ int FieldSpaceUsed(const FieldDescriptor* field) { if (field->label() == FD::LABEL_REPEATED) { switch (field->cpp_type()) { case FD::CPPTYPE_INT32: - return sizeof(RepeatedField<int32>); + return sizeof(RepeatedField<int32_t>); case FD::CPPTYPE_INT64: - return sizeof(RepeatedField<int64>); + return sizeof(RepeatedField<int64_t>); case FD::CPPTYPE_UINT32: - return sizeof(RepeatedField<uint32>); + return sizeof(RepeatedField<uint32_t>); case FD::CPPTYPE_UINT64: - return sizeof(RepeatedField<uint64>); + return sizeof(RepeatedField<uint64_t>); case FD::CPPTYPE_DOUBLE: return sizeof(RepeatedField<double>); case FD::CPPTYPE_FLOAT: @@ -165,13 +173,13 @@ int FieldSpaceUsed(const FieldDescriptor* field) { } else { switch (field->cpp_type()) { case FD::CPPTYPE_INT32: - return sizeof(int32); + return sizeof(int32_t); case FD::CPPTYPE_INT64: - return sizeof(int64); + return sizeof(int64_t); case FD::CPPTYPE_UINT32: - return sizeof(uint32); + return sizeof(uint32_t); case FD::CPPTYPE_UINT64: - return sizeof(uint64); + return sizeof(uint64_t); case FD::CPPTYPE_DOUBLE: return sizeof(double); case FD::CPPTYPE_FLOAT: @@ -200,8 +208,8 @@ int FieldSpaceUsed(const FieldDescriptor* field) { inline int DivideRoundingUp(int i, int j) { return (i + (j - 1)) / j; } -static const int kSafeAlignment = sizeof(uint64); -static const int kMaxOneofUnionSize = sizeof(uint64); +static const int kSafeAlignment = sizeof(uint64_t); +static const int kMaxOneofUnionSize = sizeof(uint64_t); inline int AlignTo(int offset, int alignment) { return DivideRoundingUp(offset, alignment) * alignment; @@ -270,13 +278,26 @@ class DynamicMessage : public Message { bool is_prototype() const; + inline int OffsetValue(int v, FieldDescriptor::Type type) const { + if (type == FieldDescriptor::TYPE_MESSAGE) { + return v & ~0x1u; + } + return v; + } + inline void* OffsetToPointer(int offset) { - return reinterpret_cast<uint8*>(this) + offset; + return reinterpret_cast<uint8_t*>(this) + offset; } inline const void* OffsetToPointer(int offset) const { - return reinterpret_cast<const uint8*>(this) + offset; + return reinterpret_cast<const uint8_t*>(this) + offset; } + void* MutableRaw(int i); + void* MutableExtensionsRaw(); + void* MutableWeakFieldMapRaw(); + void* MutableOneofCaseRaw(int i); + void* MutableOneofFieldRaw(const FieldDescriptor* f); + const DynamicMessageFactory::TypeInfo* type_info_; mutable std::atomic<int> cached_byte_size_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DynamicMessage); @@ -295,8 +316,8 @@ struct DynamicMessageFactory::TypeInfo { // Warning: The order in which the following pointers are defined is // important (the prototype must be deleted *before* the offsets). - std::unique_ptr<uint32[]> offsets; - std::unique_ptr<uint32[]> has_bits_indices; + std::unique_ptr<uint32_t[]> offsets; + std::unique_ptr<uint32_t[]> has_bits_indices; std::unique_ptr<const Reflection> reflection; // Don't use a unique_ptr to hold the prototype: the destructor for // DynamicMessage needs to know whether it is the prototype, and does so by @@ -325,7 +346,7 @@ DynamicMessage::DynamicMessage(DynamicMessageFactory::TypeInfo* type_info, bool lock_factory) : type_info_(type_info), cached_byte_size_(0) { // The prototype in type_info has to be set before creating the prototype - // instance on memory. e.g., message Foo { map<int32, Foo> a = 1; }. When + // instance on memory. e.g., message Foo { map<int32_t, Foo> a = 1; }. When // creating prototype for Foo, prototype of the map entry will also be // created, which needs the address of the prototype of Foo (the value in // map). To break the cyclic dependency, we have to assign the address of @@ -334,6 +355,26 @@ DynamicMessage::DynamicMessage(DynamicMessageFactory::TypeInfo* type_info, SharedCtor(lock_factory); } +inline void* DynamicMessage::MutableRaw(int i) { + return OffsetToPointer( + OffsetValue(type_info_->offsets[i], type_info_->type->field(i)->type())); +} +void* DynamicMessage::MutableExtensionsRaw() { + return OffsetToPointer(type_info_->extensions_offset); +} +void* DynamicMessage::MutableWeakFieldMapRaw() { + return OffsetToPointer(type_info_->weak_field_map_offset); +} +void* DynamicMessage::MutableOneofCaseRaw(int i) { + return OffsetToPointer(type_info_->oneof_case_offset + sizeof(uint32_t) * i); +} +void* DynamicMessage::MutableOneofFieldRaw(const FieldDescriptor* f) { + return OffsetToPointer( + OffsetValue(type_info_->offsets[type_info_->type->field_count() + + f->containing_oneof()->index()], + f->type())); +} + void DynamicMessage::SharedCtor(bool lock_factory) { // We need to call constructors for various fields manually and set // default values where appropriate. We use placement new to call @@ -349,17 +390,15 @@ void DynamicMessage::SharedCtor(bool lock_factory) { int oneof_count = 0; for (int i = 0; i < descriptor->oneof_decl_count(); ++i) { if (descriptor->oneof_decl(i)->is_synthetic()) continue; - new (OffsetToPointer(type_info_->oneof_case_offset + - sizeof(uint32) * oneof_count++)) uint32(0); + new (MutableOneofCaseRaw(oneof_count++)) uint32_t{0}; } if (type_info_->extensions_offset != -1) { - new (OffsetToPointer(type_info_->extensions_offset)) - ExtensionSet(GetArenaForAllocation()); + new (MutableExtensionsRaw()) ExtensionSet(GetArenaForAllocation()); } for (int i = 0; i < descriptor->field_count(); i++) { const FieldDescriptor* field = descriptor->field(i); - void* field_ptr = OffsetToPointer(type_info_->offsets[i]); + void* field_ptr = MutableRaw(i); if (InRealOneof(field)) { continue; } @@ -373,10 +412,10 @@ void DynamicMessage::SharedCtor(bool lock_factory) { } \ break; - HANDLE_TYPE(INT32, int32); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -384,7 +423,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) { case FieldDescriptor::CPPTYPE_ENUM: if (!field->is_repeated()) { - new (field_ptr) int(field->default_value_enum()->number()); + new (field_ptr) int{field->default_value_enum()->number()}; } else { new (field_ptr) RepeatedField<int>(GetArenaForAllocation()); } @@ -480,9 +519,7 @@ DynamicMessage::~DynamicMessage() { _internal_metadata_.Delete<UnknownFieldSet>(); if (type_info_->extensions_offset != -1) { - reinterpret_cast<ExtensionSet*>( - OffsetToPointer(type_info_->extensions_offset)) - ->~ExtensionSet(); + reinterpret_cast<ExtensionSet*>(MutableExtensionsRaw())->~ExtensionSet(); } // We need to manually run the destructors for repeated fields and strings, @@ -496,13 +533,9 @@ DynamicMessage::~DynamicMessage() { for (int i = 0; i < descriptor->field_count(); i++) { const FieldDescriptor* field = descriptor->field(i); if (InRealOneof(field)) { - void* field_ptr = - OffsetToPointer(type_info_->oneof_case_offset + - sizeof(uint32) * field->containing_oneof()->index()); - if (*(reinterpret_cast<const int32*>(field_ptr)) == field->number()) { - field_ptr = OffsetToPointer( - type_info_->offsets[descriptor->field_count() + - field->containing_oneof()->index()]); + void* field_ptr = MutableOneofCaseRaw(field->containing_oneof()->index()); + if (*(reinterpret_cast<const int32_t*>(field_ptr)) == field->number()) { + field_ptr = MutableOneofFieldRaw(field); if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { switch (field->options().ctype()) { default: @@ -523,7 +556,7 @@ DynamicMessage::~DynamicMessage() { } continue; } - void* field_ptr = OffsetToPointer(type_info_->offsets[i]); + void* field_ptr = MutableRaw(i); if (field->is_repeated()) { switch (field->cpp_type()) { @@ -533,10 +566,10 @@ DynamicMessage::~DynamicMessage() { ->~RepeatedField<LOWERCASE>(); \ break - HANDLE_TYPE(INT32, int32); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); @@ -598,10 +631,10 @@ void DynamicMessage::CrossLinkPrototypes() { // Cross-link default messages. for (int i = 0; i < descriptor->field_count(); i++) { const FieldDescriptor* field = descriptor->field(i); - void* field_ptr = OffsetToPointer(type_info_->offsets[i]); if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && !field->options().weak() && !InRealOneof(field) && !field->is_repeated()) { + void* field_ptr = MutableRaw(i); // For fields with message types, we need to cross-link with the // prototype for the field's type. // For singular fields, the field is just a pointer which should @@ -695,7 +728,7 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( } // Compute size and offsets. - uint32* offsets = new uint32[type->field_count() + real_oneof_count]; + uint32_t* offsets = new uint32_t[type->field_count() + real_oneof_count]; type_info->offsets.reset(offsets); // Decide all field offsets by packing in order. @@ -713,10 +746,10 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( // At least one field in the message requires a hasbit, so allocate // hasbits. type_info->has_bits_offset = size; - uint32* has_bits_indices = new uint32[type->field_count()]; + uint32_t* has_bits_indices = new uint32_t[type->field_count()]; for (int i = 0; i < type->field_count(); i++) { // Initialize to -1, fields that need a hasbit will overwrite. - has_bits_indices[i] = static_cast<uint32>(-1); + has_bits_indices[i] = static_cast<uint32_t>(-1); } type_info->has_bits_indices.reset(has_bits_indices); } @@ -725,15 +758,15 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( } if (max_hasbit > 0) { - int has_bits_array_size = DivideRoundingUp(max_hasbit, bitsizeof(uint32)); - size += has_bits_array_size * sizeof(uint32); + int has_bits_array_size = DivideRoundingUp(max_hasbit, bitsizeof(uint32_t)); + size += has_bits_array_size * sizeof(uint32_t); size = AlignOffset(size); } // The oneof_case, if any. It is an array of uint32s. if (real_oneof_count > 0) { type_info->oneof_case_offset = size; - size += real_oneof_count * sizeof(uint32); + size += real_oneof_count * sizeof(uint32_t); size = AlignOffset(size); } @@ -810,7 +843,9 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( type_info->extensions_offset, type_info->oneof_case_offset, type_info->size, - type_info->weak_field_map_offset}; + type_info->weak_field_map_offset, + nullptr /* inlined_string_indices_ */, + 0 /* inlined_string_donated_offset_ */}; type_info->reflection.reset( new Reflection(type_info->type, schema, type_info->pool, this)); diff --git a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h index b25f8ca0ff..2b5130d2b6 100644 --- a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h +++ b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.h @@ -182,23 +182,23 @@ class PROTOBUF_EXPORT DynamicMapSorter { return first < second; } case FieldDescriptor::CPPTYPE_INT32: { - int32 first = reflection->GetInt32(*a, field_); - int32 second = reflection->GetInt32(*b, field_); + int32_t first = reflection->GetInt32(*a, field_); + int32_t second = reflection->GetInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_INT64: { - int64 first = reflection->GetInt64(*a, field_); - int64 second = reflection->GetInt64(*b, field_); + int64_t first = reflection->GetInt64(*a, field_); + int64_t second = reflection->GetInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT32: { - uint32 first = reflection->GetUInt32(*a, field_); - uint32 second = reflection->GetUInt32(*b, field_); + uint32_t first = reflection->GetUInt32(*a, field_); + uint32_t second = reflection->GetUInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT64: { - uint64 first = reflection->GetUInt64(*a, field_); - uint64 second = reflection->GetUInt64(*b, field_); + uint64_t first = reflection->GetUInt64(*a, field_); + uint64_t second = reflection->GetUInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_STRING: { diff --git a/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc b/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc index 96ee74a8e2..f773af10fb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc @@ -35,17 +35,18 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Empty, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Empty, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Empty)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Empty)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Empty_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Empty_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fempty_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -78,144 +79,30 @@ class Empty::_Internal { Empty::Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) - : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { - SharedCtor(); - if (!is_message_owned) { - RegisterArenaDtor(arena); - } + : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase(arena, is_message_owned) { // @@protoc_insertion_point(arena_constructor:google.protobuf.Empty) } Empty::Empty(const Empty& from) - : ::PROTOBUF_NAMESPACE_ID::Message() { + : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); // @@protoc_insertion_point(copy_constructor:google.protobuf.Empty) } -void Empty::SharedCtor() { -} - -Empty::~Empty() { - // @@protoc_insertion_point(destructor:google.protobuf.Empty) - if (GetArenaForAllocation() != nullptr) return; - SharedDtor(); - _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} - -inline void Empty::SharedDtor() { - GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); -} - -void Empty::ArenaDtor(void* object) { - Empty* _this = reinterpret_cast< Empty* >(object); - (void)_this; -} -void Empty::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { -} -void Empty::SetCachedSize(int size) const { - _cached_size_.Set(size); -} - -void Empty::Clear() { -// @@protoc_insertion_point(message_clear_start:google.protobuf.Empty) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); -} -const char* Empty::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { -#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure - while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; - ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } // while -success: - return ptr; -failure: - ptr = nullptr; - goto success; -#undef CHK_ -} -::PROTOBUF_NAMESPACE_ID::uint8* Empty::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { - // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Empty) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( - _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Empty) - return target; -} -size_t Empty::ByteSizeLong() const { -// @@protoc_insertion_point(message_byte_size_start:google.protobuf.Empty) - size_t total_size = 0; - - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; -} const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Empty::_class_data_ = { - ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, - Empty::MergeImpl + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl, + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl, }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Empty::GetClassData() const { return &_class_data_; } -void Empty::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { - static_cast<Empty *>(to)->MergeFrom( - static_cast<const Empty &>(from)); -} -void Empty::MergeFrom(const Empty& from) { -// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Empty) - GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; - (void) cached_has_bits; - _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); -} -void Empty::CopyFrom(const Empty& from) { -// @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Empty) - if (&from == this) return; - Clear(); - MergeFrom(from); -} -bool Empty::IsInitialized() const { - return true; -} - -void Empty::InternalSwap(Empty* other) { - using std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); -} ::PROTOBUF_NAMESPACE_ID::Metadata Empty::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( @@ -226,8 +113,8 @@ void Empty::InternalSwap(Empty* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Empty >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Empty >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Empty >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Empty >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/empty.pb.h b/contrib/libs/protobuf/src/google/protobuf/empty.pb.h index 64a3bdeda3..637ddf4d65 100644 --- a/contrib/libs/protobuf/src/google/protobuf/empty.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/empty.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -23,6 +23,7 @@ #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_bases.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/metadata_lite.h> @@ -59,17 +60,16 @@ struct EmptyDefaultTypeInternal; PROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Empty>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Empty* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Empty>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN // =================================================================== class PROTOBUF_EXPORT Empty final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ { + public ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ { public: inline Empty() : Empty(nullptr) {} - ~Empty() override; explicit constexpr Empty(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); Empty(const Empty& from); @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Empty final : } inline Empty& operator=(Empty&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -137,27 +141,15 @@ class PROTOBUF_EXPORT Empty final : Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { return CreateMaybeMessage<Empty>(arena); } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Empty& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom(const Empty& from); - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyFrom; + inline void CopyFrom(const Empty& from) { + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl(this, from); + } + using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeFrom; + void MergeFrom(const Empty& from) { + ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(this, from); + } public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _cached_size_.Get(); } - - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(Empty* other); friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Empty"; @@ -166,8 +158,6 @@ class PROTOBUF_EXPORT Empty final : explicit Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); private: - static void ArenaDtor(void* object); - inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); public: static const ClassData _class_data_; diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.cc b/contrib/libs/protobuf/src/google/protobuf/extension_set.cc index 431b74de37..c6de79a767 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.cc +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.cc @@ -35,21 +35,24 @@ #include <google/protobuf/extension_set.h> #include <tuple> -#include <unordered_map> +#include <unordered_set> #include <utility> + #include <google/protobuf/stubs/common.h> #include <google/protobuf/extension_set_inl.h> #include <google/protobuf/parse_context.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h> +#include <google/protobuf/arena.h> #include <google/protobuf/message_lite.h> #include <google/protobuf/metadata_lite.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/stubs/map_util.h> #include <google/protobuf/stubs/hash.h> -#include <google/protobuf/port_def.inc> - +// clang-format off +#include <google/protobuf/port_def.inc> // must be last. +// clang-format on namespace google { namespace protobuf { namespace internal { @@ -84,39 +87,53 @@ inline bool is_packable(WireFormatLite::WireType type) { } // Registry stuff. + +// Note that we cannot use hetererogeneous lookup for std containers since we +// need to support C++11. +struct ExtensionEq { + bool operator()(const ExtensionInfo& lhs, const ExtensionInfo& rhs) const { + return lhs.message == rhs.message && lhs.number == rhs.number; + } +}; + struct ExtensionHasher { - std::size_t operator()(const std::pair<const MessageLite*, int>& p) const { - return std::hash<const MessageLite*>{}(p.first) ^ - std::hash<int>{}(p.second); + std::size_t operator()(const ExtensionInfo& info) const { + return std::hash<const MessageLite*>{}(info.message) ^ + std::hash<int>{}(info.number); } }; -typedef std::unordered_map<std::pair<const MessageLite*, int>, ExtensionInfo, - ExtensionHasher> - ExtensionRegistry; +using ExtensionRegistry = + std::unordered_set<ExtensionInfo, ExtensionHasher, ExtensionEq>; static const ExtensionRegistry* global_registry = nullptr; // This function is only called at startup, so there is no need for thread- // safety. -void Register(const MessageLite* containing_type, int number, - ExtensionInfo info) { +void Register(const ExtensionInfo& info) { static auto local_static_registry = OnShutdownDelete(new ExtensionRegistry); global_registry = local_static_registry; - if (!InsertIfNotPresent(local_static_registry, - std::make_pair(containing_type, number), info)) { + if (!InsertIfNotPresent(local_static_registry, info)) { GOOGLE_LOG(FATAL) << "Multiple extension registrations for type \"" - << containing_type->GetTypeName() << "\", field number " - << number << "."; + << info.message->GetTypeName() << "\", field number " + << info.number << "."; } } -const ExtensionInfo* FindRegisteredExtension(const MessageLite* containing_type, +const ExtensionInfo* FindRegisteredExtension(const MessageLite* extendee, int number) { - return global_registry == nullptr - ? nullptr - : FindOrNull(*global_registry, - std::make_pair(containing_type, number)); + if (!global_registry) return nullptr; + + ExtensionInfo info; + info.message = extendee; + info.number = number; + + auto it = global_registry->find(info); + if (it == global_registry->end()) { + return nullptr; + } else { + return &*it; + } } } // namespace @@ -124,8 +141,7 @@ const ExtensionInfo* FindRegisteredExtension(const MessageLite* containing_type, ExtensionFinder::~ExtensionFinder() {} bool GeneratedExtensionFinder::Find(int number, ExtensionInfo* output) { - const ExtensionInfo* extension = - FindRegisteredExtension(containing_type_, number); + const ExtensionInfo* extension = FindRegisteredExtension(extendee_, number); if (extension == NULL) { return false; } else { @@ -134,14 +150,14 @@ bool GeneratedExtensionFinder::Find(int number, ExtensionInfo* output) { } } -void ExtensionSet::RegisterExtension(const MessageLite* containing_type, - int number, FieldType type, - bool is_repeated, bool is_packed) { +void ExtensionSet::RegisterExtension(const MessageLite* extendee, int number, + FieldType type, bool is_repeated, + bool is_packed) { GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_ENUM); GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_MESSAGE); GOOGLE_CHECK_NE(type, WireFormatLite::TYPE_GROUP); - ExtensionInfo info(type, is_repeated, is_packed); - Register(containing_type, number, info); + ExtensionInfo info(extendee, number, type, is_repeated, is_packed); + Register(info); } static bool CallNoArgValidityFunc(const void* arg, int number) { @@ -157,27 +173,27 @@ static bool CallNoArgValidityFunc(const void* arg, int number) { return ((EnumValidityFunc*)arg)(number); } -void ExtensionSet::RegisterEnumExtension(const MessageLite* containing_type, +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); - ExtensionInfo info(type, is_repeated, is_packed); + ExtensionInfo info(extendee, number, type, is_repeated, is_packed); info.enum_validity_check.func = CallNoArgValidityFunc; // See comment in CallNoArgValidityFunc() about why we use a c-style cast. info.enum_validity_check.arg = (void*)is_valid; - Register(containing_type, number, info); + Register(info); } -void ExtensionSet::RegisterMessageExtension(const MessageLite* containing_type, +void ExtensionSet::RegisterMessageExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, bool is_packed, const MessageLite* prototype) { GOOGLE_CHECK(type == WireFormatLite::TYPE_MESSAGE || type == WireFormatLite::TYPE_GROUP); - ExtensionInfo info(type, is_repeated, is_packed); + ExtensionInfo info(extendee, number, type, is_repeated, is_packed); info.message_info = {prototype}; - Register(containing_type, number, info); + Register(info); } // =================================================================== @@ -204,7 +220,7 @@ ExtensionSet::~ExtensionSet() { } void ExtensionSet::DeleteFlatMap(const ExtensionSet::KeyValue* flat, - uint16 flat_capacity) { + uint16_t flat_capacity) { #ifdef __cpp_sized_deallocation // Arena::CreateArray already requires a trivially destructible type, but // ensure this constraint is not violated in the future. @@ -220,7 +236,7 @@ void ExtensionSet::DeleteFlatMap(const ExtensionSet::KeyValue* flat, } // Defined in extension_set_heavy.cc. -// void ExtensionSet::AppendToList(const Descriptor* containing_type, +// void ExtensionSet::AppendToList(const Descriptor* extendee, // const DescriptorPool* pool, // vector<const FieldDescriptor*>* output) const @@ -293,6 +309,17 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; } \ } \ \ + const LOWERCASE& ExtensionSet::GetRef##CAMELCASE( \ + int number, const LOWERCASE& default_value) const { \ + const Extension* extension = FindOrNull(number); \ + if (extension == NULL || extension->is_cleared) { \ + return default_value; \ + } else { \ + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ + return extension->LOWERCASE##_value; \ + } \ + } \ + \ void ExtensionSet::Set##CAMELCASE(int number, FieldType type, \ LOWERCASE value, \ const FieldDescriptor* descriptor) { \ @@ -317,6 +344,14 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; 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 != NULL) << "Index out-of-bounds (field is empty)."; \ + GOOGLE_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); \ @@ -344,9 +379,9 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; extension->repeated_##LOWERCASE##_value->Add(value); \ } -PRIMITIVE_ACCESSORS(INT32, int32, Int32) +PRIMITIVE_ACCESSORS(INT32, int32_t, Int32) PRIMITIVE_ACCESSORS(INT64, int64, Int64) -PRIMITIVE_ACCESSORS(UINT32, uint32, UInt32) +PRIMITIVE_ACCESSORS(UINT32, uint32_t, UInt32) PRIMITIVE_ACCESSORS(UINT64, uint64, UInt64) PRIMITIVE_ACCESSORS(FLOAT, float, Float) PRIMITIVE_ACCESSORS(DOUBLE, double, Double) @@ -362,7 +397,7 @@ const void* ExtensionSet::GetRawRepeatedField(int number, } // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. - return extension->repeated_int32_value; + return extension->repeated_int32_t_value; } void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, @@ -380,16 +415,16 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, switch (WireFormatLite::FieldTypeToCppType( static_cast<WireFormatLite::FieldType>(field_type))) { case WireFormatLite::CPPTYPE_INT32: - extension->repeated_int32_value = - Arena::CreateMessage<RepeatedField<int32>>(arena_); + extension->repeated_int32_t_value = + Arena::CreateMessage<RepeatedField<int32_t>>(arena_); break; case WireFormatLite::CPPTYPE_INT64: extension->repeated_int64_value = Arena::CreateMessage<RepeatedField<int64>>(arena_); break; case WireFormatLite::CPPTYPE_UINT32: - extension->repeated_uint32_value = - Arena::CreateMessage<RepeatedField<uint32>>(arena_); + extension->repeated_uint32_t_value = + Arena::CreateMessage<RepeatedField<uint32_t>>(arena_); break; case WireFormatLite::CPPTYPE_UINT64: extension->repeated_uint64_value = @@ -424,7 +459,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. - return extension->repeated_int32_value; + return extension->repeated_int32_t_value; } // Compatible version using old call signature. Does not create extensions when @@ -434,7 +469,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number) { GOOGLE_CHECK(extension != NULL) << "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_value; + return extension->repeated_int32_t_value; } // ------------------------------------------------------------------- @@ -451,6 +486,18 @@ int ExtensionSet::GetEnum(int number, int default_value) const { } } +const int& ExtensionSet::GetRefEnum(int number, + const int& default_value) const { + const Extension* extension = FindOrNull(number); + if (extension == nullptr || extension->is_cleared) { + // Not present. Return the default value. + return default_value; + } else { + GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, ENUM); + return extension->enum_value; + } +} + void ExtensionSet::SetEnum(int number, FieldType type, int value, const FieldDescriptor* descriptor) { Extension* extension; @@ -467,14 +514,21 @@ 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 != NULL) << "Index out-of-bounds (field is empty)."; + GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; + GOOGLE_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); return extension->repeated_enum_value->Get(index); } void ExtensionSet::SetRepeatedEnum(int number, int index, int value) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty)."; + GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, ENUM); extension->repeated_enum_value->Set(index, value); } @@ -597,7 +651,7 @@ MessageLite* ExtensionSet::MutableMessage(int number, FieldType type, GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); extension->is_cleared = false; if (extension->is_lazy) { - return extension->lazymessage_value->MutableMessage(prototype); + return extension->lazymessage_value->MutableMessage(prototype, arena_); } else { return extension->message_value; } @@ -616,10 +670,8 @@ void ExtensionSet::SetAllocatedMessage(int number, FieldType type, ClearExtension(number); return; } -#ifdef PROTOBUF_INTERNAL_USE_MUST_USE_RESULT GOOGLE_DCHECK(message->GetOwningArena() == nullptr || message->GetOwningArena() == arena_); -#endif // PROTOBUF_INTERNAL_USE_MUST_USE_RESULT Arena* message_arena = message->GetOwningArena(); Extension* extension; if (MaybeNewExtension(number, descriptor, &extension)) { @@ -796,13 +848,13 @@ void ExtensionSet::RemoveLast(int number) { switch (cpp_type(extension->type)) { case WireFormatLite::CPPTYPE_INT32: - extension->repeated_int32_value->RemoveLast(); + extension->repeated_int32_t_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_INT64: extension->repeated_int64_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_UINT32: - extension->repeated_uint32_value->RemoveLast(); + extension->repeated_uint32_t_value->RemoveLast(); break; case WireFormatLite::CPPTYPE_UINT64: extension->repeated_uint64_value->RemoveLast(); @@ -836,6 +888,14 @@ MessageLite* ExtensionSet::ReleaseLast(int number) { 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); + return extension->repeated_message_value->UnsafeArenaReleaseLast(); +} + void ExtensionSet::SwapElements(int number, int index1, int index2) { Extension* extension = FindOrNull(number); GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty)."; @@ -843,13 +903,13 @@ void ExtensionSet::SwapElements(int number, int index1, int index2) { switch (cpp_type(extension->type)) { case WireFormatLite::CPPTYPE_INT32: - extension->repeated_int32_value->SwapElements(index1, index2); + extension->repeated_int32_t_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_INT64: extension->repeated_int64_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_UINT32: - extension->repeated_uint32_value->SwapElements(index1, index2); + extension->repeated_uint32_t_value->SwapElements(index1, index2); break; case WireFormatLite::CPPTYPE_UINT64: extension->repeated_uint64_value->SwapElements(index1, index2); @@ -947,9 +1007,9 @@ void ExtensionSet::InternalExtensionMergeFrom( *other_extension.repeated_##LOWERCASE##_value); \ break; - HANDLE_TYPE(INT32, int32, RepeatedField<int32>); + HANDLE_TYPE(INT32, int32_t, RepeatedField<int32_t>); HANDLE_TYPE(INT64, int64, RepeatedField<int64>); - HANDLE_TYPE(UINT32, uint32, RepeatedField<uint32>); + HANDLE_TYPE(UINT32, uint32_t, RepeatedField<uint32_t>); HANDLE_TYPE(UINT64, uint64, RepeatedField<uint64>); HANDLE_TYPE(FLOAT, float, RepeatedField<float>); HANDLE_TYPE(DOUBLE, double, RepeatedField<double>); @@ -991,9 +1051,9 @@ void ExtensionSet::InternalExtensionMergeFrom( other_extension.descriptor); \ break; - HANDLE_TYPE(INT32, int32, Int32); + HANDLE_TYPE(INT32, int32_t, Int32); HANDLE_TYPE(INT64, int64, Int64); - HANDLE_TYPE(UINT32, uint32, UInt32); + HANDLE_TYPE(UINT32, uint32_t, UInt32); HANDLE_TYPE(UINT64, uint64, UInt64); HANDLE_TYPE(FLOAT, float, Float); HANDLE_TYPE(DOUBLE, double, Double); @@ -1017,7 +1077,7 @@ void ExtensionSet::InternalExtensionMergeFrom( extension->lazymessage_value = other_extension.lazymessage_value->New(arena_); extension->lazymessage_value->MergeFrom( - *other_extension.lazymessage_value); + *other_extension.lazymessage_value, arena_); } else { extension->is_lazy = false; extension->message_value = @@ -1032,7 +1092,7 @@ void ExtensionSet::InternalExtensionMergeFrom( if (other_extension.is_lazy) { if (extension->is_lazy) { extension->lazymessage_value->MergeFrom( - *other_extension.lazymessage_value); + *other_extension.lazymessage_value, arena_); } else { extension->message_value->CheckTypeAndMergeFrom( other_extension.lazymessage_value->GetMessage( @@ -1041,7 +1101,7 @@ void ExtensionSet::InternalExtensionMergeFrom( } else { if (extension->is_lazy) { extension->lazymessage_value - ->MutableMessage(*other_extension.message_value) + ->MutableMessage(*other_extension.message_value, arena_) ->CheckTypeAndMergeFrom(*other_extension.message_value); } else { extension->message_value->CheckTypeAndMergeFrom( @@ -1158,7 +1218,7 @@ bool ExtensionSet::IsInitialized() const { return true; } -bool ExtensionSet::FindExtensionInfoFromTag(uint32 tag, +bool ExtensionSet::FindExtensionInfoFromTag(uint32_t tag, ExtensionFinder* extension_finder, int* field_number, ExtensionInfo* extension, @@ -1172,7 +1232,7 @@ bool ExtensionSet::FindExtensionInfoFromTag(uint32 tag, bool ExtensionSet::FindExtensionInfoFromFieldNumber( int wire_type, int field_number, ExtensionFinder* extension_finder, - ExtensionInfo* extension, bool* was_packed_on_wire) { + ExtensionInfo* extension, bool* was_packed_on_wire) const { if (!extension_finder->Find(field_number, extension)) { return false; } @@ -1192,7 +1252,7 @@ bool ExtensionSet::FindExtensionInfoFromFieldNumber( return expected_wire_type == wire_type; } -bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, +bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, ExtensionFinder* extension_finder, FieldSkipper* field_skipper) { int number; @@ -1207,11 +1267,11 @@ bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, } } -const char* ExtensionSet::ParseField(uint64 tag, const char* ptr, - const MessageLite* containing_type, +const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, + const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { - GeneratedExtensionFinder finder(containing_type); + GeneratedExtensionFinder finder(extendee); int number = tag >> 3; bool was_packed_on_wire; ExtensionInfo extension; @@ -1225,9 +1285,9 @@ const char* ExtensionSet::ParseField(uint64 tag, const char* ptr, } const char* ExtensionSet::ParseMessageSetItem( - const char* ptr, const MessageLite* containing_type, + const char* ptr, const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { - return ParseMessageSetItemTmpl<MessageLite, TProtoStringType>(ptr, containing_type, + return ParseMessageSetItemTmpl<MessageLite, TProtoStringType>(ptr, extendee, metadata, ctx); } @@ -1239,7 +1299,7 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, // Explicitly not read extension.is_packed, instead check whether the field // was encoded in packed form on the wire. if (was_packed_on_wire) { - uint32 size; + uint32_t size; if (!input->ReadVarint32(&size)) return false; io::CodedInputStream::Limit limit = input->PushLimit(size); @@ -1257,15 +1317,15 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, } \ break - HANDLE_TYPE(INT32, Int32, int32); + HANDLE_TYPE(INT32, Int32, int32_t); HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32); + HANDLE_TYPE(UINT32, UInt32, uint32_t); HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, Int32, int32); + HANDLE_TYPE(SINT32, Int32, int32_t); HANDLE_TYPE(SINT64, Int64, int64); - HANDLE_TYPE(FIXED32, UInt32, uint32); + HANDLE_TYPE(FIXED32, UInt32, uint32_t); HANDLE_TYPE(FIXED64, UInt64, uint64); - HANDLE_TYPE(SFIXED32, Int32, int32); + HANDLE_TYPE(SFIXED32, Int32, int32_t); HANDLE_TYPE(SFIXED64, Int64, int64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); @@ -1316,15 +1376,15 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, } \ } break - HANDLE_TYPE(INT32, Int32, int32); + HANDLE_TYPE(INT32, Int32, int32_t); HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32); + HANDLE_TYPE(UINT32, UInt32, uint32_t); HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, Int32, int32); + HANDLE_TYPE(SINT32, Int32, int32_t); HANDLE_TYPE(SINT64, Int64, int64); - HANDLE_TYPE(FIXED32, UInt32, uint32); + HANDLE_TYPE(FIXED32, UInt32, uint32_t); HANDLE_TYPE(FIXED64, UInt64, uint64); - HANDLE_TYPE(SFIXED32, Int32, int32); + HANDLE_TYPE(SFIXED32, Int32, int32_t); HANDLE_TYPE(SFIXED64, Int64, int64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); @@ -1404,18 +1464,18 @@ bool ExtensionSet::ParseFieldWithExtensionInfo(int number, return true; } -bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, - const MessageLite* containing_type) { +bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, + const MessageLite* extendee) { FieldSkipper skipper; - GeneratedExtensionFinder finder(containing_type); + GeneratedExtensionFinder finder(extendee); return ParseField(tag, input, &finder, &skipper); } -bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, - const MessageLite* containing_type, +bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, + const MessageLite* extendee, io::CodedOutputStream* unknown_fields) { CodedOutputStreamFieldSkipper skipper(unknown_fields); - GeneratedExtensionFinder finder(containing_type); + GeneratedExtensionFinder finder(extendee); return ParseField(tag, input, &finder, &skipper); } @@ -1423,7 +1483,7 @@ bool ExtensionSet::ParseMessageSetLite(io::CodedInputStream* input, ExtensionFinder* extension_finder, FieldSkipper* field_skipper) { while (true) { - const uint32 tag = input->ReadTag(); + const uint32_t tag = input->ReadTag(); switch (tag) { case 0: return true; @@ -1451,7 +1511,7 @@ bool ExtensionSet::ParseMessageSetItemLite(io::CodedInputStream* input, extension_finder, field_skipper); } - bool SkipField(uint32 tag, io::CodedInputStream* input) { + bool SkipField(uint32_t tag, io::CodedInputStream* input) { return field_skipper->SkipField(input, tag); } @@ -1465,24 +1525,24 @@ bool ExtensionSet::ParseMessageSetItemLite(io::CodedInputStream* input, } bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, - const MessageLite* containing_type, + const MessageLite* extendee, TProtoStringType* unknown_fields) { io::StringOutputStream zcis(unknown_fields); io::CodedOutputStream output(&zcis); CodedOutputStreamFieldSkipper skipper(&output); - GeneratedExtensionFinder finder(containing_type); + GeneratedExtensionFinder finder(extendee); return ParseMessageSetLite(input, &finder, &skipper); } -uint8* ExtensionSet::_InternalSerializeImpl( - int start_field_number, int end_field_number, uint8* target, - io::EpsCopyOutputStream* stream) const { +uint8_t* ExtensionSet::_InternalSerializeImpl( + const MessageLite* extendee, int start_field_number, int end_field_number, + uint8_t* target, io::EpsCopyOutputStream* stream) const { if (PROTOBUF_PREDICT_FALSE(is_large())) { const auto& end = map_.large->end(); for (auto it = map_.large->lower_bound(start_field_number); it != end && it->first < end_field_number; ++it) { target = it->second.InternalSerializeFieldWithCachedSizesToArray( - it->first, target, stream); + extendee, this, it->first, target, stream); } return target; } @@ -1491,16 +1551,19 @@ uint8* ExtensionSet::_InternalSerializeImpl( flat_begin(), end, start_field_number, KeyValue::FirstComparator()); it != end && it->first < end_field_number; ++it) { target = it->second.InternalSerializeFieldWithCachedSizesToArray( - it->first, target, stream); + extendee, this, it->first, target, stream); } return target; } -uint8* ExtensionSet::InternalSerializeMessageSetWithCachedSizesToArray( - uint8* target, io::EpsCopyOutputStream* stream) const { - ForEach([&target, stream](int number, const Extension& ext) { +uint8_t* ExtensionSet::InternalSerializeMessageSetWithCachedSizesToArray( + const MessageLite* extendee, uint8_t* target, + io::EpsCopyOutputStream* stream) const { + const ExtensionSet* extension_set = this; + ForEach([&target, extendee, stream, extension_set](int number, + const Extension& ext) { target = ext.InternalSerializeMessageSetItemWithCachedSizesToArray( - number, target, stream); + extendee, extension_set, number, target, stream); }); return target; } @@ -1536,9 +1599,9 @@ void ExtensionSet::Extension::Clear() { repeated_##LOWERCASE##_value->Clear(); \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); @@ -1587,11 +1650,11 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { } \ break - HANDLE_TYPE(INT32, Int32, int32); + HANDLE_TYPE(INT32, Int32, int32_t); HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32); + HANDLE_TYPE(UINT32, UInt32, uint32_t); HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32); + HANDLE_TYPE(SINT32, SInt32, int32_t); HANDLE_TYPE(SINT64, SInt64, int64); HANDLE_TYPE(ENUM, Enum, enum); #undef HANDLE_TYPE @@ -1602,9 +1665,9 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { result += WireFormatLite::k##CAMELCASE##Size * \ FromIntSize(repeated_##LOWERCASE##_value->size()); \ break - HANDLE_TYPE(FIXED32, Fixed32, uint32); + HANDLE_TYPE(FIXED32, Fixed32, uint32_t); HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED32, SFixed32, int32_t); HANDLE_TYPE(SFIXED64, SFixed64, int64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); @@ -1638,11 +1701,11 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { } \ break - HANDLE_TYPE(INT32, Int32, int32); + HANDLE_TYPE(INT32, Int32, int32_t); HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32); + HANDLE_TYPE(UINT32, UInt32, uint32_t); HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32); + HANDLE_TYPE(SINT32, SInt32, int32_t); HANDLE_TYPE(SINT64, SInt64, int64); HANDLE_TYPE(STRING, String, string); HANDLE_TYPE(BYTES, Bytes, string); @@ -1657,9 +1720,9 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { result += (tag_size + WireFormatLite::k##CAMELCASE##Size) * \ FromIntSize(repeated_##LOWERCASE##_value->size()); \ break - HANDLE_TYPE(FIXED32, Fixed32, uint32); + HANDLE_TYPE(FIXED32, Fixed32, uint32_t); HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED32, SFixed32, int32_t); HANDLE_TYPE(SFIXED64, SFixed64, int64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); @@ -1675,11 +1738,11 @@ size_t ExtensionSet::Extension::ByteSize(int number) const { result += WireFormatLite::CAMELCASE##Size(LOWERCASE); \ break - HANDLE_TYPE(INT32, Int32, int32_value); + HANDLE_TYPE(INT32, Int32, int32_t_value); HANDLE_TYPE(INT64, Int64, int64_value); - HANDLE_TYPE(UINT32, UInt32, uint32_value); + HANDLE_TYPE(UINT32, UInt32, uint32_t_value); HANDLE_TYPE(UINT64, UInt64, uint64_value); - HANDLE_TYPE(SINT32, SInt32, int32_value); + HANDLE_TYPE(SINT32, SInt32, int32_t_value); HANDLE_TYPE(SINT64, SInt64, int64_value); HANDLE_TYPE(STRING, String, *string_value); HANDLE_TYPE(BYTES, Bytes, *string_value); @@ -1722,9 +1785,9 @@ int ExtensionSet::Extension::GetSize() const { case WireFormatLite::CPPTYPE_##UPPERCASE: \ return repeated_##LOWERCASE##_value->size() - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); @@ -1749,9 +1812,9 @@ void ExtensionSet::Extension::Free() { delete repeated_##LOWERCASE##_value; \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); @@ -1807,16 +1870,15 @@ bool ExtensionSet::Extension::IsInitialized() const { void ExtensionSet::LazyMessageExtension::UnusedKeyMethod() {} const ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) const { - if (PROTOBUF_PREDICT_FALSE(is_large())) { + if (flat_size_ == 0) { + return nullptr; + } else if (PROTOBUF_PREDICT_TRUE(!is_large())) { + auto it = std::lower_bound(flat_begin(), flat_end() - 1, key, + KeyValue::FirstComparator()); + return it->first == key ? &it->second : nullptr; + } else { return FindOrNullInLargeMap(key); } - const KeyValue* end = flat_end(); - const KeyValue* it = - std::lower_bound(flat_begin(), end, key, KeyValue::FirstComparator()); - if (it != end && it->first == key) { - return &it->second; - } - return NULL; } const ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap( @@ -1830,25 +1892,14 @@ const ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap( } ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) { - if (PROTOBUF_PREDICT_FALSE(is_large())) { - return FindOrNullInLargeMap(key); - } - KeyValue* end = flat_end(); - KeyValue* it = - std::lower_bound(flat_begin(), end, key, KeyValue::FirstComparator()); - if (it != end && it->first == key) { - return &it->second; - } - return NULL; + const auto* const_this = this; + return const_cast<ExtensionSet::Extension*>(const_this->FindOrNull(key)); } ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap(int key) { - assert(is_large()); - LargeMap::iterator it = map_.large->find(key); - if (it != map_.large->end()) { - return &it->second; - } - return NULL; + const auto* const_this = this; + return const_cast<ExtensionSet::Extension*>( + const_this->FindOrNullInLargeMap(key)); } std::pair<ExtensionSet::Extension*, bool> ExtensionSet::Insert(int key) { @@ -1895,6 +1946,8 @@ void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { for (const KeyValue* it = begin; it != end; ++it) { hint = new_map.large->insert(hint, {it->first, it->second}); } + flat_size_ = static_cast<uint16_t>(-1); + GOOGLE_DCHECK(is_large()); } else { new_map.flat = Arena::CreateArray<KeyValue>(arena_, new_flat_capacity); std::copy(begin, end, new_map.flat); @@ -1908,7 +1961,7 @@ void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { } // static -constexpr uint16 ExtensionSet::kMaximumFlatCapacity; +constexpr uint16_t ExtensionSet::kMaximumFlatCapacity; void ExtensionSet::Erase(int key) { if (PROTOBUF_PREDICT_FALSE(is_large())) { @@ -1938,8 +1991,9 @@ RepeatedStringTypeTraits::GetDefaultRepeatedField() { return instance; } -uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( - int number, uint8* target, io::EpsCopyOutputStream* stream) const { +uint8_t* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( + const MessageLite* extendee, const ExtensionSet* extension_set, int number, + uint8_t* target, io::EpsCopyOutputStream* stream) const { if (is_repeated) { if (is_packed) { if (cached_size == 0) return target; @@ -1959,15 +2013,15 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( } \ break - HANDLE_TYPE(INT32, Int32, int32); + HANDLE_TYPE(INT32, Int32, int32_t); HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32); + HANDLE_TYPE(UINT32, UInt32, uint32_t); HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32); + HANDLE_TYPE(SINT32, SInt32, int32_t); HANDLE_TYPE(SINT64, SInt64, int64); - HANDLE_TYPE(FIXED32, Fixed32, uint32); + HANDLE_TYPE(FIXED32, Fixed32, uint32_t); HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED32, SFixed32, int32_t); HANDLE_TYPE(SFIXED64, SFixed64, int64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); @@ -1993,15 +2047,15 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( } \ break - HANDLE_TYPE(INT32, Int32, int32); + HANDLE_TYPE(INT32, Int32, int32_t); HANDLE_TYPE(INT64, Int64, int64); - HANDLE_TYPE(UINT32, UInt32, uint32); + HANDLE_TYPE(UINT32, UInt32, uint32_t); HANDLE_TYPE(UINT64, UInt64, uint64); - HANDLE_TYPE(SINT32, SInt32, int32); + HANDLE_TYPE(SINT32, SInt32, int32_t); HANDLE_TYPE(SINT64, SInt64, int64); - HANDLE_TYPE(FIXED32, Fixed32, uint32); + HANDLE_TYPE(FIXED32, Fixed32, uint32_t); HANDLE_TYPE(FIXED64, Fixed64, uint64); - HANDLE_TYPE(SFIXED32, SFixed32, int32); + HANDLE_TYPE(SFIXED32, SFixed32, int32_t); HANDLE_TYPE(SFIXED64, SFixed64, int64); HANDLE_TYPE(FLOAT, Float, float); HANDLE_TYPE(DOUBLE, Double, double); @@ -2041,15 +2095,15 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( target = WireFormatLite::Write##CAMELCASE##ToArray(number, VALUE, target); \ break - HANDLE_TYPE(INT32, Int32, int32_value); + HANDLE_TYPE(INT32, Int32, int32_t_value); HANDLE_TYPE(INT64, Int64, int64_value); - HANDLE_TYPE(UINT32, UInt32, uint32_value); + HANDLE_TYPE(UINT32, UInt32, uint32_t_value); HANDLE_TYPE(UINT64, UInt64, uint64_value); - HANDLE_TYPE(SINT32, SInt32, int32_value); + HANDLE_TYPE(SINT32, SInt32, int32_t_value); HANDLE_TYPE(SINT64, SInt64, int64_value); - HANDLE_TYPE(FIXED32, Fixed32, uint32_value); + HANDLE_TYPE(FIXED32, Fixed32, uint32_t_value); HANDLE_TYPE(FIXED64, Fixed64, uint64_value); - HANDLE_TYPE(SFIXED32, SFixed32, int32_value); + HANDLE_TYPE(SFIXED32, SFixed32, int32_t_value); HANDLE_TYPE(SFIXED64, SFixed64, int64_value); HANDLE_TYPE(FLOAT, Float, float_value); HANDLE_TYPE(DOUBLE, Double, double_value); @@ -2071,8 +2125,10 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( break; case WireFormatLite::TYPE_MESSAGE: if (is_lazy) { - target = - lazymessage_value->WriteMessageToArray(number, target, stream); + const auto* prototype = + extension_set->GetPrototypeForLazyMessage(extendee, number); + target = lazymessage_value->WriteMessageToArray(prototype, number, + target, stream); } else { target = stream->EnsureSpace(target); target = WireFormatLite::InternalWriteMessage(number, *message_value, @@ -2084,13 +2140,28 @@ uint8* ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray( return target; } -uint8* +const MessageLite* ExtensionSet::GetPrototypeForLazyMessage( + const MessageLite* extendee, int number) const { + GeneratedExtensionFinder finder(extendee); + bool was_packed_on_wire = false; + ExtensionInfo extension_info; + if (!FindExtensionInfoFromFieldNumber( + WireFormatLite::WireType::WIRETYPE_LENGTH_DELIMITED, number, &finder, + &extension_info, &was_packed_on_wire)) { + return nullptr; + } + return extension_info.message_info.prototype; +} + +uint8_t* ExtensionSet::Extension::InternalSerializeMessageSetItemWithCachedSizesToArray( - int number, uint8* target, io::EpsCopyOutputStream* stream) const { + const MessageLite* extendee, const ExtensionSet* extension_set, int number, + 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."; - return InternalSerializeFieldWithCachedSizesToArray(number, target, stream); + return InternalSerializeFieldWithCachedSizesToArray(extendee, extension_set, + number, target, stream); } if (is_cleared) return target; @@ -2104,8 +2175,10 @@ ExtensionSet::Extension::InternalSerializeMessageSetItemWithCachedSizesToArray( WireFormatLite::kMessageSetTypeIdNumber, number, target); // Write message. if (is_lazy) { + const auto* prototype = + extension_set->GetPrototypeForLazyMessage(extendee, number); target = lazymessage_value->WriteMessageToArray( - WireFormatLite::kMessageSetMessageNumber, target, stream); + prototype, WireFormatLite::kMessageSetMessageNumber, target, stream); } else { target = WireFormatLite::InternalWriteMessage( WireFormatLite::kMessageSetMessageNumber, *message_value, target, @@ -2154,6 +2227,7 @@ size_t ExtensionSet::MessageSetByteSize() const { return total_size; } + } // namespace internal } // namespace protobuf } // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.h b/contrib/libs/protobuf/src/google/protobuf/extension_set.h index 1b97735f95..2f2dde6014 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.h @@ -53,7 +53,9 @@ #include <google/protobuf/repeated_field.h> #include <google/protobuf/wire_format_lite.h> -#include <google/protobuf/port_def.inc> +// clang-format off +#include <google/protobuf/port_def.inc> // Must be last +// clang-format on #ifdef SWIG #error "You cannot SWIG proto headers" @@ -85,7 +87,7 @@ class InternalMetadata; // #include wire_format_lite.h. Also, ensures that we use only one byte to // store these values, which is important to keep the layout of // ExtensionSet::Extension small. -typedef uint8 FieldType; +typedef uint8_t FieldType; // A function which, given an integer value, returns true if the number // matches one of the defined values for the corresponding enum type. This @@ -99,12 +101,18 @@ typedef bool EnumValidityFuncWithArg(const void* arg, int number); // Information about a registered extension. struct ExtensionInfo { inline ExtensionInfo() {} - inline ExtensionInfo(FieldType type_param, bool isrepeated, bool ispacked) - : type(type_param), + inline ExtensionInfo(const MessageLite* extendee, int param_number, + FieldType type_param, bool isrepeated, bool ispacked) + : message(extendee), + number(param_number), + type(type_param), is_repeated(isrepeated), is_packed(ispacked), descriptor(NULL) {} + const MessageLite* message; + int number; + FieldType type; bool is_repeated; bool is_packed; @@ -143,15 +151,15 @@ class PROTOBUF_EXPORT ExtensionFinder { // files which have been compiled into the binary. class PROTOBUF_EXPORT GeneratedExtensionFinder : public ExtensionFinder { public: - GeneratedExtensionFinder(const MessageLite* containing_type) - : containing_type_(containing_type) {} + explicit GeneratedExtensionFinder(const MessageLite* extendee) + : extendee_(extendee) {} ~GeneratedExtensionFinder() override {} // Returns true and fills in *output if found, otherwise returns false. bool Find(int number, ExtensionInfo* output) override; private: - const MessageLite* containing_type_; + const MessageLite* extendee_; }; // A FieldSkipper used for parsing MessageSet. @@ -182,24 +190,22 @@ class PROTOBUF_EXPORT ExtensionSet { // to look up extensions for parsed field numbers. Note that dynamic parsing // does not use ParseField(); only protocol-compiler-generated parsing // methods do. - static void RegisterExtension(const MessageLite* containing_type, int number, + static void RegisterExtension(const MessageLite* extendee, int number, FieldType type, bool is_repeated, bool is_packed); - static void RegisterEnumExtension(const MessageLite* containing_type, - int number, FieldType type, - bool is_repeated, bool is_packed, - EnumValidityFunc* is_valid); - static void RegisterMessageExtension(const MessageLite* containing_type, - int number, FieldType type, - bool is_repeated, bool is_packed, + static void RegisterEnumExtension(const MessageLite* extendee, int number, + FieldType type, bool is_repeated, + bool is_packed, EnumValidityFunc* is_valid); + static void RegisterMessageExtension(const MessageLite* extendee, int number, + FieldType type, bool is_repeated, + bool is_packed, const MessageLite* prototype); // ================================================================= // Add all fields which are currently present to the given vector. This // is useful to implement Reflection::ListFields(). - void AppendToList(const Descriptor* containing_type, - const DescriptorPool* pool, + void AppendToList(const Descriptor* extendee, const DescriptorPool* pool, std::vector<const FieldDescriptor*>* output) const; // ================================================================= @@ -240,9 +246,9 @@ class PROTOBUF_EXPORT ExtensionSet { // singular fields ------------------------------------------------- - int32 GetInt32(int number, int32 default_value) const; + int32_t GetInt32(int number, int32_t default_value) const; int64 GetInt64(int number, int64 default_value) const; - uint32 GetUInt32(int number, uint32 default_value) const; + uint32_t GetUInt32(int number, uint32_t default_value) const; uint64 GetUInt64(int number, uint64 default_value) const; float GetFloat(int number, float default_value) const; double GetDouble(int number, double default_value) const; @@ -259,9 +265,9 @@ class PROTOBUF_EXPORT ExtensionSet { // the extension lives in the same pool as the descriptor for the containing // type. #define desc const FieldDescriptor* descriptor // avoid line wrapping - void SetInt32(int number, FieldType type, int32 value, desc); + void SetInt32(int number, FieldType type, int32_t value, desc); void SetInt64(int number, FieldType type, int64 value, desc); - void SetUInt32(int number, FieldType type, uint32 value, desc); + void SetUInt32(int number, FieldType type, uint32_t value, desc); void SetUInt64(int number, FieldType type, uint64 value, desc); void SetFloat(int number, FieldType type, float value, desc); void SetDouble(int number, FieldType type, double value, desc); @@ -312,9 +318,9 @@ class PROTOBUF_EXPORT ExtensionSet { // (E.g.: borg/clients/internal/proto1/proto2_reflection.cc.) void* MutableRawRepeatedField(int number); - int32 GetRepeatedInt32(int number, int index) const; + int32_t GetRepeatedInt32(int number, int index) const; int64 GetRepeatedInt64(int number, int index) const; - uint32 GetRepeatedUInt32(int number, int index) const; + uint32_t GetRepeatedUInt32(int number, int index) const; uint64 GetRepeatedUInt64(int number, int index) const; float GetRepeatedFloat(int number, int index) const; double GetRepeatedDouble(int number, int index) const; @@ -323,9 +329,9 @@ class PROTOBUF_EXPORT ExtensionSet { const TProtoStringType& GetRepeatedString(int number, int index) const; const MessageLite& GetRepeatedMessage(int number, int index) const; - void SetRepeatedInt32(int number, int index, int32 value); + void SetRepeatedInt32(int number, int index, int32_t value); void SetRepeatedInt64(int number, int index, int64 value); - void SetRepeatedUInt32(int number, int index, uint32 value); + void SetRepeatedUInt32(int number, int index, uint32_t value); void SetRepeatedUInt64(int number, int index, uint64 value); void SetRepeatedFloat(int number, int index, float value); void SetRepeatedDouble(int number, int index, double value); @@ -336,9 +342,9 @@ class PROTOBUF_EXPORT ExtensionSet { MessageLite* MutableRepeatedMessage(int number, int index); #define desc const FieldDescriptor* descriptor // avoid line wrapping - void AddInt32(int number, FieldType type, bool packed, int32 value, desc); + void AddInt32(int number, FieldType type, bool packed, int32_t value, desc); void AddInt64(int number, FieldType type, bool packed, int64 value, desc); - void AddUInt32(int number, FieldType type, bool packed, uint32 value, desc); + void AddUInt32(int number, FieldType type, bool packed, uint32_t value, desc); void AddUInt64(int number, FieldType type, bool packed, uint64 value, desc); void AddFloat(int number, FieldType type, bool packed, float value, desc); void AddDouble(int number, FieldType type, bool packed, double value, desc); @@ -352,10 +358,13 @@ class PROTOBUF_EXPORT ExtensionSet { MessageFactory* factory); void AddAllocatedMessage(const FieldDescriptor* descriptor, MessageLite* new_entry); + void UnsafeArenaAddAllocatedMessage(const FieldDescriptor* descriptor, + MessageLite* new_entry); #undef desc void RemoveLast(int number); PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseLast(int number); + MessageLite* UnsafeArenaReleaseLast(int number); void SwapElements(int number, int index1, int index2); // ----------------------------------------------------------------- @@ -377,49 +386,47 @@ class PROTOBUF_EXPORT ExtensionSet { // Parses a single extension from the input. The input should start out // positioned immediately after the tag. - bool ParseField(uint32 tag, io::CodedInputStream* input, + bool ParseField(uint32_t tag, io::CodedInputStream* input, ExtensionFinder* extension_finder, FieldSkipper* field_skipper); // Specific versions for lite or full messages (constructs the appropriate - // FieldSkipper automatically). |containing_type| is the default + // FieldSkipper automatically). |extendee| is the default // instance for the containing message; it is used only to look up the // extension by number. See RegisterExtension(), above. Unlike the other // methods of ExtensionSet, this only works for generated message types -- // it looks up extensions registered using RegisterExtension(). - bool ParseField(uint32 tag, io::CodedInputStream* input, - const MessageLite* containing_type); - bool ParseField(uint32 tag, io::CodedInputStream* input, - const Message* containing_type, - UnknownFieldSet* unknown_fields); - bool ParseField(uint32 tag, io::CodedInputStream* input, - const MessageLite* containing_type, + bool ParseField(uint32_t tag, io::CodedInputStream* input, + const MessageLite* extendee); + bool ParseField(uint32_t tag, io::CodedInputStream* input, + const Message* extendee, UnknownFieldSet* unknown_fields); + bool ParseField(uint32_t tag, io::CodedInputStream* input, + const MessageLite* extendee, io::CodedOutputStream* unknown_fields); // Lite parser - const char* ParseField(uint64 tag, const char* ptr, - const MessageLite* containing_type, + const char* ParseField(uint64_t tag, const char* ptr, + const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); // Full parser - const char* ParseField(uint64 tag, const char* ptr, - const Message* containing_type, + const char* ParseField(uint64_t tag, const char* ptr, const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); template <typename Msg> - const char* ParseMessageSet(const char* ptr, const Msg* containing_type, + const char* ParseMessageSet(const char* ptr, const Msg* extendee, InternalMetadata* metadata, internal::ParseContext* ctx) { struct MessageSetItem { const char* _InternalParse(const char* ptr, ParseContext* ctx) { - return me->ParseMessageSetItem(ptr, containing_type, metadata, ctx); + return me->ParseMessageSetItem(ptr, extendee, metadata, ctx); } ExtensionSet* me; - const Msg* containing_type; + const Msg* extendee; InternalMetadata* metadata; - } item{this, containing_type, metadata}; + } item{this, extendee, metadata}; while (!ctx->Done(&ptr)) { - uint32 tag; + uint32_t tag; ptr = ReadTag(ptr, &tag); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (tag == WireFormatLite::kMessageSetItemStartTag) { @@ -430,7 +437,7 @@ class PROTOBUF_EXPORT ExtensionSet { ctx->SetLastTag(tag); return ptr; } - ptr = ParseField(tag, ptr, containing_type, metadata, ctx); + ptr = ParseField(tag, ptr, extendee, metadata, ctx); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); } } @@ -448,21 +455,21 @@ class PROTOBUF_EXPORT ExtensionSet { // Specific versions for lite or full messages (constructs the appropriate // FieldSkipper automatically). - bool ParseMessageSet(io::CodedInputStream* input, - const MessageLite* containing_type, + bool ParseMessageSet(io::CodedInputStream* input, const MessageLite* extendee, TProtoStringType* unknown_fields); - bool ParseMessageSet(io::CodedInputStream* input, - const Message* containing_type, + bool ParseMessageSet(io::CodedInputStream* input, const Message* extendee, UnknownFieldSet* unknown_fields); // Write all extension fields with field numbers in the range // [start_field_number, end_field_number) // to the output stream, using the cached sizes computed when ByteSize() was // last called. Note that the range bounds are inclusive-exclusive. - void SerializeWithCachedSizes(int start_field_number, int end_field_number, + void SerializeWithCachedSizes(const MessageLite* extendee, + int start_field_number, int end_field_number, io::CodedOutputStream* output) const { - output->SetCur(_InternalSerialize(start_field_number, end_field_number, - output->Cur(), output->EpsCopy())); + output->SetCur(_InternalSerialize(extendee, start_field_number, + end_field_number, output->Cur(), + output->EpsCopy())); } // Same as SerializeWithCachedSizes, but without any bounds checking. @@ -470,32 +477,37 @@ class PROTOBUF_EXPORT ExtensionSet { // serialized extensions. // // Returns a pointer past the last written byte. - uint8* _InternalSerialize(int start_field_number, int end_field_number, - uint8* target, - io::EpsCopyOutputStream* stream) const { + + uint8_t* _InternalSerialize(const MessageLite* extendee, + int start_field_number, int end_field_number, + uint8_t* target, + io::EpsCopyOutputStream* stream) const { if (flat_size_ == 0) { assert(!is_large()); return target; } - return _InternalSerializeImpl(start_field_number, end_field_number, target, - stream); + return _InternalSerializeImpl(extendee, start_field_number, + end_field_number, target, stream); } // Like above but serializes in MessageSet format. - void SerializeMessageSetWithCachedSizes(io::CodedOutputStream* output) const { + void SerializeMessageSetWithCachedSizes(const MessageLite* extendee, + io::CodedOutputStream* output) const { output->SetCur(InternalSerializeMessageSetWithCachedSizesToArray( - output->Cur(), output->EpsCopy())); + extendee, output->Cur(), output->EpsCopy())); } - uint8* InternalSerializeMessageSetWithCachedSizesToArray( - uint8* target, io::EpsCopyOutputStream* stream) const; + uint8_t* InternalSerializeMessageSetWithCachedSizesToArray( + const MessageLite* extendee, uint8_t* target, + io::EpsCopyOutputStream* stream) const; // For backward-compatibility, versions of two of the above methods that // serialize deterministically iff SetDefaultSerializationDeterministic() // has been called. - uint8* SerializeWithCachedSizesToArray(int start_field_number, - int end_field_number, - uint8* target) const; - uint8* SerializeMessageSetWithCachedSizesToArray(uint8* target) const; + uint8_t* SerializeWithCachedSizesToArray(int start_field_number, + int end_field_number, + uint8_t* target) const; + uint8_t* SerializeMessageSetWithCachedSizesToArray( + const MessageLite* extendee, uint8_t* target) const; // Returns the total serialized size of all the extensions. size_t ByteSize() const; @@ -520,10 +532,40 @@ class PROTOBUF_EXPORT ExtensionSet { int SpaceUsedExcludingSelf() const; private: + template <typename Type> + friend class PrimitiveTypeTraits; + + template <typename Type> + friend class RepeatedPrimitiveTypeTraits; + + template <typename Type, bool IsValid(int)> + friend class EnumTypeTraits; + + template <typename Type, bool IsValid(int)> + friend class RepeatedEnumTypeTraits; + + const int32_t& GetRefInt32(int number, const int32_t& default_value) const; + const int64& GetRefInt64(int number, const int64& default_value) const; + const uint32_t& GetRefUInt32(int number, const uint32_t& default_value) const; + const uint64& GetRefUInt64(int number, const uint64& default_value) const; + const float& GetRefFloat(int number, const float& default_value) const; + const double& GetRefDouble(int number, const double& default_value) const; + const bool& GetRefBool(int number, const bool& default_value) const; + const int& GetRefEnum(int number, const int& default_value) const; + const int32_t& GetRefRepeatedInt32(int number, int index) const; + const int64& GetRefRepeatedInt64(int number, int index) const; + const uint32_t& GetRefRepeatedUInt32(int number, int index) const; + const uint64& GetRefRepeatedUInt64(int number, int index) const; + const float& GetRefRepeatedFloat(int number, int index) const; + const double& GetRefRepeatedDouble(int number, int index) const; + const bool& GetRefRepeatedBool(int number, int index) const; + const int& GetRefRepeatedEnum(int number, int index) const; + // Implementation of _InternalSerialize for non-empty map_. - uint8* _InternalSerializeImpl(int start_field_number, int end_field_number, - uint8* target, - io::EpsCopyOutputStream* stream) const; + uint8_t* _InternalSerializeImpl(const MessageLite* extendee, + int start_field_number, int end_field_number, + uint8_t* target, + io::EpsCopyOutputStream* stream) const; // Interface of a lazily parsed singular message extension. class PROTOBUF_EXPORT LazyMessageExtension { public: @@ -533,7 +575,8 @@ class PROTOBUF_EXPORT ExtensionSet { virtual LazyMessageExtension* New(Arena* arena) const = 0; virtual const MessageLite& GetMessage( const MessageLite& prototype) const = 0; - virtual MessageLite* MutableMessage(const MessageLite& prototype) = 0; + virtual MessageLite* MutableMessage(const MessageLite& prototype, + Arena* arena) = 0; virtual void SetAllocatedMessage(MessageLite* message) = 0; virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message) = 0; virtual PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage( @@ -548,27 +591,31 @@ class PROTOBUF_EXPORT ExtensionSet { virtual size_t ByteSizeLong() const = 0; virtual size_t SpaceUsedLong() const = 0; - virtual void MergeFrom(const LazyMessageExtension& other) = 0; + virtual void MergeFrom(const LazyMessageExtension& other, Arena* arena) = 0; + virtual void MergeFromMessage(const MessageLite& msg, Arena* arena) = 0; virtual void Clear() = 0; virtual bool ReadMessage(const MessageLite& prototype, io::CodedInputStream* input) = 0; virtual const char* _InternalParse(const char* ptr, ParseContext* ctx) = 0; - virtual uint8* WriteMessageToArray( - int number, uint8* target, io::EpsCopyOutputStream* stream) const = 0; + virtual uint8_t* WriteMessageToArray( + const MessageLite* prototype, int number, uint8_t* target, + io::EpsCopyOutputStream* stream) const = 0; private: virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable. GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyMessageExtension); }; + // Give access to function defined below to see LazyMessageExtension. + friend LazyMessageExtension* MaybeCreateLazyExtension(Arena* arena); struct Extension { // The order of these fields packs Extension into 24 bytes when using 8 // byte alignment. Consider this when adding or removing fields here. union { - int32 int32_value; + int32_t int32_t_value; int64 int64_value; - uint32 uint32_value; + uint32_t uint32_t_value; uint64 uint64_value; float float_value; double double_value; @@ -578,9 +625,9 @@ class PROTOBUF_EXPORT ExtensionSet { MessageLite* message_value; LazyMessageExtension* lazymessage_value; - RepeatedField<int32>* repeated_int32_value; + RepeatedField<int32_t>* repeated_int32_t_value; RepeatedField<int64>* repeated_int64_value; - RepeatedField<uint32>* repeated_uint32_value; + RepeatedField<uint32_t>* repeated_uint32_t_value; RepeatedField<uint64>* repeated_uint64_value; RepeatedField<float>* repeated_float_value; RepeatedField<double>* repeated_double_value; @@ -622,10 +669,12 @@ class PROTOBUF_EXPORT ExtensionSet { const FieldDescriptor* descriptor; // Some helper methods for operations on a single Extension. - uint8* InternalSerializeFieldWithCachedSizesToArray( - int number, uint8* target, io::EpsCopyOutputStream* stream) const; - uint8* InternalSerializeMessageSetItemWithCachedSizesToArray( - int number, uint8* target, io::EpsCopyOutputStream* stream) const; + uint8_t* InternalSerializeFieldWithCachedSizesToArray( + const MessageLite* extendee, const ExtensionSet* extension_set, + int number, uint8_t* target, io::EpsCopyOutputStream* stream) const; + uint8_t* InternalSerializeMessageSetItemWithCachedSizesToArray( + const MessageLite* extendee, const ExtensionSet* extension_set, + int number, uint8_t* target, io::EpsCopyOutputStream* stream) const; size_t ByteSize(int number) const; size_t MessageSetItemByteSize(int number) const; void Clear(); @@ -678,8 +727,8 @@ class PROTOBUF_EXPORT ExtensionSet { // Grows the flat_capacity_. // If flat_capacity_ > kMaximumFlatCapacity, converts to LargeMap. void GrowCapacity(size_t minimum_new_capacity); - static constexpr uint16 kMaximumFlatCapacity = 256; - bool is_large() const { return flat_capacity_ > kMaximumFlatCapacity; } + static constexpr uint16_t kMaximumFlatCapacity = 256; + bool is_large() const { return static_cast<int16_t>(flat_size_) < 0; } // Removes a key from the ExtensionSet. void Erase(int key); @@ -723,7 +772,7 @@ class PROTOBUF_EXPORT ExtensionSet { // Note to support packed repeated field compatibility, it also fills whether // the tag on wire is packed, which can be different from // extension->is_packed (whether packed=true is specified). - bool FindExtensionInfoFromTag(uint32 tag, ExtensionFinder* extension_finder, + bool FindExtensionInfoFromTag(uint32_t tag, ExtensionFinder* extension_finder, int* field_number, ExtensionInfo* extension, bool* was_packed_on_wire); @@ -734,7 +783,12 @@ class PROTOBUF_EXPORT ExtensionSet { bool FindExtensionInfoFromFieldNumber(int wire_type, int field_number, ExtensionFinder* extension_finder, ExtensionInfo* extension, - bool* was_packed_on_wire); + bool* was_packed_on_wire) const; + + // Find the prototype for a LazyMessage from the extension registry. Returns + // null if the extension is not found. + const MessageLite* GetPrototypeForLazyMessage(const MessageLite* extendee, + int number) const; // Parses a single extension from the input. The input should start out // positioned immediately after the wire tag. This method is called in @@ -772,36 +826,33 @@ class PROTOBUF_EXPORT ExtensionSet { ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper); - bool FindExtension(int wire_type, uint32 field, - const MessageLite* containing_type, + bool FindExtension(int wire_type, uint32_t field, const MessageLite* extendee, const internal::ParseContext* /*ctx*/, ExtensionInfo* extension, bool* was_packed_on_wire) { - GeneratedExtensionFinder finder(containing_type); + GeneratedExtensionFinder finder(extendee); return FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension, was_packed_on_wire); } - inline bool FindExtension(int wire_type, uint32 field, - const Message* containing_type, + inline bool FindExtension(int wire_type, uint32_t field, + const Message* extendee, const internal::ParseContext* ctx, ExtensionInfo* extension, bool* was_packed_on_wire); // Used for MessageSet only - const char* ParseFieldMaybeLazily(uint64 tag, const char* ptr, - const MessageLite* containing_type, + const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr, + const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { // Lite MessageSet doesn't implement lazy. - return ParseField(tag, ptr, containing_type, metadata, ctx); + return ParseField(tag, ptr, extendee, metadata, ctx); } - const char* ParseFieldMaybeLazily(uint64 tag, const char* ptr, - const Message* containing_type, + const char* ParseFieldMaybeLazily(uint64_t tag, const char* ptr, + const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); - const char* ParseMessageSetItem(const char* ptr, - const MessageLite* containing_type, + const char* ParseMessageSetItem(const char* ptr, const MessageLite* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); - const char* ParseMessageSetItem(const char* ptr, - const Message* containing_type, + const char* ParseMessageSetItem(const char* ptr, const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); @@ -813,8 +864,7 @@ class PROTOBUF_EXPORT ExtensionSet { const char* ptr, internal::ParseContext* ctx); template <typename Msg, typename T> - const char* ParseMessageSetItemTmpl(const char* ptr, - const Msg* containing_type, + const char* ParseMessageSetItemTmpl(const char* ptr, const Msg* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx); @@ -850,8 +900,8 @@ class PROTOBUF_EXPORT ExtensionSet { // Manual memory-management: // map_.flat is an allocated array of flat_capacity_ elements. // [map_.flat, map_.flat + flat_size_) is the currently-in-use prefix. - uint16 flat_capacity_; - uint16 flat_size_; + uint16_t flat_capacity_; + uint16_t flat_size_; // negative int16_t(flat_size_) indicates is_large() union AllocatedData { KeyValue* flat; @@ -860,7 +910,7 @@ class PROTOBUF_EXPORT ExtensionSet { LargeMap* large; } map_; - static void DeleteFlatMap(const KeyValue* flat, uint16 flat_capacity); + static void DeleteFlatMap(const KeyValue* flat, uint16_t flat_capacity); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet); }; @@ -937,7 +987,7 @@ inline void ExtensionSet::AddString(int number, FieldType type, // For example, if "foo" is an extension of type "optional int32", then if you // try to write code like: // my_message.MutableExtension(foo) -// you will get a compile error because PrimitiveTypeTraits<int32> does not +// you will get a compile error because PrimitiveTypeTraits<int32_t> does not // have a "Mutable()" method. // ------------------------------------------------------------------- @@ -955,6 +1005,9 @@ class PrimitiveTypeTraits { static inline ConstType Get(int number, const ExtensionSet& set, ConstType default_value); + + static inline const ConstType* GetPtr(int number, const ExtensionSet& set, + const ConstType& default_value); static inline void Set(int number, FieldType field_type, ConstType value, ExtensionSet* set); template <typename ExtendeeT> @@ -974,6 +1027,10 @@ class RepeatedPrimitiveTypeTraits { typedef RepeatedField<Type> RepeatedFieldType; static inline Type Get(int number, const ExtensionSet& set, int index); + static inline const Type* GetPtr(int number, const ExtensionSet& set, + int index); + static inline const RepeatedField<ConstType>* GetRepeatedPtr( + int number, const ExtensionSet& set); static inline void Set(int number, int index, Type value, ExtensionSet* set); static inline void Add(int number, FieldType field_type, bool is_packed, Type value, ExtensionSet* set); @@ -998,9 +1055,9 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { template <typename Type> friend class RepeatedPrimitiveTypeTraits; static const RepeatedPrimitiveDefaults* default_instance(); - RepeatedField<int32> default_repeated_field_int32_; + RepeatedField<int32_t> default_repeated_field_int32_t_; RepeatedField<int64> default_repeated_field_int64_; - RepeatedField<uint32> default_repeated_field_uint32_; + RepeatedField<uint32_t> default_repeated_field_uint32_t_; RepeatedField<uint64> default_repeated_field_uint64_; RepeatedField<double> default_repeated_field_double_; RepeatedField<float> default_repeated_field_float_; @@ -1014,6 +1071,11 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { return set.Get##METHOD(number, default_value); \ } \ template <> \ + inline const TYPE* PrimitiveTypeTraits<TYPE>::GetPtr( \ + int number, const ExtensionSet& set, const TYPE& default_value) { \ + return &set.GetRef##METHOD(number, default_value); \ + } \ + template <> \ inline void PrimitiveTypeTraits<TYPE>::Set(int number, FieldType field_type, \ TYPE value, ExtensionSet* set) { \ set->Set##METHOD(number, field_type, value, NULL); \ @@ -1025,6 +1087,11 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { return set.GetRepeated##METHOD(number, index); \ } \ template <> \ + inline const TYPE* RepeatedPrimitiveTypeTraits<TYPE>::GetPtr( \ + int number, const ExtensionSet& set, int index) { \ + return &set.GetRefRepeated##METHOD(number, index); \ + } \ + template <> \ inline void RepeatedPrimitiveTypeTraits<TYPE>::Set( \ int number, int index, TYPE value, ExtensionSet* set) { \ set->SetRepeated##METHOD(number, index, value); \ @@ -1049,6 +1116,12 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { set.GetRawRepeatedField(number, GetDefaultRepeatedField())); \ } \ template <> \ + inline const RepeatedField<TYPE>* \ + RepeatedPrimitiveTypeTraits<TYPE>::GetRepeatedPtr(int number, \ + const ExtensionSet& set) { \ + return &GetRepeated(number, set); \ + } \ + template <> \ inline RepeatedField<TYPE>* \ RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated( \ int number, FieldType field_type, bool is_packed, ExtensionSet* set) { \ @@ -1056,9 +1129,9 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); \ } -PROTOBUF_DEFINE_PRIMITIVE_TYPE(int32, Int32) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(int32_t, Int32) PROTOBUF_DEFINE_PRIMITIVE_TYPE(int64, Int64) -PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint32, UInt32) +PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint32_t, UInt32) PROTOBUF_DEFINE_PRIMITIVE_TYPE(uint64, UInt64) PROTOBUF_DEFINE_PRIMITIVE_TYPE(float, Float) PROTOBUF_DEFINE_PRIMITIVE_TYPE(double, Double) @@ -1080,6 +1153,10 @@ class PROTOBUF_EXPORT StringTypeTraits { ConstType default_value) { return set.GetString(number, default_value); } + static inline const TProtoStringType* GetPtr(int number, const ExtensionSet& set, + ConstType default_value) { + return &Get(number, set, default_value); + } static inline void Set(int number, FieldType field_type, const TProtoStringType& value, ExtensionSet* set) { set->SetString(number, field_type, value, NULL); @@ -1107,6 +1184,14 @@ class PROTOBUF_EXPORT RepeatedStringTypeTraits { int index) { return set.GetRepeatedString(number, index); } + static inline const TProtoStringType* GetPtr(int number, const ExtensionSet& set, + int index) { + return &Get(number, set, index); + } + static inline const RepeatedPtrField<TProtoStringType>* GetRepeatedPtr( + int number, const ExtensionSet& set) { + return &GetRepeated(number, set); + } static inline void Set(int number, int index, const TProtoStringType& value, ExtensionSet* set) { set->SetRepeatedString(number, index, value); @@ -1163,6 +1248,11 @@ class EnumTypeTraits { ConstType default_value) { return static_cast<Type>(set.GetEnum(number, default_value)); } + static inline const ConstType* GetPtr(int number, const ExtensionSet& set, + const ConstType& default_value) { + return reinterpret_cast<const Type*>( + &set.GetRefEnum(number, default_value)); + } static inline void Set(int number, FieldType field_type, ConstType value, ExtensionSet* set) { GOOGLE_DCHECK(IsValid(value)); @@ -1187,6 +1277,11 @@ class RepeatedEnumTypeTraits { static inline ConstType Get(int number, const ExtensionSet& set, int index) { return static_cast<Type>(set.GetRepeatedEnum(number, index)); } + static inline const ConstType* GetPtr(int number, const ExtensionSet& set, + int index) { + return reinterpret_cast<const Type*>( + &set.GetRefRepeatedEnum(number, index)); + } static inline void Set(int number, int index, ConstType value, ExtensionSet* set) { GOOGLE_DCHECK(IsValid(value)); @@ -1206,7 +1301,10 @@ class RepeatedEnumTypeTraits { return *reinterpret_cast<const RepeatedField<Type>*>( set.GetRawRepeatedField(number, GetDefaultRepeatedField())); } - + static inline const RepeatedField<Type>* GetRepeatedPtr( + int number, const ExtensionSet& set) { + return &GetRepeated(number, set); + } static inline RepeatedField<Type>* MutableRepeated(int number, FieldType field_type, bool is_packed, @@ -1220,10 +1318,10 @@ class RepeatedEnumTypeTraits { // RepeatedField<int>. We need to be able to instantiate global static // objects to return as default (empty) repeated fields on non-existent // extensions. We would not be able to know a-priori all of the enum types - // (values of |Type|) to instantiate all of these, so we just re-use int32's - // default repeated field object. + // (values of |Type|) to instantiate all of these, so we just re-use + // int32_t's default repeated field object. return reinterpret_cast<const RepeatedField<Type>*>( - RepeatedPrimitiveTypeTraits<int32>::GetDefaultRepeatedField()); + RepeatedPrimitiveTypeTraits<int32_t>::GetDefaultRepeatedField()); } template <typename ExtendeeT> static void Register(int number, FieldType type, bool is_packed) { @@ -1249,6 +1347,11 @@ class MessageTypeTraits { ConstType default_value) { return static_cast<const Type&>(set.GetMessage(number, default_value)); } + static inline std::nullptr_t GetPtr(int /*number*/, const ExtensionSet& /*set*/, + ConstType /*default_value*/) { + // Cannot be implemented because of forward declared messages? + return nullptr; + } static inline MutableType Mutable(int number, FieldType field_type, ExtensionSet* set) { return static_cast<Type*>(set->MutableMessage( @@ -1282,7 +1385,7 @@ class MessageTypeTraits { } }; -// forward declaration +// forward declaration. class RepeatedMessageGenericTypeTraits; template <typename Type> @@ -1297,6 +1400,16 @@ class RepeatedMessageTypeTraits { static inline ConstType Get(int number, const ExtensionSet& set, int index) { return static_cast<const Type&>(set.GetRepeatedMessage(number, index)); } + static inline std::nullptr_t GetPtr(int /*number*/, const ExtensionSet& /*set*/, + int /*index*/) { + // Cannot be implemented because of forward declared messages? + return nullptr; + } + static inline std::nullptr_t GetRepeatedPtr(int /*number*/, + const ExtensionSet& /*set*/) { + // Cannot be implemented because of forward declared messages? + return nullptr; + } static inline MutableType Mutable(int number, int index, ExtensionSet* set) { return static_cast<Type*>(set->MutableRepeatedMessage(number, index)); } @@ -1347,7 +1460,7 @@ RepeatedMessageTypeTraits<Type>::GetDefaultRepeatedField() { // optional int32 bar = 1234; // } // then "bar" will be defined in C++ as: -// ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32>, 5, false> bar(1234); +// ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32_t>, 5, false> bar(1234); // // Note that we could, in theory, supply the field number as a template // parameter, and thus make an instance of ExtensionIdentifier have no @@ -1378,6 +1491,10 @@ class ExtensionIdentifier { TypeTraits::template Register<ExtendeeType>(number, field_type, is_packed); } + typename TypeTraits::ConstType const& default_value_ref() const { + return default_value_; + } + private: const int number_; typename TypeTraits::ConstType default_value_; @@ -1386,189 +1503,10 @@ class ExtensionIdentifier { // ------------------------------------------------------------------- // Generated accessors -// This macro should be expanded in the context of a generated type which -// has extensions. -// -// We use "_proto_TypeTraits" as a type name below because "TypeTraits" -// causes problems if the class has a nested message or enum type with that -// name and "_TypeTraits" is technically reserved for the C++ library since -// it starts with an underscore followed by a capital letter. -// -// For similar reason, we use "_field_type" and "_is_packed" as parameter names -// below, so that "field_type" and "is_packed" can be used as field names. -#define GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(CLASSNAME) \ - /* Has, Size, Clear */ \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline bool HasExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \ - return _extensions_.Has(id.number()); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline void ClearExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ - _extensions_.ClearExtension(id.number()); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline int ExtensionSize( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \ - return _extensions_.ExtensionSize(id.number()); \ - } \ - \ - /* Singular accessors */ \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Singular::ConstType GetExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \ - return _proto_TypeTraits::Get(id.number(), _extensions_, \ - id.default_value()); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ - return _proto_TypeTraits::Mutable(id.number(), _field_type, \ - &_extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline void SetExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::Singular::ConstType value) { \ - _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline void SetAllocatedExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::Singular::MutableType value) { \ - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, \ - &_extensions_); \ - } \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline void UnsafeArenaSetAllocatedExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::Singular::MutableType value) { \ - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, \ - value, &_extensions_); \ - } \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline PROTOBUF_MUST_USE_RESULT \ - typename _proto_TypeTraits::Singular::MutableType \ - ReleaseExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ - return _proto_TypeTraits::Release(id.number(), _field_type, \ - &_extensions_); \ - } \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Singular::MutableType \ - UnsafeArenaReleaseExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, \ - &_extensions_); \ - } \ - \ - /* Repeated accessors */ \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - int index) const { \ - return _proto_TypeTraits::Get(id.number(), _extensions_, index); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - int index) { \ - return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline void SetExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - int index, typename _proto_TypeTraits::Repeated::ConstType value) { \ - _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ - return _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline void AddExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id, \ - typename _proto_TypeTraits::Repeated::ConstType value) { \ - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, \ - &_extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& \ - GetRepeatedExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) const { \ - return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); \ - } \ - \ - template <typename _proto_TypeTraits, \ - ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \ - bool _is_packed> \ - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* \ - MutableRepeatedExtension( \ - const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \ - CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \ - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, \ - _is_packed, &_extensions_); \ - } + +// Used to retrieve a lazy extension, may return nullptr in some environments. +extern PROTOBUF_ATTRIBUTE_WEAK ExtensionSet::LazyMessageExtension* +MaybeCreateLazyExtension(Arena* arena); } // namespace internal diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc b/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc index 76ac0766f6..bb2f2f80f6 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc @@ -35,16 +35,16 @@ // Contains methods defined in extension_set.h which cannot be part of the // lite library because they use descriptors or reflection. -#include <google/protobuf/extension_set.h> - #include <google/protobuf/stubs/casts.h> #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/extension_set_inl.h> #include <google/protobuf/parse_context.h> #include <google/protobuf/io/coded_stream.h> -#include <google/protobuf/io/zero_copy_stream_impl_lite.h> +#include <google/protobuf/arena.h> #include <google/protobuf/descriptor.h> +#include <google/protobuf/extension_set.h> #include <google/protobuf/message.h> +#include <google/protobuf/message_lite.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/unknown_field_set.h> #include <google/protobuf/wire_format.h> @@ -62,16 +62,16 @@ class MessageSetFieldSkipper : public UnknownFieldSetFieldSkipper { public: explicit MessageSetFieldSkipper(UnknownFieldSet* unknown_fields) : UnknownFieldSetFieldSkipper(unknown_fields) {} - virtual ~MessageSetFieldSkipper() {} + ~MessageSetFieldSkipper() override {} virtual bool SkipMessageSetField(io::CodedInputStream* input, int field_number); }; bool MessageSetFieldSkipper::SkipMessageSetField(io::CodedInputStream* input, int field_number) { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; - if (unknown_fields_ == NULL) { + if (unknown_fields_ == nullptr) { return input->Skip(length); } else { return input->ReadString(unknown_fields_->AddLengthDelimited(field_number), @@ -116,7 +116,7 @@ void ExtensionSet::AppendToList( // initialized, so they might not even be constructed until // AppendToList() is called. - if (ext.descriptor == NULL) { + if (ext.descriptor == nullptr) { output->push_back(pool->FindExtensionByNumber(containing_type, number)); } else { output->push_back(ext.descriptor); @@ -150,7 +150,7 @@ const MessageLite& ExtensionSet::GetMessage(int number, const Descriptor* message_type, MessageFactory* factory) const { const Extension* extension = FindOrNull(number); - if (extension == NULL || extension->is_cleared) { + if (extension == nullptr || extension->is_cleared) { // Not present. Return the default value. return *factory->GetPrototype(message_type); } else { @@ -183,7 +183,7 @@ MessageLite* ExtensionSet::MutableMessage(const FieldDescriptor* descriptor, extension->is_cleared = false; if (extension->is_lazy) { return extension->lazymessage_value->MutableMessage( - *factory->GetPrototype(descriptor->message_type())); + *factory->GetPrototype(descriptor->message_type()), arena_); } else { return extension->message_value; } @@ -193,20 +193,20 @@ MessageLite* ExtensionSet::MutableMessage(const FieldDescriptor* descriptor, MessageLite* ExtensionSet::ReleaseMessage(const FieldDescriptor* descriptor, MessageFactory* factory) { Extension* extension = FindOrNull(descriptor->number()); - if (extension == NULL) { + if (extension == nullptr) { // Not present. Return NULL. - return NULL; + return nullptr; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); - MessageLite* ret = NULL; + MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->ReleaseMessage( *factory->GetPrototype(descriptor->message_type())); - if (arena_ == NULL) { + if (arena_ == nullptr) { delete extension->lazymessage_value; } } else { - if (arena_ != NULL) { + if (arena_ != nullptr) { ret = extension->message_value->New(); ret->CheckTypeAndMergeFrom(*extension->message_value); } else { @@ -221,16 +221,16 @@ MessageLite* ExtensionSet::ReleaseMessage(const FieldDescriptor* descriptor, MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( const FieldDescriptor* descriptor, MessageFactory* factory) { Extension* extension = FindOrNull(descriptor->number()); - if (extension == NULL) { + if (extension == nullptr) { // Not present. Return NULL. - return NULL; + return nullptr; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); - MessageLite* ret = NULL; + MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->UnsafeArenaReleaseMessage( *factory->GetPrototype(descriptor->message_type())); - if (arena_ == NULL) { + if (arena_ == nullptr) { delete extension->lazymessage_value; } } else { @@ -266,11 +266,11 @@ MessageLite* ExtensionSet::AddMessage(const FieldDescriptor* descriptor, reinterpret_cast<internal::RepeatedPtrFieldBase*>( extension->repeated_message_value) ->AddFromCleared<GenericTypeHandler<MessageLite> >(); - if (result == NULL) { + if (result == nullptr) { const MessageLite* prototype; - if (extension->repeated_message_value->size() == 0) { + if (extension->repeated_message_value->empty()) { prototype = factory->GetPrototype(descriptor->message_type()); - GOOGLE_CHECK(prototype != NULL); + GOOGLE_CHECK(prototype != nullptr); } else { prototype = &extension->repeated_message_value->Get(0); } @@ -287,15 +287,22 @@ void ExtensionSet::AddAllocatedMessage(const FieldDescriptor* descriptor, extension->repeated_message_value->AddAllocated(new_entry); } +void ExtensionSet::UnsafeArenaAddAllocatedMessage( + const FieldDescriptor* descriptor, MessageLite* new_entry) { + Extension* extension = MaybeNewRepeatedExtension(descriptor); + + extension->repeated_message_value->UnsafeArenaAddAllocated(new_entry); +} + static bool ValidateEnumUsingDescriptor(const void* arg, int number) { return reinterpret_cast<const EnumDescriptor*>(arg)->FindValueByNumber( - number) != NULL; + number) != nullptr; } bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { const FieldDescriptor* extension = pool_->FindExtensionByNumber(containing_type_, number); - if (extension == NULL) { + if (extension == nullptr) { return false; } else { output->type = extension->type(); @@ -318,7 +325,7 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { } -bool ExtensionSet::FindExtension(int wire_type, uint32 field, +bool ExtensionSet::FindExtension(int wire_type, uint32_t field, const Message* containing_type, const internal::ParseContext* ctx, ExtensionInfo* extension, @@ -340,7 +347,7 @@ bool ExtensionSet::FindExtension(int wire_type, uint32 field, return true; } -const char* ExtensionSet::ParseField(uint64 tag, const char* ptr, +const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, const Message* containing_type, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { @@ -357,7 +364,7 @@ const char* ExtensionSet::ParseField(uint64 tag, const char* ptr, } const char* ExtensionSet::ParseFieldMaybeLazily( - uint64 tag, const char* ptr, const Message* containing_type, + uint64_t tag, const char* ptr, const Message* containing_type, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { return ParseField(tag, ptr, containing_type, metadata, ctx); } @@ -369,11 +376,11 @@ const char* ExtensionSet::ParseMessageSetItem( metadata, ctx); } -bool ExtensionSet::ParseField(uint32 tag, io::CodedInputStream* input, +bool ExtensionSet::ParseField(uint32_t tag, io::CodedInputStream* input, const Message* containing_type, UnknownFieldSet* unknown_fields) { UnknownFieldSetFieldSkipper skipper(unknown_fields); - if (input->GetExtensionPool() == NULL) { + if (input->GetExtensionPool() == nullptr) { GeneratedExtensionFinder finder(containing_type); return ParseField(tag, input, &finder, &skipper); } else { @@ -388,7 +395,7 @@ bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, const Message* containing_type, UnknownFieldSet* unknown_fields) { MessageSetFieldSkipper skipper(unknown_fields); - if (input->GetExtensionPool() == NULL) { + if (input->GetExtensionPool() == nullptr) { GeneratedExtensionFinder finder(containing_type); return ParseMessageSet(input, &finder, &skipper); } else { @@ -426,9 +433,9 @@ size_t ExtensionSet::Extension::SpaceUsedExcludingSelfLong() const { repeated_##LOWERCASE##_value->SpaceUsedExcludingSelfLong(); \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(DOUBLE, double); @@ -469,12 +476,13 @@ size_t ExtensionSet::Extension::SpaceUsedExcludingSelfLong() const { return total_size; } -uint8* ExtensionSet::SerializeMessageSetWithCachedSizesToArray( - uint8* target) const { +uint8_t* ExtensionSet::SerializeMessageSetWithCachedSizesToArray( + const MessageLite* extendee, uint8_t* target) const { io::EpsCopyOutputStream stream( target, MessageSetByteSize(), io::CodedOutputStream::IsDefaultSerializationDeterministic()); - return InternalSerializeMessageSetWithCachedSizesToArray(target, &stream); + return InternalSerializeMessageSetWithCachedSizesToArray(extendee, target, + &stream); } bool ExtensionSet::ParseFieldMaybeLazily( @@ -490,7 +498,7 @@ bool ExtensionSet::ParseMessageSet(io::CodedInputStream* input, ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper) { while (true) { - const uint32 tag = input->ReadTag(); + const uint32_t tag = input->ReadTag(); switch (tag) { case 0: return true; @@ -518,7 +526,7 @@ bool ExtensionSet::ParseMessageSetItem(io::CodedInputStream* input, extension_finder, field_skipper); } - bool SkipField(uint32 tag, io::CodedInputStream* input) { + bool SkipField(uint32_t tag, io::CodedInputStream* input) { return field_skipper->SkipField(input, tag); } diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h b/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h index 2a4d2c6839..8d5f45f37e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h @@ -83,7 +83,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( switch (extension.type) { #define HANDLE_VARINT_TYPE(UPPERCASE, CPP_CAMELCASE) \ case WireFormatLite::TYPE_##UPPERCASE: { \ - uint64 value; \ + uint64_t value; \ ptr = VarintParse(ptr, &value); \ GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \ if (extension.is_repeated) { \ @@ -103,7 +103,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( #undef HANDLE_VARINT_TYPE #define HANDLE_SVARINT_TYPE(UPPERCASE, CPP_CAMELCASE, SIZE) \ case WireFormatLite::TYPE_##UPPERCASE: { \ - uint64 val; \ + uint64_t val; \ ptr = VarintParse(ptr, &val); \ GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \ auto value = WireFormatLite::ZigZagDecode##SIZE(val); \ @@ -132,16 +132,16 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( } \ } break - HANDLE_FIXED_TYPE(FIXED32, UInt32, uint32); - HANDLE_FIXED_TYPE(FIXED64, UInt64, uint64); - HANDLE_FIXED_TYPE(SFIXED32, Int32, int32); - HANDLE_FIXED_TYPE(SFIXED64, Int64, int64); + HANDLE_FIXED_TYPE(FIXED32, UInt32, uint32_t); + HANDLE_FIXED_TYPE(FIXED64, UInt64, uint64_t); + HANDLE_FIXED_TYPE(SFIXED32, Int32, int32_t); + HANDLE_FIXED_TYPE(SFIXED64, Int64, int64_t); HANDLE_FIXED_TYPE(FLOAT, Float, float); HANDLE_FIXED_TYPE(DOUBLE, Double, double); #undef HANDLE_FIXED_TYPE case WireFormatLite::TYPE_ENUM: { - uint64 val; + uint64_t val; ptr = VarintParse(ptr, &val); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); int value = val; @@ -181,7 +181,7 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( : MutableMessage(number, WireFormatLite::TYPE_GROUP, *extension.message_info.prototype, extension.descriptor); - uint32 tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP; + uint32_t tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP; return ctx->ParseGroup(value, ptr, tag); } @@ -203,22 +203,22 @@ const char* ExtensionSet::ParseFieldWithExtensionInfo( template <typename Msg, typename T> const char* ExtensionSet::ParseMessageSetItemTmpl( - const char* ptr, const Msg* containing_type, - internal::InternalMetadata* metadata, internal::ParseContext* ctx) { + const char* ptr, const Msg* extendee, internal::InternalMetadata* metadata, + internal::ParseContext* ctx) { TProtoStringType payload; - uint32 type_id = 0; + uint32_t type_id = 0; bool payload_read = false; while (!ctx->Done(&ptr)) { - uint32 tag = static_cast<uint8>(*ptr++); + uint32_t tag = static_cast<uint8_t>(*ptr++); if (tag == WireFormatLite::kMessageSetTypeIdTag) { - uint64 tmp; + uint64_t tmp; ptr = ParseBigVarint(ptr, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); type_id = tmp; if (payload_read) { ExtensionInfo extension; bool was_packed_on_wire; - if (!FindExtension(2, type_id, containing_type, ctx, &extension, + if (!FindExtension(2, type_id, extendee, ctx, &extension, &was_packed_on_wire)) { WriteLengthDelimited(type_id, payload, metadata->mutable_unknown_fields<T>()); @@ -245,12 +245,12 @@ const char* ExtensionSet::ParseMessageSetItemTmpl( } } else if (tag == WireFormatLite::kMessageSetMessageTag) { if (type_id != 0) { - ptr = ParseFieldMaybeLazily(static_cast<uint64>(type_id) * 8 + 2, ptr, - containing_type, metadata, ctx); + ptr = ParseFieldMaybeLazily(static_cast<uint64_t>(type_id) * 8 + 2, ptr, + extendee, metadata, ctx); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); type_id = 0; } else { - int32 size = ReadSize(&ptr); + int32_t size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ptr = ctx->ReadString(ptr, size, &payload); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); @@ -262,7 +262,7 @@ const char* ExtensionSet::ParseMessageSetItemTmpl( ctx->SetLastTag(tag); return ptr; } - ptr = ParseField(tag, ptr, containing_type, metadata, ctx); + ptr = ParseField(tag, ptr, extendee, metadata, ctx); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/field_access_listener.cc b/contrib/libs/protobuf/src/google/protobuf/field_access_listener.cc deleted file mode 100644 index 56e175a7ac..0000000000 --- a/contrib/libs/protobuf/src/google/protobuf/field_access_listener.cc +++ /dev/null @@ -1,52 +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. - -#include <google/protobuf/field_access_listener.h> - -#include <google/protobuf/stubs/once.h> - -namespace google { -namespace protobuf { - -internal::once_flag FieldAccessListener::register_once_ = {}; -FieldAccessListener* FieldAccessListener::field_listener_ = nullptr; - -FieldAccessListener* FieldAccessListener::GetListener() { - return field_listener_; -} - -void FieldAccessListener::RegisterListener(FieldAccessListener* listener) { - // TODO(danilak): Add a GOOGLE_DCHECK for message_injector_ to be nullptr and update - // tests. - internal::call_once(register_once_, [&] { field_listener_ = listener; }); -} - -} // namespace protobuf -} // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/field_access_listener.h b/contrib/libs/protobuf/src/google/protobuf/field_access_listener.h deleted file mode 100644 index f766644570..0000000000 --- a/contrib/libs/protobuf/src/google/protobuf/field_access_listener.h +++ /dev/null @@ -1,246 +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. - -#ifndef GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__ -#define GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__ - -#include <cstddef> -#include <functional> -#include <string> -#include <type_traits> -#include <utility> -#include <vector> - -#include <google/protobuf/stubs/common.h> -#include <google/protobuf/arenastring.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/map.h> -#include <google/protobuf/stubs/once.h> -#include <google/protobuf/repeated_field.h> - - -namespace google { -namespace protobuf { -namespace internal { -template <typename T> -struct ResolvedType { - using type = T; -}; -} // namespace internal -// Tracks the events of field accesses for all protos -// that are built with --inject_field_listener_events. This is a global -// interface which you must implement yourself and register with -// RegisterListener() function. All events consist of Descriptors, -// FieldAccessTypes and the underlying storage for tracking the memory which is -// accessed where possible and makes sense. Users are responsible for the -// implementations to be thread safe. -class FieldAccessListener { - public: - FieldAccessListener() = default; - virtual ~FieldAccessListener() = default; - - // The memory annotations of the proto fields that are touched by the - // accessors. They are returned as if the operation completes. - struct DataAnnotation { - DataAnnotation() = default; - DataAnnotation(const void* other_address, size_t other_size) - : address(other_address), size(other_size) {} - const void* address = nullptr; - size_t size = 0; - }; - using AddressInfo = std::vector<DataAnnotation>; - using AddressInfoExtractor = std::function<AddressInfo()>; - - enum class FieldAccessType { - kAdd, // add_<field>(f) - kAddMutable, // add_<field>() - kGet, // <field>() and <repeated_field>(i) - kClear, // clear_<field>() - kHas, // has_<field>() - kList, // <repeated_field>() - kMutable, // mutable_<field>() - kMutableList, // mutable_<repeated_field>() - kRelease, // release_<field>() - kSet, // set_<field>() and set_<repeated_field>(i) - kSize, // <repeated_field>_size() - }; - - static FieldAccessListener* GetListener(); - - // Registers the field listener, can be called only once, |listener| must - // outlive all proto accesses (in most cases, the lifetime of the program). - static void RegisterListener(FieldAccessListener* listener); - - // All field accessors noted in FieldAccessType have this call. - // |extractor| extracts the address info from the field - virtual void OnFieldAccess(const AddressInfoExtractor& extractor, - const FieldDescriptor* descriptor, - FieldAccessType access_type) = 0; - - // Side effect calls. - virtual void OnDeserializationAccess(const Message* message) = 0; - virtual void OnSerializationAccess(const Message* message) = 0; - virtual void OnReflectionAccess(const Descriptor* descriptor) = 0; - virtual void OnByteSizeAccess(const Message* message) = 0; - // We can probably add more if we need to, like {Merge,Copy}{From}Access. - - // Extracts all the addresses from the underlying fields. - template <typename T> - AddressInfo ExtractFieldInfo(const T* field_value); - - - private: - template <typename T> - AddressInfo ExtractFieldInfoSpecific(const T* field_value, - internal::ResolvedType<T>); - - AddressInfo ExtractFieldInfoSpecific(const Message* field_value, - internal::ResolvedType<Message>); - - AddressInfo ExtractFieldInfoSpecific(const TProtoStringType* field_value, - internal::ResolvedType<TProtoStringType>); - - AddressInfo ExtractFieldInfoSpecific( - const internal::ArenaStringPtr* field_value, - internal::ResolvedType<internal::ArenaStringPtr>); - - template <typename T> - AddressInfo ExtractFieldInfoSpecific( - const RepeatedField<T>* field_value, - internal::ResolvedType<RepeatedField<T>>); - - template <typename T> - AddressInfo ExtractFieldInfoSpecific( - const RepeatedPtrField<T>* field_value, - internal::ResolvedType<RepeatedPtrField<T>>); - - template <typename K, typename V> - AddressInfo ExtractFieldInfoSpecific(const Map<K, V>* field_value, - internal::ResolvedType<Map<K, V>>); - - static internal::once_flag register_once_; - static FieldAccessListener* field_listener_; - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldAccessListener); -}; - -template <typename T> -inline FieldAccessListener::AddressInfo FieldAccessListener::ExtractFieldInfo( - const T* field_value) { - return ExtractFieldInfoSpecific(field_value, internal::ResolvedType<T>()); -} - - -template <typename T> -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific(const T* field_value, - internal::ResolvedType<T>) { - static_assert(std::is_trivial<T>::value, - "This overload should be chosen only for trivial types"); - return FieldAccessListener::AddressInfo{FieldAccessListener::DataAnnotation( - static_cast<const void*>(field_value), sizeof(*field_value))}; -} - -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific( - const TProtoStringType* field_value, internal::ResolvedType<TProtoStringType>) { - return FieldAccessListener::AddressInfo{FieldAccessListener::DataAnnotation( - static_cast<const void*>(field_value->c_str()), field_value->length())}; -} - -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific( - const internal::ArenaStringPtr* field_value, - internal::ResolvedType<internal::ArenaStringPtr>) { - return FieldAccessListener::ExtractFieldInfoSpecific( - field_value->GetPointer(), internal::ResolvedType<TProtoStringType>()); -} - -template <typename T> -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific( - const RepeatedField<T>* field_value, - internal::ResolvedType<RepeatedField<T>>) { - // TODO(jianzhouzh): This can cause data races. Synchronize this if needed. - FieldAccessListener::AddressInfo address_info; - address_info.reserve(field_value->size()); - for (int i = 0, ie = field_value->size(); i < ie; ++i) { - auto sub = ExtractFieldInfoSpecific(&field_value->Get(i), - internal::ResolvedType<T>()); - address_info.insert(address_info.end(), sub.begin(), sub.end()); - } - return address_info; -} - -template <typename T> -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific( - const RepeatedPtrField<T>* field_value, - internal::ResolvedType<RepeatedPtrField<T>>) { - FieldAccessListener::AddressInfo address_info; - // TODO(jianzhouzh): This can cause data races. Synchronize this if needed. - address_info.reserve(field_value->size()); - for (int i = 0, ie = field_value->size(); i < ie; ++i) { - auto sub = ExtractFieldInfoSpecific(&field_value->Get(i), - internal::ResolvedType<T>()); - address_info.insert(address_info.end(), sub.begin(), sub.end()); - } - return address_info; -} - -template <typename K, typename V> -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific( - const Map<K, V>* field_value, internal::ResolvedType<Map<K, V>>) { - // TODO(jianzhouzh): This can cause data races. Synchronize this if needed. - FieldAccessListener::AddressInfo address_info; - address_info.reserve(field_value->size()); - for (auto it = field_value->begin(); it != field_value->end(); ++it) { - auto sub_first = - ExtractFieldInfoSpecific(&it->first, internal::ResolvedType<K>()); - auto sub_second = - ExtractFieldInfoSpecific(&it->second, internal::ResolvedType<V>()); - address_info.insert(address_info.end(), sub_first.begin(), sub_first.end()); - address_info.insert(address_info.end(), sub_second.begin(), - sub_second.end()); - } - return address_info; -} - -inline FieldAccessListener::AddressInfo -FieldAccessListener::ExtractFieldInfoSpecific(const Message* field_value, - internal::ResolvedType<Message>) { - // TODO(jianzhouzh): implement and adjust all annotations in the compiler. - return {}; -} - -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_FIELD_ACCESS_LISTENER_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc index d073936d83..fbb4f12948 100644 --- a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc @@ -36,18 +36,19 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldMask, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldMask, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FieldMask, paths_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldMask, paths_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::FieldMask)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FieldMask)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FieldMask_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FieldMask_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2ffield_5fmask_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -148,28 +149,29 @@ const char* FieldMask::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -213,13 +215,7 @@ size_t FieldMask::ByteSizeLong() const { paths_.Get(i)); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldMask::_class_data_ = { @@ -228,8 +224,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldMask::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FieldMask::GetClassData() const { return &_class_data_; } -void FieldMask::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FieldMask::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FieldMask *>(to)->MergeFrom( static_cast<const FieldMask &>(from)); } @@ -271,8 +267,8 @@ void FieldMask::InternalSwap(FieldMask* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FieldMask* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FieldMask >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FieldMask >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FieldMask* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FieldMask >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FieldMask >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h index c0c7af1a73..02c07a7776 100644 --- a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -59,7 +59,7 @@ struct FieldMaskDefaultTypeInternal; PROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FieldMask* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldMask>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FieldMask* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FieldMask>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT FieldMask final : } inline FieldMask& operator=(FieldMask&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -142,7 +146,7 @@ class PROTOBUF_EXPORT FieldMask final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FieldMask& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc new file mode 100644 index 0000000000..3acfa5f286 --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.cc @@ -0,0 +1,125 @@ +// 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. + +#include <google/protobuf/generated_message_bases.h> + +#include <google/protobuf/parse_context.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/io/zero_copy_stream_impl.h> +#include <google/protobuf/unknown_field_set.h> +#include <google/protobuf/wire_format.h> +#include <google/protobuf/wire_format_lite.h> + +// Must be last: +#include <google/protobuf/port_def.inc> + +namespace google { +namespace protobuf { +namespace internal { + +// ============================================================================= +// ZeroFieldsBase + +void ZeroFieldsBase::Clear() { + _internal_metadata_.Clear<UnknownFieldSet>(); // +} + +ZeroFieldsBase::~ZeroFieldsBase() { + if (GetArenaForAllocation() != nullptr) return; + _internal_metadata_.Delete<UnknownFieldSet>(); +} + +size_t ZeroFieldsBase::ByteSizeLong() const { + return MaybeComputeUnknownFieldsSize(0, &_cached_size_); +} + +const char* ZeroFieldsBase::_InternalParse(const char* ptr, + internal::ParseContext* ctx) { +#define CHK_(x) \ + if (PROTOBUF_PREDICT_FALSE(!(x))) { \ + goto failure; \ + } + + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, _internal_metadata_.mutable_unknown_fields<UnknownFieldSet>(), ptr, + ctx); + CHK_(ptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +::uint8_t* ZeroFieldsBase::_InternalSerialize( + ::uint8_t* target, io::EpsCopyOutputStream* stream) const { + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<UnknownFieldSet>( + UnknownFieldSet::default_instance), + target, stream); + } + return target; +} + +void ZeroFieldsBase::MergeImpl(Message* to_param, const Message& from_param) { + auto* to = static_cast<ZeroFieldsBase*>(to_param); + const auto* from = static_cast<const ZeroFieldsBase*>(&from_param); + GOOGLE_DCHECK_NE(from, to); + to->_internal_metadata_.MergeFrom<UnknownFieldSet>(from->_internal_metadata_); +} + +void ZeroFieldsBase::CopyImpl(Message* to_param, const Message& from_param) { + auto* to = static_cast<ZeroFieldsBase*>(to_param); + const auto* from = static_cast<const ZeroFieldsBase*>(&from_param); + if (from == to) return; + to->_internal_metadata_.Clear<UnknownFieldSet>(); + to->_internal_metadata_.MergeFrom<UnknownFieldSet>(from->_internal_metadata_); +} + +void ZeroFieldsBase::InternalSwap(ZeroFieldsBase* other) { + _internal_metadata_.Swap<UnknownFieldSet>(&other->_internal_metadata_); +} + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include <google/protobuf/port_undef.inc> diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.h new file mode 100644 index 0000000000..29ab66bd4f --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_bases.h @@ -0,0 +1,87 @@ +// 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. + +// This file contains helpers for generated code. +// +// Nothing in this file should be directly referenced by users of protobufs. + +#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__ +#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__ + +#include <google/protobuf/parse_context.h> +#include <google/protobuf/io/zero_copy_stream_impl.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/message.h> + +// Must come last: +#include <google/protobuf/port_def.inc> + +namespace google { +namespace protobuf { +namespace internal { + +// To save code size, protos without any fields are derived from ZeroFieldsBase +// rather than Message. +class PROTOBUF_EXPORT ZeroFieldsBase : public Message { + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final { return true; } + size_t ByteSizeLong() const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + const char* _InternalParse(const char* ptr, + internal::ParseContext* ctx) final; + ::uint8_t* _InternalSerialize(::uint8_t* target, + io::EpsCopyOutputStream* stream) const final; + + protected: + constexpr ZeroFieldsBase() {} + explicit ZeroFieldsBase(Arena* arena, bool is_message_owned) + : Message(arena, is_message_owned) {} + ZeroFieldsBase(const ZeroFieldsBase&) = delete; + ZeroFieldsBase& operator=(const ZeroFieldsBase&) = delete; + ~ZeroFieldsBase() override; + + void SetCachedSize(int size) const final { _cached_size_.Set(size); } + + static void MergeImpl(Message* to, const Message& from); + static void CopyImpl(Message* to, const Message& from); + void InternalSwap(ZeroFieldsBase* other); + + mutable internal::CachedSize _cached_size_; +}; + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include <google/protobuf/port_undef.inc> + +#endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_BASES_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc index 82f48bd1c0..4984ccdc9d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc @@ -43,6 +43,7 @@ #include <google/protobuf/descriptor.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/generated_message_util.h> +#include <google/protobuf/inlined_string_field.h> #include <google/protobuf/map_field.h> #include <google/protobuf/map_field_inl.h> #include <google/protobuf/stubs/mutex.h> @@ -61,6 +62,7 @@ using google::protobuf::internal::DescriptorTable; using google::protobuf::internal::ExtensionSet; using google::protobuf::internal::GenericTypeHandler; using google::protobuf::internal::GetEmptyString; +using google::protobuf::internal::InlinedStringField; using google::protobuf::internal::InternalMetadata; using google::protobuf::internal::LazyField; using google::protobuf::internal::MapFieldBase; @@ -256,6 +258,10 @@ bool Reflection::IsEagerlyVerifiedLazyField( schema_.IsEagerlyVerifiedLazyField(field)); } +bool Reflection::IsInlined(const FieldDescriptor* field) const { + return schema_.IsFieldInlined(field); +} + size_t Reflection::SpaceUsedLong(const Message& message) const { // object_size_ already includes the in-memory representation of each field // in the message, so we only need to account for additional memory used by @@ -277,9 +283,9 @@ size_t Reflection::SpaceUsedLong(const Message& message) const { .SpaceUsedExcludingSelfLong(); \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); @@ -332,6 +338,13 @@ size_t Reflection::SpaceUsedLong(const Message& message) const { switch (field->options().ctype()) { default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { + if (IsInlined(field)) { + const TProtoStringType* ptr = + &GetField<InlinedStringField>(message, field).GetNoArena(); + total_size += StringSpaceUsedExcludingSelfLong(*ptr); + break; + } + const TProtoStringType* ptr = GetField<ArenaStringPtr>(message, field).GetPointer(); @@ -370,6 +383,71 @@ size_t Reflection::SpaceUsedLong(const Message& message) const { return total_size; } +namespace { + +template <bool unsafe_shallow_swap> +struct OneofFieldMover { + template <typename FromType, typename ToType> + void operator()(const FieldDescriptor* field, FromType* from, ToType* to) { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: + to->SetInt32(from->GetInt32()); + break; + case FieldDescriptor::CPPTYPE_INT64: + to->SetInt64(from->GetInt64()); + break; + case FieldDescriptor::CPPTYPE_UINT32: + to->SetUint32(from->GetUint32()); + break; + case FieldDescriptor::CPPTYPE_UINT64: + to->SetUint64(from->GetUint64()); + break; + case FieldDescriptor::CPPTYPE_FLOAT: + to->SetFloat(from->GetFloat()); + break; + case FieldDescriptor::CPPTYPE_DOUBLE: + to->SetDouble(from->GetDouble()); + break; + case FieldDescriptor::CPPTYPE_BOOL: + to->SetBool(from->GetBool()); + break; + case FieldDescriptor::CPPTYPE_ENUM: + to->SetEnum(from->GetEnum()); + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + if (!unsafe_shallow_swap) { + to->SetMessage(from->GetMessage()); + } else { + to->UnsafeSetMessage(from->UnsafeGetMessage()); + } + break; + case FieldDescriptor::CPPTYPE_STRING: + if (!unsafe_shallow_swap) { + to->SetString(from->GetString()); + break; + } + switch (field->options().ctype()) { + default: + case FieldOptions::STRING: { + to->SetArenaStringPtr(from->GetArenaStringPtr()); + break; + } + } + break; + default: + GOOGLE_LOG(FATAL) << "unimplemented type: " << field->cpp_type(); + } + if (unsafe_shallow_swap) { + // Not clearing oneof case after move may cause unwanted "ClearOneof" + // where the residual message or string value is deleted and causes + // use-after-free (only for unsafe swap). + from->ClearOneofCase(); + } + } +}; + +} // namespace + namespace internal { class SwapFieldHelper { @@ -380,6 +458,14 @@ class SwapFieldHelper { const FieldDescriptor* field); template <bool unsafe_shallow_swap> + static void SwapInlinedStrings(const Reflection* r, Message* lhs, + Message* rhs, const FieldDescriptor* field); + + template <bool unsafe_shallow_swap> + static void SwapNonInlinedStrings(const Reflection* r, Message* lhs, + Message* rhs, const FieldDescriptor* field); + + template <bool unsafe_shallow_swap> static void SwapStringField(const Reflection* r, Message* lhs, Message* rhs, const FieldDescriptor* field); @@ -421,21 +507,61 @@ void SwapFieldHelper::SwapRepeatedStringField(const Reflection* r, Message* lhs, } template <bool unsafe_shallow_swap> +void SwapFieldHelper::SwapInlinedStrings(const Reflection* r, Message* lhs, + Message* rhs, + const FieldDescriptor* field) { + // Inlined string field. + Arena* lhs_arena = lhs->GetArenaForAllocation(); + Arena* rhs_arena = rhs->GetArenaForAllocation(); + auto* lhs_string = r->MutableRaw<InlinedStringField>(lhs, field); + auto* rhs_string = r->MutableRaw<InlinedStringField>(rhs, field); + const uint32 index = r->schema_.InlinedStringIndex(field); + uint32* lhs_state = &r->MutableInlinedStringDonatedArray(lhs)[index / 32]; + uint32* rhs_state = &r->MutableInlinedStringDonatedArray(rhs)[index / 32]; + const uint32 mask = ~(static_cast<uint32>(1) << (index % 32)); + if (unsafe_shallow_swap || lhs_arena == rhs_arena) { + lhs_string->Swap(rhs_string, /*default_value=*/nullptr, lhs_arena, + r->IsInlinedStringDonated(*lhs, field), + r->IsInlinedStringDonated(*rhs, field), + /*donating_states=*/lhs_state, rhs_state, mask); + } else { + const TProtoStringType temp = lhs_string->Get(); + lhs_string->Set(nullptr, rhs_string->Get(), lhs_arena, + r->IsInlinedStringDonated(*lhs, field), lhs_state, mask); + rhs_string->Set(nullptr, temp, rhs_arena, + r->IsInlinedStringDonated(*rhs, field), rhs_state, mask); + } +} + +template <bool unsafe_shallow_swap> +void SwapFieldHelper::SwapNonInlinedStrings(const Reflection* r, Message* lhs, + Message* rhs, + const FieldDescriptor* field) { + ArenaStringPtr* lhs_string = r->MutableRaw<ArenaStringPtr>(lhs, field); + ArenaStringPtr* rhs_string = r->MutableRaw<ArenaStringPtr>(rhs, field); + if (unsafe_shallow_swap) { + ArenaStringPtr::UnsafeShallowSwap(lhs_string, rhs_string); + } else { + SwapFieldHelper::SwapArenaStringPtr( + r->DefaultRaw<ArenaStringPtr>(field).GetPointer(), // + lhs_string, lhs->GetArenaForAllocation(), // + rhs_string, rhs->GetArenaForAllocation()); + } +} + +template <bool unsafe_shallow_swap> void SwapFieldHelper::SwapStringField(const Reflection* r, Message* lhs, Message* rhs, const FieldDescriptor* field) { switch (field->options().ctype()) { default: case FieldOptions::STRING: { - ArenaStringPtr* lhs_string = r->MutableRaw<ArenaStringPtr>(lhs, field); - ArenaStringPtr* rhs_string = r->MutableRaw<ArenaStringPtr>(rhs, field); - if (unsafe_shallow_swap) { - ArenaStringPtr::UnsafeShallowSwap(lhs_string, rhs_string); + if (r->IsInlined(field)) { + SwapFieldHelper::SwapInlinedStrings<unsafe_shallow_swap>(r, lhs, rhs, + field); } else { - SwapFieldHelper::SwapArenaStringPtr( - r->DefaultRaw<ArenaStringPtr>(field).GetPointer(), // - lhs_string, lhs->GetArenaForAllocation(), // - rhs_string, rhs->GetArenaForAllocation()); + SwapFieldHelper::SwapNonInlinedStrings<unsafe_shallow_swap>(r, lhs, rhs, + field); } break; } @@ -550,9 +676,9 @@ void Reflection::SwapField(Message* message1, Message* message2, ->Swap(MutableRaw<RepeatedField<TYPE> >(message2, field)); \ break; - SWAP_ARRAYS(INT32, int32); + SWAP_ARRAYS(INT32, int32_t); SWAP_ARRAYS(INT64, int64); - SWAP_ARRAYS(UINT32, uint32); + SWAP_ARRAYS(UINT32, uint32_t); SWAP_ARRAYS(UINT64, uint64); SWAP_ARRAYS(FLOAT, float); SWAP_ARRAYS(DOUBLE, double); @@ -580,9 +706,9 @@ void Reflection::SwapField(Message* message1, Message* message2, *MutableRaw<TYPE>(message2, field)); \ break; - SWAP_VALUES(INT32, int32); + SWAP_VALUES(INT32, int32_t); SWAP_VALUES(INT64, int64); - SWAP_VALUES(UINT32, uint32); + SWAP_VALUES(UINT32, uint32_t); SWAP_VALUES(UINT64, uint64); SWAP_VALUES(FLOAT, float); SWAP_VALUES(DOUBLE, double); @@ -607,9 +733,6 @@ void Reflection::SwapField(Message* message1, Message* message2, void Reflection::UnsafeShallowSwapField(Message* message1, Message* message2, const FieldDescriptor* field) const { - GOOGLE_DCHECK_EQ(message1->GetArenaForAllocation(), - message2->GetArenaForAllocation()); - if (!field->is_repeated()) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { internal::SwapFieldHelper::SwapMessageField<true>(this, message1, @@ -630,9 +753,9 @@ void Reflection::UnsafeShallowSwapField(Message* message1, Message* message2, ->InternalSwap(MutableRaw<RepeatedField<TYPE>>(message2, field)); \ break; - SHALLOW_SWAP_ARRAYS(INT32, int32); + SHALLOW_SWAP_ARRAYS(INT32, int32_t); SHALLOW_SWAP_ARRAYS(INT64, int64); - SHALLOW_SWAP_ARRAYS(UINT32, uint32); + SHALLOW_SWAP_ARRAYS(UINT32, uint32_t); SHALLOW_SWAP_ARRAYS(UINT64, uint64); SHALLOW_SWAP_ARRAYS(FLOAT, float); SHALLOW_SWAP_ARRAYS(DOUBLE, double); @@ -654,158 +777,130 @@ void Reflection::UnsafeShallowSwapField(Message* message1, Message* message2, } } -void Reflection::SwapOneofField(Message* message1, Message* message2, +// Swaps oneof field between lhs and rhs. If unsafe_shallow_swap is true, it +// directly swaps oneof values; otherwise, it may involve copy/delete. Note that +// two messages may have different oneof cases. So, it has to be done in three +// steps (i.e. lhs -> temp, rhs -> lhs, temp -> rhs). +template <bool unsafe_shallow_swap> +void Reflection::SwapOneofField(Message* lhs, Message* rhs, const OneofDescriptor* oneof_descriptor) const { - GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); - uint32 oneof_case1 = GetOneofCase(*message1, oneof_descriptor); - uint32 oneof_case2 = GetOneofCase(*message2, oneof_descriptor); - - int32 temp_int32 = 0; - int64 temp_int64 = 0; - uint32 temp_uint32 = 0; - uint64 temp_uint64 = 0; - float temp_float = 0; - double temp_double = 0; - bool temp_bool = false; - int temp_int = 0; - Message* temp_message = nullptr; - TProtoStringType temp_string; - - // Stores message1's oneof field to a temp variable. - const FieldDescriptor* field1 = nullptr; - if (oneof_case1 > 0) { - field1 = descriptor_->FindFieldByNumber(oneof_case1); - // oneof_descriptor->field(oneof_case1); - switch (field1->cpp_type()) { -#define GET_TEMP_VALUE(CPPTYPE, TYPE) \ - case FieldDescriptor::CPPTYPE_##CPPTYPE: \ - temp_##TYPE = GetField<TYPE>(*message1, field1); \ - break; - - GET_TEMP_VALUE(INT32, int32); - GET_TEMP_VALUE(INT64, int64); - GET_TEMP_VALUE(UINT32, uint32); - GET_TEMP_VALUE(UINT64, uint64); - GET_TEMP_VALUE(FLOAT, float); - GET_TEMP_VALUE(DOUBLE, double); - GET_TEMP_VALUE(BOOL, bool); - GET_TEMP_VALUE(ENUM, int); -#undef GET_TEMP_VALUE - case FieldDescriptor::CPPTYPE_MESSAGE: - temp_message = ReleaseMessage(message1, field1); - break; - - case FieldDescriptor::CPPTYPE_STRING: - temp_string = GetString(*message1, field1); - break; - - default: - GOOGLE_LOG(FATAL) << "Unimplemented type: " << field1->cpp_type(); - } - } - - // Sets message1's oneof field from the message2's oneof field. - if (oneof_case2 > 0) { - const FieldDescriptor* field2 = descriptor_->FindFieldByNumber(oneof_case2); - switch (field2->cpp_type()) { -#define SET_ONEOF_VALUE1(CPPTYPE, TYPE) \ - case FieldDescriptor::CPPTYPE_##CPPTYPE: \ - SetField<TYPE>(message1, field2, GetField<TYPE>(*message2, field2)); \ - break; - - SET_ONEOF_VALUE1(INT32, int32); - SET_ONEOF_VALUE1(INT64, int64); - SET_ONEOF_VALUE1(UINT32, uint32); - SET_ONEOF_VALUE1(UINT64, uint64); - SET_ONEOF_VALUE1(FLOAT, float); - SET_ONEOF_VALUE1(DOUBLE, double); - SET_ONEOF_VALUE1(BOOL, bool); - SET_ONEOF_VALUE1(ENUM, int); -#undef SET_ONEOF_VALUE1 - case FieldDescriptor::CPPTYPE_MESSAGE: - SetAllocatedMessage(message1, ReleaseMessage(message2, field2), field2); - break; - - case FieldDescriptor::CPPTYPE_STRING: - SetString(message1, field2, GetString(*message2, field2)); - break; - - default: - GOOGLE_LOG(FATAL) << "Unimplemented type: " << field2->cpp_type(); - } - } else { - ClearOneof(message1, oneof_descriptor); - } - - // Sets message2's oneof field from the temp variable. - if (oneof_case1 > 0) { - switch (field1->cpp_type()) { -#define SET_ONEOF_VALUE2(CPPTYPE, TYPE) \ - case FieldDescriptor::CPPTYPE_##CPPTYPE: \ - SetField<TYPE>(message2, field1, temp_##TYPE); \ - break; - - SET_ONEOF_VALUE2(INT32, int32); - SET_ONEOF_VALUE2(INT64, int64); - SET_ONEOF_VALUE2(UINT32, uint32); - SET_ONEOF_VALUE2(UINT64, uint64); - SET_ONEOF_VALUE2(FLOAT, float); - SET_ONEOF_VALUE2(DOUBLE, double); - SET_ONEOF_VALUE2(BOOL, bool); - SET_ONEOF_VALUE2(ENUM, int); -#undef SET_ONEOF_VALUE2 - case FieldDescriptor::CPPTYPE_MESSAGE: - SetAllocatedMessage(message2, temp_message, field1); - break; + // Wraps a local variable to temporarily store oneof value. + struct LocalVarWrapper { +#define LOCAL_VAR_ACCESSOR(type, var, name) \ + type Get##name() const { return oneof_val.type_##var; } \ + void Set##name(type v) { oneof_val.type_##var = v; } + + LOCAL_VAR_ACCESSOR(int32_t, int32, Int32); + LOCAL_VAR_ACCESSOR(int64, int64, Int64); + LOCAL_VAR_ACCESSOR(uint32_t, uint32, Uint32); + LOCAL_VAR_ACCESSOR(uint64, uint64, Uint64); + LOCAL_VAR_ACCESSOR(float, float, Float); + LOCAL_VAR_ACCESSOR(double, double, Double); + LOCAL_VAR_ACCESSOR(bool, bool, Bool); + LOCAL_VAR_ACCESSOR(int, enum, Enum); + LOCAL_VAR_ACCESSOR(Message*, message, Message); + LOCAL_VAR_ACCESSOR(ArenaStringPtr, arena_string_ptr, ArenaStringPtr); + const TProtoStringType& GetString() const { return string_val; } + void SetString(const TProtoStringType& v) { string_val = v; } + Message* UnsafeGetMessage() const { return GetMessage(); } + void UnsafeSetMessage(Message* v) { SetMessage(v); } + void ClearOneofCase() {} + + union { + int32_t type_int32; + int64 type_int64; + uint32_t type_uint32; + uint64 type_uint64; + float type_float; + double type_double; + bool type_bool; + int type_enum; + Message* type_message; + internal::ArenaStringPtr type_arena_string_ptr; + } oneof_val; + + // TProtoStringType cannot be in union. + TProtoStringType string_val; + }; + + // Wraps a message pointer to read and write a field. + struct MessageWrapper { +#define MESSAGE_FIELD_ACCESSOR(type, var, name) \ + type Get##name() const { \ + return reflection->GetField<type>(*message, field); \ + } \ + void Set##name(type v) { reflection->SetField<type>(message, field, v); } + + MESSAGE_FIELD_ACCESSOR(int32_t, int32, Int32); + MESSAGE_FIELD_ACCESSOR(int64, int64, Int64); + MESSAGE_FIELD_ACCESSOR(uint32_t, uint32, Uint32); + MESSAGE_FIELD_ACCESSOR(uint64, uint64, Uint64); + MESSAGE_FIELD_ACCESSOR(float, float, Float); + MESSAGE_FIELD_ACCESSOR(double, double, Double); + MESSAGE_FIELD_ACCESSOR(bool, bool, Bool); + MESSAGE_FIELD_ACCESSOR(int, enum, Enum); + MESSAGE_FIELD_ACCESSOR(ArenaStringPtr, arena_string_ptr, ArenaStringPtr); + TProtoStringType GetString() const { + return reflection->GetString(*message, field); + } + void SetString(const TProtoStringType& v) { + reflection->SetString(message, field, v); + } + Message* GetMessage() const { + return reflection->ReleaseMessage(message, field); + } + void SetMessage(Message* v) { + reflection->SetAllocatedMessage(message, v, field); + } + Message* UnsafeGetMessage() const { + return reflection->UnsafeArenaReleaseMessage(message, field); + } + void UnsafeSetMessage(Message* v) { + reflection->UnsafeArenaSetAllocatedMessage(message, v, field); + } + void ClearOneofCase() { + *reflection->MutableOneofCase(message, field->containing_oneof()) = 0; + } + + const Reflection* reflection; + Message* message; + const FieldDescriptor* field; + }; - case FieldDescriptor::CPPTYPE_STRING: - SetString(message2, field1, temp_string); - break; - - default: - GOOGLE_LOG(FATAL) << "Unimplemented type: " << field1->cpp_type(); - } - } else { - ClearOneof(message2, oneof_descriptor); - } -} - -void Reflection::UnsafeShallowSwapOneofField( - Message* message1, Message* message2, - const OneofDescriptor* oneof_descriptor) const { - GOOGLE_DCHECK_EQ(message1->GetArenaForAllocation(), - message2->GetArenaForAllocation()); - - uint32 oneof_case1 = GetOneofCase(*message1, oneof_descriptor); - const FieldDescriptor* field1 = - oneof_case1 > 0 ? descriptor_->FindFieldByNumber(oneof_case1) : nullptr; - uint32 oneof_case2 = GetOneofCase(*message2, oneof_descriptor); - const FieldDescriptor* field2 = - oneof_case2 > 0 ? descriptor_->FindFieldByNumber(oneof_case2) : nullptr; - - if ((field1 != nullptr && - field1->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) || - (field2 != nullptr && - field2->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE)) { - // Fallback to SwapOneofField for non-message fields. - SwapOneofField(message1, message2, oneof_descriptor); - return; - } - - Message* temp_message = - oneof_case1 > 0 ? UnsafeArenaReleaseMessage(message1, field1) : nullptr; - - if (oneof_case2 > 0) { - UnsafeArenaSetAllocatedMessage( - message1, UnsafeArenaReleaseMessage(message2, field2), field2); - } else { - ClearOneof(message1, oneof_descriptor); + GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); + uint32 oneof_case_lhs = GetOneofCase(*lhs, oneof_descriptor); + uint32 oneof_case_rhs = GetOneofCase(*rhs, oneof_descriptor); + + LocalVarWrapper temp; + MessageWrapper lhs_wrapper, rhs_wrapper; + const FieldDescriptor* field_lhs = nullptr; + OneofFieldMover<unsafe_shallow_swap> mover; + // lhs --> temp + if (oneof_case_lhs > 0) { + field_lhs = descriptor_->FindFieldByNumber(oneof_case_lhs); + lhs_wrapper = {this, lhs, field_lhs}; + mover(field_lhs, &lhs_wrapper, &temp); + } + // rhs --> lhs + if (oneof_case_rhs > 0) { + const FieldDescriptor* f = descriptor_->FindFieldByNumber(oneof_case_rhs); + lhs_wrapper = {this, lhs, f}; + rhs_wrapper = {this, rhs, f}; + mover(f, &rhs_wrapper, &lhs_wrapper); + } else if (!unsafe_shallow_swap) { + ClearOneof(lhs, oneof_descriptor); + } + // temp --> rhs + if (oneof_case_lhs > 0) { + rhs_wrapper = {this, rhs, field_lhs}; + mover(field_lhs, &temp, &rhs_wrapper); + } else if (!unsafe_shallow_swap) { + ClearOneof(rhs, oneof_descriptor); } - if (oneof_case1 > 0) { - UnsafeArenaSetAllocatedMessage(message2, temp_message, field1); - } else { - ClearOneof(message2, oneof_descriptor); + if (unsafe_shallow_swap) { + *MutableOneofCase(lhs, oneof_descriptor) = oneof_case_rhs; + *MutableOneofCase(rhs, oneof_descriptor) = oneof_case_lhs; } } @@ -858,47 +953,9 @@ void Reflection::Swap(Message* message1, Message* message2) const { return; } - for (int i = 0; i <= last_non_weak_field_index_; i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (schema_.InRealOneof(field)) continue; - if (schema_.IsFieldStripped(field)) continue; - SwapField(message1, message2, field); - } - const int oneof_decl_count = descriptor_->oneof_decl_count(); - for (int i = 0; i < oneof_decl_count; i++) { - const OneofDescriptor* oneof = descriptor_->oneof_decl(i); - if (!oneof->is_synthetic()) { - SwapOneofField(message1, message2, oneof); - } - } + GOOGLE_DCHECK_EQ(message1->GetOwningArena(), message2->GetOwningArena()); - // Swapping bits need to happen after swapping fields, because the latter may - // depend on the has bit information. - if (schema_.HasHasbits()) { - uint32* has_bits1 = MutableHasBits(message1); - uint32* has_bits2 = MutableHasBits(message2); - - int fields_with_has_bits = 0; - for (int i = 0; i < descriptor_->field_count(); i++) { - const FieldDescriptor* field = descriptor_->field(i); - if (field->is_repeated() || schema_.InRealOneof(field)) { - continue; - } - fields_with_has_bits++; - } - - int has_bits_size = (fields_with_has_bits + 31) / 32; - - for (int i = 0; i < has_bits_size; i++) { - std::swap(has_bits1[i], has_bits2[i]); - } - } - - if (schema_.HasExtensionSet()) { - MutableExtensionSet(message1)->Swap(MutableExtensionSet(message2)); - } - - MutableUnknownFields(message1)->Swap(MutableUnknownFields(message2)); + UnsafeArenaSwap(message1, message2); } template <bool unsafe_shallow_swap> @@ -927,6 +984,9 @@ void Reflection::SwapFieldsImpl( std::set<int> swapped_oneof; + GOOGLE_DCHECK(!unsafe_shallow_swap || message1->GetArenaForAllocation() == + message2->GetArenaForAllocation()); + for (const auto* field : fields) { CheckInvalidAccess(schema_, field); if (field->is_extension()) { @@ -945,12 +1005,8 @@ void Reflection::SwapFieldsImpl( continue; } swapped_oneof.insert(oneof_index); - if (unsafe_shallow_swap) { - UnsafeShallowSwapOneofField(message1, message2, - field->containing_oneof()); - } else { - SwapOneofField(message1, message2, field->containing_oneof()); - } + SwapOneofField<unsafe_shallow_swap>(message1, message2, + field->containing_oneof()); } else { // Swap field. if (unsafe_shallow_swap) { @@ -981,6 +1037,13 @@ void Reflection::UnsafeShallowSwapFields( SwapFieldsImpl<true>(message1, message2, fields); } +void Reflection::UnsafeArenaSwapFields( + Message* lhs, Message* rhs, + const std::vector<const FieldDescriptor*>& fields) const { + GOOGLE_DCHECK_EQ(lhs->GetArenaForAllocation(), rhs->GetArenaForAllocation()); + UnsafeShallowSwapFields(lhs, rhs, fields); +} + // ------------------------------------------------------------------- bool Reflection::HasField(const Message& message, @@ -1000,6 +1063,52 @@ bool Reflection::HasField(const Message& message, } } +void Reflection::UnsafeArenaSwap(Message* lhs, Message* rhs) const { + if (lhs == rhs) return; + + MutableInternalMetadata(lhs)->InternalSwap(MutableInternalMetadata(rhs)); + + for (int i = 0; i <= last_non_weak_field_index_; i++) { + const FieldDescriptor* field = descriptor_->field(i); + if (schema_.InRealOneof(field)) continue; + if (schema_.IsFieldStripped(field)) continue; + UnsafeShallowSwapField(lhs, rhs, field); + } + const int oneof_decl_count = descriptor_->oneof_decl_count(); + for (int i = 0; i < oneof_decl_count; i++) { + const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + if (!oneof->is_synthetic()) { + SwapOneofField<true>(lhs, rhs, oneof); + } + } + + // Swapping bits need to happen after swapping fields, because the latter may + // depend on the has bit information. + if (schema_.HasHasbits()) { + uint32* lhs_has_bits = MutableHasBits(lhs); + uint32* rhs_has_bits = MutableHasBits(rhs); + + int fields_with_has_bits = 0; + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + if (field->is_repeated() || schema_.InRealOneof(field)) { + continue; + } + fields_with_has_bits++; + } + + int has_bits_size = (fields_with_has_bits + 31) / 32; + + for (int i = 0; i < has_bits_size; i++) { + std::swap(lhs_has_bits[i], rhs_has_bits[i]); + } + } + + if (schema_.HasExtensionSet()) { + MutableExtensionSet(lhs)->InternalSwap(MutableExtensionSet(rhs)); + } +} + int Reflection::FieldSize(const Message& message, const FieldDescriptor* field) const { USAGE_CHECK_MESSAGE_TYPE(FieldSize); @@ -1014,9 +1123,9 @@ int Reflection::FieldSize(const Message& message, case FieldDescriptor::CPPTYPE_##UPPERCASE: \ return GetRaw<RepeatedField<LOWERCASE> >(message, field).size() - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); @@ -1068,9 +1177,9 @@ void Reflection::ClearField(Message* message, *MutableRaw<TYPE>(message, field) = field->default_value_##TYPE(); \ break; - CLEAR_TYPE(INT32, int32); + CLEAR_TYPE(INT32, int32_t); CLEAR_TYPE(INT64, int64); - CLEAR_TYPE(UINT32, uint32); + CLEAR_TYPE(UINT32, uint32_t); CLEAR_TYPE(UINT64, uint64); CLEAR_TYPE(FLOAT, float); CLEAR_TYPE(DOUBLE, double); @@ -1086,6 +1195,12 @@ void Reflection::ClearField(Message* message, switch (field->options().ctype()) { default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { + if (IsInlined(field)) { + // Currently, string with default value can't be inlined. So we + // don't have to handle default value here. + MutableRaw<InlinedStringField>(message, field)->ClearToEmpty(); + break; + } const TProtoStringType* default_ptr = DefaultRaw<ArenaStringPtr>(field).GetPointer(); MutableRaw<ArenaStringPtr>(message, field) @@ -1098,7 +1213,7 @@ void Reflection::ClearField(Message* message, } case FieldDescriptor::CPPTYPE_MESSAGE: - if (schema_.HasBitIndex(field) == static_cast<uint32>(-1)) { + if (schema_.HasBitIndex(field) == static_cast<uint32_t>(-1)) { // Proto3 does not have has-bits and we need to set a message field // to nullptr in order to indicate its un-presence. if (message->GetArenaForAllocation() == nullptr) { @@ -1118,9 +1233,9 @@ void Reflection::ClearField(Message* message, MutableRaw<RepeatedField<LOWERCASE> >(message, field)->Clear(); \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); @@ -1168,9 +1283,9 @@ void Reflection::RemoveLast(Message* message, MutableRaw<RepeatedField<LOWERCASE> >(message, field)->RemoveLast(); \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); @@ -1228,6 +1343,26 @@ Message* Reflection::ReleaseLast(Message* message, #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE } +Message* Reflection::UnsafeArenaReleaseLast( + Message* message, const FieldDescriptor* field) const { + USAGE_CHECK_ALL(UnsafeArenaReleaseLast, REPEATED, MESSAGE); + CheckInvalidAccess(schema_, field); + + if (field->is_extension()) { + return static_cast<Message*>( + MutableExtensionSet(message)->UnsafeArenaReleaseLast(field->number())); + } else { + if (IsMapFieldInApi(field)) { + return MutableRaw<MapFieldBase>(message, field) + ->MutableRepeatedField() + ->UnsafeArenaReleaseLast<GenericTypeHandler<Message>>(); + } else { + return MutableRaw<RepeatedPtrFieldBase>(message, field) + ->UnsafeArenaReleaseLast<GenericTypeHandler<Message>>(); + } + } +} + void Reflection::SwapElements(Message* message, const FieldDescriptor* field, int index1, int index2) const { USAGE_CHECK_MESSAGE_TYPE(Swap); @@ -1244,9 +1379,9 @@ void Reflection::SwapElements(Message* message, const FieldDescriptor* field, ->SwapElements(index1, index2); \ break - HANDLE_TYPE(INT32, int32); + HANDLE_TYPE(INT32, int32_t); HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); + HANDLE_TYPE(UINT32, uint32_t); HANDLE_TYPE(UINT64, uint64); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); @@ -1278,10 +1413,10 @@ struct FieldNumberSorter { } }; -bool IsIndexInHasBitSet(const uint32* has_bit_set, uint32 has_bit_index) { +bool IsIndexInHasBitSet(const uint32_t* has_bit_set, uint32_t has_bit_index) { GOOGLE_DCHECK_NE(has_bit_index, ~0u); return ((has_bit_set[has_bit_index / 32] >> (has_bit_index % 32)) & - static_cast<uint32>(1)) != 0; + static_cast<uint32_t>(1)) != 0; } bool CreateUnknownEnumValues(const FileDescriptor* file) { @@ -1310,9 +1445,9 @@ void Reflection::ListFieldsMayFailOnStripped( // encapsulation because this function takes a noticeable about of CPU // fleetwide and properly allowing this optimization through public interfaces // seems more trouble than it is worth. - const uint32* const has_bits = + const uint32_t* const has_bits = schema_.HasHasbits() ? GetHasBits(message) : nullptr; - const uint32* const has_bits_indices = schema_.has_bit_indices_; + const uint32_t* const has_bits_indices = schema_.has_bit_indices_; output->reserve(descriptor_->field_count()); const int last_non_weak_field_index = last_non_weak_field_index_; for (int i = 0; i <= last_non_weak_field_index; i++) { @@ -1327,14 +1462,15 @@ void Reflection::ListFieldsMayFailOnStripped( } else { const OneofDescriptor* containing_oneof = field->containing_oneof(); if (schema_.InRealOneof(field)) { - const uint32* const oneof_case_array = GetConstPointerAtOffset<uint32>( - &message, schema_.oneof_case_offset_); + const uint32_t* const oneof_case_array = + GetConstPointerAtOffset<uint32_t>(&message, + schema_.oneof_case_offset_); // Equivalent to: HasOneofField(message, field) if (static_cast<int64>(oneof_case_array[containing_oneof->index()]) == field->number()) { output->push_back(field); } - } else if (has_bits && has_bits_indices[i] != static_cast<uint32>(-1)) { + } else if (has_bits && has_bits_indices[i] != static_cast<uint32_t>(-1)) { CheckInvalidAccess(schema_, field); // Equivalent to: HasBit(message, field) if (IsIndexInHasBitSet(has_bits, has_bits_indices[i])) { @@ -1427,9 +1563,9 @@ void Reflection::ListFieldsOmitStripped( } \ } -DEFINE_PRIMITIVE_ACCESSORS(Int32, int32, int32, INT32) +DEFINE_PRIMITIVE_ACCESSORS(Int32, int32_t, int32_t, INT32) DEFINE_PRIMITIVE_ACCESSORS(Int64, int64, int64, INT64) -DEFINE_PRIMITIVE_ACCESSORS(UInt32, uint32, uint32, UINT32) +DEFINE_PRIMITIVE_ACCESSORS(UInt32, uint32_t, uint32_t, UINT32) DEFINE_PRIMITIVE_ACCESSORS(UInt64, uint64, uint64, UINT64) DEFINE_PRIMITIVE_ACCESSORS(Float, float, float, FLOAT) DEFINE_PRIMITIVE_ACCESSORS(Double, double, double, DOUBLE) @@ -1451,6 +1587,10 @@ TProtoStringType Reflection::GetString(const Message& message, switch (field->options().ctype()) { default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { + if (IsInlined(field)) { + return GetField<InlinedStringField>(message, field).GetNoArena(); + } + if (auto* value = GetField<ArenaStringPtr>(message, field).GetPointer()) { return *value; @@ -1475,6 +1615,10 @@ const TProtoStringType& Reflection::GetStringReference(const Message& message, switch (field->options().ctype()) { default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { + if (IsInlined(field)) { + return GetField<InlinedStringField>(message, field).GetNoArena(); + } + if (auto* value = GetField<ArenaStringPtr>(message, field).GetPointer()) { return *value; @@ -1496,6 +1640,17 @@ void Reflection::SetString(Message* message, const FieldDescriptor* field, switch (field->options().ctype()) { default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { + if (IsInlined(field)) { + const uint32_t index = schema_.InlinedStringIndex(field); + uint32_t* states = + &MutableInlinedStringDonatedArray(message)[index / 32]; + uint32_t mask = ~(static_cast<uint32_t>(1) << (index % 32)); + MutableField<InlinedStringField>(message, field) + ->Set(nullptr, value, message->GetArenaForAllocation(), + IsInlinedStringDonated(*message, field), states, mask); + break; + } + // Oneof string fields are never set as a default instance. // We just need to pass some arbitrary default string to make it work. // This allows us to not have the real default accessible from @@ -1599,7 +1754,7 @@ int Reflection::GetEnumValue(const Message& message, const FieldDescriptor* field) const { USAGE_CHECK_ALL(GetEnumValue, SINGULAR, ENUM); - int32 value; + int32_t value; if (field->is_extension()) { value = GetExtensionSet(message).GetEnum( field->number(), field->default_value_enum()->number()); @@ -1838,6 +1993,7 @@ void Reflection::UnsafeArenaSetAllocatedMessage( USAGE_CHECK_ALL(SetAllocatedMessage, SINGULAR, MESSAGE); CheckInvalidAccess(schema_, field); + if (field->is_extension()) { MutableExtensionSet(message)->UnsafeArenaSetAllocatedMessage( field->number(), field->type(), field, sub_message); @@ -1868,10 +2024,8 @@ void Reflection::UnsafeArenaSetAllocatedMessage( void Reflection::SetAllocatedMessage(Message* message, Message* sub_message, const FieldDescriptor* field) const { -#ifdef PROTOBUF_INTERNAL_USE_MUST_USE_RESULT - GOOGLE_DCHECK(sub_message->GetOwningArena() == nullptr || + GOOGLE_DCHECK(sub_message == nullptr || sub_message->GetOwningArena() == nullptr || sub_message->GetOwningArena() == message->GetArenaForAllocation()); -#endif // PROTOBUF_INTERNAL_USE_MUST_USE_RESULT CheckInvalidAccess(schema_, field); // If message and sub-message are in different memory ownership domains @@ -2051,6 +2205,27 @@ void Reflection::AddAllocatedMessage(Message* message, } } +void Reflection::UnsafeArenaAddAllocatedMessage(Message* message, + const FieldDescriptor* field, + Message* new_entry) const { + USAGE_CHECK_ALL(UnsafeArenaAddAllocatedMessage, REPEATED, MESSAGE); + CheckInvalidAccess(schema_, field); + + if (field->is_extension()) { + MutableExtensionSet(message)->UnsafeArenaAddAllocatedMessage(field, + new_entry); + } else { + RepeatedPtrFieldBase* repeated = nullptr; + if (IsMapFieldInApi(field)) { + repeated = + MutableRaw<MapFieldBase>(message, field)->MutableRepeatedField(); + } else { + repeated = MutableRaw<RepeatedPtrFieldBase>(message, field); + } + repeated->UnsafeArenaAddAllocated<GenericTypeHandler<Message>>(new_entry); + } +} + void* Reflection::MutableRawRepeatedField(Message* message, const FieldDescriptor* field, FieldDescriptor::CppType cpptype, @@ -2115,7 +2290,7 @@ const FieldDescriptor* Reflection::GetOneofFieldDescriptor( const FieldDescriptor* field = oneof_descriptor->field(0); return HasField(message, field) ? field : nullptr; } - uint32 field_number = GetOneofCase(message, oneof_descriptor); + uint32_t field_number = GetOneofCase(message, oneof_descriptor); if (field_number == 0) { return nullptr; } @@ -2218,40 +2393,25 @@ Type* Reflection::MutableRawNonOneof(Message* message, } template <typename Type> -const Type& Reflection::GetRaw(const Message& message, - const FieldDescriptor* field) const { - GOOGLE_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field)) - << "Field = " << field->full_name(); - return GetConstRefAtOffset<Type>(message, schema_.GetFieldOffset(field)); -} - -template <typename Type> Type* Reflection::MutableRaw(Message* message, const FieldDescriptor* field) const { return GetPointerAtOffset<Type>(message, schema_.GetFieldOffset(field)); } -const uint32* Reflection::GetHasBits(const Message& message) const { +const uint32_t* Reflection::GetHasBits(const Message& message) const { GOOGLE_DCHECK(schema_.HasHasbits()); - return &GetConstRefAtOffset<uint32>(message, schema_.HasBitsOffset()); + return &GetConstRefAtOffset<uint32_t>(message, schema_.HasBitsOffset()); } -uint32* Reflection::MutableHasBits(Message* message) const { +uint32_t* Reflection::MutableHasBits(Message* message) const { GOOGLE_DCHECK(schema_.HasHasbits()); - return GetPointerAtOffset<uint32>(message, schema_.HasBitsOffset()); + return GetPointerAtOffset<uint32_t>(message, schema_.HasBitsOffset()); } -uint32 Reflection::GetOneofCase(const Message& message, - const OneofDescriptor* oneof_descriptor) const { - GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); - return GetConstRefAtOffset<uint32>( - message, schema_.GetOneofCaseOffset(oneof_descriptor)); -} - -uint32* Reflection::MutableOneofCase( +uint32_t* Reflection::MutableOneofCase( Message* message, const OneofDescriptor* oneof_descriptor) const { GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); - return GetPointerAtOffset<uint32>( + return GetPointerAtOffset<uint32_t>( message, schema_.GetOneofCaseOffset(oneof_descriptor)); } @@ -2276,11 +2436,31 @@ InternalMetadata* Reflection::MutableInternalMetadata(Message* message) const { schema_.GetMetadataOffset()); } +const uint32_t* Reflection::GetInlinedStringDonatedArray( + const Message& message) const { + GOOGLE_DCHECK(schema_.HasInlinedString()); + return &GetConstRefAtOffset<uint32_t>(message, + schema_.InlinedStringDonatedOffset()); +} + +uint32_t* Reflection::MutableInlinedStringDonatedArray(Message* message) const { + GOOGLE_DCHECK(schema_.HasHasbits()); + return GetPointerAtOffset<uint32_t>(message, + schema_.InlinedStringDonatedOffset()); +} + +// Simple accessors for manipulating _inlined_string_donated_; +bool Reflection::IsInlinedStringDonated(const Message& message, + const FieldDescriptor* field) const { + return IsIndexInHasBitSet(GetInlinedStringDonatedArray(message), + schema_.InlinedStringIndex(field)); +} + // Simple accessors for manipulating has_bits_. bool Reflection::HasBit(const Message& message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!field->options().weak()); - if (schema_.HasBitIndex(field) != static_cast<uint32>(-1)) { + if (schema_.HasBitIndex(field) != static_cast<uint32_t>(-1)) { return IsIndexInHasBitSet(GetHasBits(message), schema_.HasBitIndex(field)); } @@ -2307,6 +2487,12 @@ bool Reflection::HasBit(const Message& message, case FieldDescriptor::CPPTYPE_STRING: switch (field->options().ctype()) { default: { + if (IsInlined(field)) { + return !GetField<InlinedStringField>(message, field) + .GetNoArena() + .empty(); + } + return GetField<ArenaStringPtr>(message, field).Get().size() > 0; } } @@ -2314,11 +2500,11 @@ bool Reflection::HasBit(const Message& message, case FieldDescriptor::CPPTYPE_BOOL: return GetRaw<bool>(message, field) != false; case FieldDescriptor::CPPTYPE_INT32: - return GetRaw<int32>(message, field) != 0; + return GetRaw<int32_t>(message, field) != 0; case FieldDescriptor::CPPTYPE_INT64: return GetRaw<int64>(message, field) != 0; case FieldDescriptor::CPPTYPE_UINT32: - return GetRaw<uint32>(message, field) != 0; + return GetRaw<uint32_t>(message, field) != 0; case FieldDescriptor::CPPTYPE_UINT64: return GetRaw<uint64>(message, field) != 0; case FieldDescriptor::CPPTYPE_FLOAT: @@ -2338,19 +2524,19 @@ bool Reflection::HasBit(const Message& message, void Reflection::SetBit(Message* message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!field->options().weak()); - const uint32 index = schema_.HasBitIndex(field); - if (index == static_cast<uint32>(-1)) return; + const uint32_t index = schema_.HasBitIndex(field); + if (index == static_cast<uint32_t>(-1)) return; MutableHasBits(message)[index / 32] |= - (static_cast<uint32>(1) << (index % 32)); + (static_cast<uint32_t>(1) << (index % 32)); } void Reflection::ClearBit(Message* message, const FieldDescriptor* field) const { GOOGLE_DCHECK(!field->options().weak()); - const uint32 index = schema_.HasBitIndex(field); - if (index == static_cast<uint32>(-1)) return; + const uint32_t index = schema_.HasBitIndex(field); + if (index == static_cast<uint32_t>(-1)) return; MutableHasBits(message)[index / 32] &= - ~(static_cast<uint32>(1) << (index % 32)); + ~(static_cast<uint32_t>(1) << (index % 32)); } void Reflection::SwapBit(Message* message1, Message* message2, @@ -2380,12 +2566,6 @@ bool Reflection::HasOneof(const Message& message, return (GetOneofCase(message, oneof_descriptor) > 0); } -bool Reflection::HasOneofField(const Message& message, - const FieldDescriptor* field) const { - return (GetOneofCase(message, field->containing_oneof()) == - static_cast<uint32>(field->number())); -} - void Reflection::SetOneofCase(Message* message, const FieldDescriptor* field) const { *MutableOneofCase(message, field->containing_oneof()) = field->number(); @@ -2407,7 +2587,7 @@ void Reflection::ClearOneof(Message* message, // TODO(jieluo): Consider to cache the unused object instead of deleting // it. It will be much faster if an application switches a lot from // a few oneof fields. Time/space tradeoff - uint32 oneof_case = GetOneofCase(*message, oneof_descriptor); + uint32_t oneof_case = GetOneofCase(*message, oneof_descriptor); if (oneof_case > 0) { const FieldDescriptor* field = descriptor_->FindFieldByNumber(oneof_case); if (message->GetArenaForAllocation() == nullptr) { @@ -2455,9 +2635,9 @@ void Reflection::ClearOneof(Message* message, MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, NULL)); \ } -HANDLE_TYPE(int32, FieldDescriptor::CPPTYPE_INT32, -1); +HANDLE_TYPE(int32_t, FieldDescriptor::CPPTYPE_INT32, -1); HANDLE_TYPE(int64, FieldDescriptor::CPPTYPE_INT64, -1); -HANDLE_TYPE(uint32, FieldDescriptor::CPPTYPE_UINT32, -1); +HANDLE_TYPE(uint32_t, FieldDescriptor::CPPTYPE_UINT32, -1); HANDLE_TYPE(uint64, FieldDescriptor::CPPTYPE_UINT64, -1); HANDLE_TYPE(float, FieldDescriptor::CPPTYPE_FLOAT, -1); HANDLE_TYPE(double, FieldDescriptor::CPPTYPE_DOUBLE, -1); @@ -2560,7 +2740,7 @@ void* Reflection::RepeatedFieldData(Message* message, cpp_type == FieldDescriptor::CPPTYPE_INT32)) << "The type parameter T in RepeatedFieldRef<T> API doesn't match " << "the actual field type (for enums T should be the generated enum " - << "type or int32)."; + << "type or int32_t)."; if (message_type != nullptr) { GOOGLE_CHECK_EQ(message_type, field->message_type()); } @@ -2590,13 +2770,13 @@ namespace { // Helper function to transform migration schema into reflection schema. ReflectionSchema MigrationToReflectionSchema( - const Message* const* default_instance, const uint32* offsets, + const Message* const* default_instance, const uint32_t* offsets, MigrationSchema migration_schema) { ReflectionSchema result; result.default_instance_ = *default_instance; - // First 6 offsets are offsets to the special fields. The following offsets + // First 7 offsets are offsets to the special fields. The following offsets // are the proto fields. - result.offsets_ = offsets + migration_schema.offsets_index + 5; + result.offsets_ = offsets + migration_schema.offsets_index + 6; result.has_bit_indices_ = offsets + migration_schema.has_bit_indices_index; result.has_bits_offset_ = offsets[migration_schema.offsets_index + 0]; result.metadata_offset_ = offsets[migration_schema.offsets_index + 1]; @@ -2604,6 +2784,10 @@ ReflectionSchema MigrationToReflectionSchema( result.oneof_case_offset_ = offsets[migration_schema.offsets_index + 3]; result.object_size_ = migration_schema.object_size; result.weak_field_map_offset_ = offsets[migration_schema.offsets_index + 4]; + result.inlined_string_donated_offset_ = + offsets[migration_schema.offsets_index + 5]; + result.inlined_string_indices_ = + offsets + migration_schema.inlined_string_indices_index; return result; } @@ -2616,7 +2800,7 @@ class AssignDescriptorsHelper { const EnumDescriptor** file_level_enum_descriptors, const MigrationSchema* schemas, const Message* const* default_instance_data, - const uint32* offsets) + const uint32_t* offsets) : factory_(factory), file_level_metadata_(file_level_metadata), file_level_enum_descriptors_(file_level_enum_descriptors), @@ -2657,7 +2841,7 @@ class AssignDescriptorsHelper { const EnumDescriptor** file_level_enum_descriptors_; const MigrationSchema* schemas_; const Message* const* default_instance_data_; - const uint32* offsets_; + const uint32_t* offsets_; }; namespace { @@ -2818,8 +3002,8 @@ void RegisterFileLevelMetadata(const DescriptorTable* table) { RegisterAllTypesInternal(table->file_level_metadata, table->num_messages); } -void UnknownFieldSetSerializer(const uint8* base, uint32 offset, uint32 tag, - uint32 has_offset, +void UnknownFieldSetSerializer(const uint8_t* base, uint32_t offset, + uint32_t tag, uint32_t has_offset, io::CodedOutputStream* output) { const void* ptr = base + offset; const InternalMetadata* metadata = static_cast<const InternalMetadata*>(ptr); diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h index 1771b474c7..6a570ff607 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.h @@ -107,7 +107,7 @@ class WeakFieldMap; // weak_field_map.h // message, or -1 if the message type has no extension // ranges. // oneof_case_offset: Offset in the message of an array of uint32s of -// size descriptor->oneof_decl_count(). Each uint32 +// size descriptor->oneof_decl_count(). Each uint32_t // indicates what field is set for each oneof. // object_size: The size of a message object of this type, as measured // by sizeof(). @@ -119,7 +119,7 @@ class WeakFieldMap; // weak_field_map.h struct ReflectionSchema { public: // Size of a google::protobuf::Message object of this type. - uint32 GetObjectSize() const { return static_cast<uint32>(object_size_); } + uint32_t GetObjectSize() const { return static_cast<uint32_t>(object_size_); } bool InRealOneof(const FieldDescriptor* field) const { return field->containing_oneof() && @@ -128,13 +128,13 @@ 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 GetFieldOffsetNonOneof(const FieldDescriptor* field) const { + uint32_t GetFieldOffsetNonOneof(const FieldDescriptor* field) const { GOOGLE_DCHECK(!InRealOneof(field)); return OffsetValue(offsets_[field->index()], field->type()); } // Offset of any field. - uint32 GetFieldOffset(const FieldDescriptor* field) const { + uint32_t GetFieldOffset(const FieldDescriptor* field) const { if (InRealOneof(field)) { size_t offset = static_cast<size_t>(field->containing_type()->field_count() + @@ -145,42 +145,62 @@ struct ReflectionSchema { } } - uint32 GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { - return static_cast<uint32>(oneof_case_offset_) + - static_cast<uint32>(static_cast<size_t>(oneof_descriptor->index()) * - sizeof(uint32)); + bool IsFieldInlined(const FieldDescriptor* field) const { + return Inlined(offsets_[field->index()], field->type()); + } + + uint32_t GetOneofCaseOffset(const OneofDescriptor* oneof_descriptor) const { + return static_cast<uint32_t>(oneof_case_offset_) + + static_cast<uint32_t>( + static_cast<size_t>(oneof_descriptor->index()) * + sizeof(uint32_t)); } bool HasHasbits() const { return has_bits_offset_ != -1; } // Bit index within the bit array of hasbits. Bit order is low-to-high. - uint32 HasBitIndex(const FieldDescriptor* field) const { - if (has_bits_offset_ == -1) return static_cast<uint32>(-1); + uint32_t HasBitIndex(const FieldDescriptor* field) const { + if (has_bits_offset_ == -1) return static_cast<uint32_t>(-1); GOOGLE_DCHECK(HasHasbits()); return has_bit_indices_[field->index()]; } // Byte offset of the hasbits array. - uint32 HasBitsOffset() const { + uint32_t HasBitsOffset() const { GOOGLE_DCHECK(HasHasbits()); - return static_cast<uint32>(has_bits_offset_); + return static_cast<uint32_t>(has_bits_offset_); + } + + bool HasInlinedString() const { return inlined_string_donated_offset_ != -1; } + + // 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()); + return inlined_string_indices_[field->index()]; + } + + // Byte offset of the _inlined_string_donated_ array. + uint32_t InlinedStringDonatedOffset() const { + GOOGLE_DCHECK(HasInlinedString()); + return static_cast<uint32_t>(inlined_string_donated_offset_); } // The offset of the InternalMetadataWithArena member. // For Lite this will actually be an InternalMetadataWithArenaLite. // The schema doesn't contain enough information to distinguish between // these two cases. - uint32 GetMetadataOffset() const { - return static_cast<uint32>(metadata_offset_); + uint32_t GetMetadataOffset() const { + return static_cast<uint32_t>(metadata_offset_); } // Whether this message has an ExtensionSet. bool HasExtensionSet() const { return extensions_offset_ != -1; } // The offset of the ExtensionSet in this message. - uint32 GetExtensionSetOffset() const { + uint32_t GetExtensionSetOffset() const { GOOGLE_DCHECK(HasExtensionSet()); - return static_cast<uint32>(extensions_offset_); + return static_cast<uint32_t>(extensions_offset_); } // The off set of WeakFieldMap when the message contains weak fields. @@ -194,7 +214,7 @@ struct ReflectionSchema { // Returns a pointer to the default value for this field. The size and type // of the underlying data depends on the field's type. const void* GetFieldDefault(const FieldDescriptor* field) const { - return reinterpret_cast<const uint8*>(default_instance_) + + return reinterpret_cast<const uint8_t*>(default_instance_) + OffsetValue(offsets_[field->index()], field->type()); } @@ -232,23 +252,37 @@ struct ReflectionSchema { // ReflectionSchema schema = {a, b, c, d, e, ...}; // private: const Message* default_instance_; - const uint32* offsets_; - const uint32* has_bit_indices_; + const uint32_t* offsets_; + const uint32_t* has_bit_indices_; int has_bits_offset_; int metadata_offset_; int extensions_offset_; int oneof_case_offset_; int object_size_; int weak_field_map_offset_; + const uint32_t* inlined_string_indices_; + int inlined_string_donated_offset_; // We tag offset values to provide additional data about fields (such as - // "unused" or "lazy"). - static uint32 OffsetValue(uint32 v, FieldDescriptor::Type type) { - if (type == FieldDescriptor::TYPE_MESSAGE) { + // "unused" or "lazy" or "inlined"). + static uint32_t OffsetValue(uint32_t v, FieldDescriptor::Type type) { + if (type == FieldDescriptor::TYPE_MESSAGE || + type == FieldDescriptor::TYPE_STRING || + type == FieldDescriptor::TYPE_BYTES) { return v & 0x7FFFFFFEu; } return v & 0x7FFFFFFFu; } + + static bool Inlined(uint32_t v, FieldDescriptor::Type type) { + if (type == FieldDescriptor::TYPE_STRING || + type == FieldDescriptor::TYPE_BYTES) { + return (v & 1u) != 0u; + } else { + // Non string/byte fields are not inlined. + return false; + } + } }; // Structs that the code generator emits directly to describe a message. @@ -258,8 +292,9 @@ struct ReflectionSchema { // EXPERIMENTAL: these are changing rapidly, and may completely disappear // or merge with ReflectionSchema. struct MigrationSchema { - int32 offsets_index; - int32 has_bit_indices_index; + int32_t offsets_index; + int32_t has_bit_indices_index; + int32_t inlined_string_indices_index; int object_size; }; @@ -278,7 +313,7 @@ struct PROTOBUF_EXPORT DescriptorTable { int num_messages; const MigrationSchema* schemas; const Message* const* default_instances; - const uint32* offsets; + const uint32_t* offsets; // update the following descriptor arrays. Metadata* file_level_metadata; const EnumDescriptor** file_level_enum_descriptors; @@ -309,8 +344,9 @@ Metadata PROTOBUF_EXPORT AssignDescriptors(const DescriptorTable* (*table)(), const Metadata& metadata); // These cannot be in lite so we put them in the reflection. -PROTOBUF_EXPORT void UnknownFieldSetSerializer(const uint8* base, uint32 offset, - uint32 tag, uint32 has_offset, +PROTOBUF_EXPORT void UnknownFieldSetSerializer(const uint8_t* base, + uint32_t offset, uint32_t tag, + uint32_t has_offset, io::CodedOutputStream* output); struct PROTOBUF_EXPORT AddDescriptorsRunner { diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc index 56f1a6af84..71ee647565 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc @@ -45,7 +45,7 @@ namespace internal { namespace { -UnknownFieldSet* MutableUnknownFields(MessageLite* msg, int64 arena_offset) { +UnknownFieldSet* MutableUnknownFields(MessageLite* msg, int64_t arena_offset) { return Raw<InternalMetadata>(msg, arena_offset) ->mutable_unknown_fields<UnknownFieldSet>(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h index def4a1fa2c..178a0c1c6a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.h @@ -73,19 +73,21 @@ enum ProcessingTypes { TYPE_STRING_STRING_PIECE = 20, TYPE_BYTES_CORD = 21, TYPE_BYTES_STRING_PIECE = 22, - TYPE_MAP = 23, + TYPE_STRING_INLINED = 23, + TYPE_BYTES_INLINED = 24, + TYPE_MAP = 25, }; static_assert(TYPE_MAP < kRepeatedMask, "Invalid enum"); struct PROTOBUF_EXPORT FieldMetadata { - uint32 offset; // offset of this field in the struct - uint32 tag; // field * 8 + wire_type + uint32_t offset; // offset of this field in the struct + uint32_t tag; // field * 8 + wire_type // byte offset * 8 + bit_offset; // if the high bit is set then this is the byte offset of the oneof_case // for this field. - uint32 has_offset; - uint32 type; // the type of this field. + uint32_t has_offset; + uint32_t type; // the type of this field. const void* ptr; // auxiliary data // From the serializer point of view each fundamental type can occur in @@ -104,7 +106,8 @@ struct PROTOBUF_EXPORT FieldMetadata { enum { kCordType = 19, kStringPieceType = 20, - kNumTypes = 20, + kInlinedType = 21, + kNumTypes = 21, kSpecial = kNumTypes * kNumTypeClasses, }; @@ -119,10 +122,10 @@ struct PROTOBUF_EXPORT FieldMetadata { // Additional data, needed for some types, is stored in // AuxiliaryParseTableField. struct ParseTableField { - uint32 offset; + uint32_t offset; // The presence_index ordinarily represents a has_bit index, but for fields // inside a oneof it represents the index in _oneof_case_. - uint32 presence_index; + uint32_t presence_index; unsigned char normal_wiretype; unsigned char packed_wiretype; @@ -184,10 +187,10 @@ struct ParseTable { // TODO(ckennelly): Do something with this padding. // TODO(ckennelly): Vet these for sign extension. - int64 has_bits_offset; - int64 oneof_case_offset; - int64 extension_offset; - int64 arena_offset; + int64_t has_bits_offset; + int64_t oneof_case_offset; + int64_t extension_offset; + int64_t arena_offset; // ExplicitlyInitialized<T> -> T requires a reinterpret_cast, which prevents // the tables from being constructed as a constexpr. We use void to avoid @@ -243,9 +246,9 @@ struct SerializationTable { const FieldMetadata* field_table; }; -PROTOBUF_EXPORT void SerializeInternal(const uint8* base, +PROTOBUF_EXPORT void SerializeInternal(const uint8_t* base, const FieldMetadata* table, - int32 num_fields, + int32_t num_fields, io::CodedOutputStream* output); inline void TableSerialize(const MessageLite& msg, @@ -253,24 +256,25 @@ inline void TableSerialize(const MessageLite& msg, io::CodedOutputStream* output) { const FieldMetadata* field_table = table->field_table; int num_fields = table->num_fields - 1; - const uint8* base = reinterpret_cast<const uint8*>(&msg); + const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); // TODO(gerbens) This skips the first test if we could use the fast // array serialization path, we should make this // int cached_size = - // *reinterpret_cast<const int32*>(base + field_table->offset); + // *reinterpret_cast<const int32_t*>(base + field_table->offset); // SerializeWithCachedSize(msg, field_table + 1, num_fields, cached_size, ...) // But we keep conformance with the old way for now. SerializeInternal(base, field_table + 1, num_fields, output); } -PROTOBUF_EXPORT uint8* SerializeInternalToArray(const uint8* base, const FieldMetadata* table, - int32 num_fields, bool is_deterministic, - uint8* buffer); +PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base, + const FieldMetadata* table, + int32_t num_fields, bool is_deterministic, + uint8_t* buffer); -inline uint8* TableSerializeToArray(const MessageLite& msg, - const SerializationTable* table, - bool is_deterministic, uint8* buffer) { - const uint8* base = reinterpret_cast<const uint8*>(&msg); +inline uint8_t* TableSerializeToArray(const MessageLite& msg, + const SerializationTable* table, + bool is_deterministic, uint8_t* buffer) { + const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); const FieldMetadata* field_table = table->field_table + 1; int num_fields = table->num_fields - 1; return SerializeInternalToArray(base, field_table, num_fields, @@ -302,8 +306,8 @@ struct CompareMapKey { }; template <typename MapFieldType, const SerializationTable* table> -void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag, - uint32 has_offset, io::CodedOutputStream* output) { +void MapFieldSerializer(const uint8_t* base, uint32_t offset, uint32_t tag, + uint32_t has_offset, io::CodedOutputStream* output) { typedef MapEntryHelper<typename MapFieldType::EntryTypeTrait> Entry; typedef typename MapFieldType::MapType::const_iterator Iter; @@ -318,7 +322,7 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag, Entry map_entry(*it); output->WriteVarint32(tag); output->WriteVarint32(map_entry._cached_size_); - SerializeInternal(reinterpret_cast<const uint8*>(&map_entry), + SerializeInternal(reinterpret_cast<const uint8_t*>(&map_entry), t->field_table, t->num_fields, output); } } else { @@ -331,7 +335,7 @@ void MapFieldSerializer(const uint8* base, uint32 offset, uint32 tag, for (int i = 0; i < v.size(); i++) { output->WriteVarint32(tag); output->WriteVarint32(v[i]._cached_size_); - SerializeInternal(reinterpret_cast<const uint8*>(&v[i]), t->field_table, + SerializeInternal(reinterpret_cast<const uint8_t*>(&v[i]), t->field_table, t->num_fields, output); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc index 6a7949a993..9bcdde5cee 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc @@ -43,7 +43,7 @@ namespace internal { namespace { -TProtoStringType* MutableUnknownFields(MessageLite* msg, int64 arena_offset) { +TProtoStringType* MutableUnknownFields(MessageLite* msg, int64_t arena_offset) { return Raw<InternalMetadata>(msg, arena_offset) ->mutable_unknown_fields<TProtoStringType>(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h index 706a530e47..78c9bb6dd4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven_lite.h @@ -35,6 +35,7 @@ #include <google/protobuf/extension_set.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/implicit_weak_message.h> +#include <google/protobuf/inlined_string_field.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/wire_format_lite.h> #include <type_traits> @@ -49,6 +50,7 @@ namespace internal { enum StringType { StringType_STRING = 0, + StringType_INLINED = 3 }; // Logically a superset of StringType, consisting of all field types that @@ -57,7 +59,8 @@ enum ProcessingType { ProcessingType_STRING = 0, ProcessingType_CORD = 1, ProcessingType_STRING_PIECE = 2, - ProcessingType_MESSAGE = 3, + ProcessingType_INLINED = 3, + ProcessingType_MESSAGE = 4, }; enum Cardinality { @@ -67,17 +70,18 @@ enum Cardinality { }; template <typename Type> -inline Type* Raw(MessageLite* msg, int64 offset) { - return reinterpret_cast<Type*>(reinterpret_cast<uint8*>(msg) + offset); +inline Type* Raw(MessageLite* msg, int64_t offset) { + return reinterpret_cast<Type*>(reinterpret_cast<uint8_t*>(msg) + offset); } template <typename Type> -inline const Type* Raw(const MessageLite* msg, int64 offset) { - return reinterpret_cast<const Type*>(reinterpret_cast<const uint8*>(msg) + +inline const Type* Raw(const MessageLite* msg, int64_t offset) { + return reinterpret_cast<const Type*>(reinterpret_cast<const uint8_t*>(msg) + offset); } -inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) { +inline ExtensionSet* GetExtensionSet(MessageLite* msg, + int64_t extension_offset) { if (extension_offset == -1) { return NULL; } @@ -86,15 +90,17 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) { } template <typename Type> -inline Type* AddField(MessageLite* msg, int64 offset) { - static_assert(std::is_trivial<Type>::value, "Do not assign"); +inline Type* AddField(MessageLite* msg, int64_t offset) { + static_assert(std::is_trivial<Type>::value || + std::is_same<Type, InlinedStringField>::value, + "Do not assign"); RepeatedField<Type>* repeated = Raw<RepeatedField<Type>>(msg, offset); return repeated->Add(); } template <> -inline TProtoStringType* AddField<TProtoStringType>(MessageLite* msg, int64 offset) { +inline TProtoStringType* AddField<TProtoStringType>(MessageLite* msg, int64_t offset) { RepeatedPtrField<TProtoStringType>* repeated = Raw<RepeatedPtrField<TProtoStringType>>(msg, offset); return repeated->Add(); @@ -102,35 +108,35 @@ inline TProtoStringType* AddField<TProtoStringType>(MessageLite* msg, int64 offs template <typename Type> -inline void AddField(MessageLite* msg, int64 offset, Type value) { +inline void AddField(MessageLite* msg, int64_t offset, Type value) { static_assert(std::is_trivial<Type>::value, "Do not assign"); *AddField<Type>(msg, offset) = value; } -inline void SetBit(uint32* has_bits, uint32 has_bit_index) { +inline void SetBit(uint32_t* has_bits, uint32_t has_bit_index) { GOOGLE_DCHECK(has_bits != nullptr); - uint32 mask = static_cast<uint32>(1u) << (has_bit_index % 32); + uint32_t mask = static_cast<uint32_t>(1u) << (has_bit_index % 32); has_bits[has_bit_index / 32u] |= mask; } template <typename Type> -inline Type* MutableField(MessageLite* msg, uint32* has_bits, - uint32 has_bit_index, int64 offset) { +inline Type* MutableField(MessageLite* msg, uint32_t* has_bits, + uint32_t has_bit_index, int64_t offset) { SetBit(has_bits, has_bit_index); return Raw<Type>(msg, offset); } template <typename Type> -inline void SetField(MessageLite* msg, uint32* has_bits, uint32 has_bit_index, - int64 offset, Type value) { +inline void SetField(MessageLite* msg, uint32_t* has_bits, + uint32_t has_bit_index, int64_t offset, Type value) { static_assert(std::is_trivial<Type>::value, "Do not assign"); *MutableField<Type>(msg, has_bits, has_bit_index, offset) = value; } template <typename Type> -inline void SetOneofField(MessageLite* msg, uint32* oneof_case, - uint32 oneof_case_index, int64 offset, +inline void SetOneofField(MessageLite* msg, uint32_t* oneof_case, + uint32_t oneof_case_index, int64_t offset, int field_number, Type value) { oneof_case[oneof_case_index] = field_number; *Raw<Type>(msg, offset) = value; @@ -153,6 +159,11 @@ inline void ClearOneofField(const ParseTableField& field, Arena* arena, ->Destroy(ArenaStringPtr::EmptyDefault{}, arena); break; + case TYPE_STRING_INLINED: + case TYPE_BYTES_INLINED: + Raw<InlinedStringField>(msg, field.offset)->DestroyNoArena(NULL); + break; + default: // No cleanup needed. break; @@ -167,9 +178,10 @@ inline void ClearOneofField(const ParseTableField& field, Arena* arena, // _oneof_case_ array. template <ProcessingType field_type> inline void ResetOneofField(const ParseTable& table, int field_number, - Arena* arena, MessageLite* msg, uint32* oneof_case, - int64 offset, const void* default_ptr) { - if (static_cast<int64>(*oneof_case) == field_number) { + Arena* arena, MessageLite* msg, + uint32_t* oneof_case, int64_t offset, + const void* default_ptr) { + if (static_cast<int64_t>(*oneof_case) == field_number) { // The oneof is already set to the right type, so there is no need to clear // it. return; @@ -185,6 +197,10 @@ inline void ResetOneofField(const ParseTable& table, int field_number, Raw<ArenaStringPtr>(msg, offset) ->UnsafeSetDefault(static_cast<const TProtoStringType*>(default_ptr)); break; + case ProcessingType_INLINED: + new (Raw<InlinedStringField>(msg, offset)) + InlinedStringField(*static_cast<const TProtoStringType*>(default_ptr)); + break; case ProcessingType_MESSAGE: MessageLite** submessage = Raw<MessageLite*>(msg, offset); const MessageLite* prototype = @@ -197,8 +213,8 @@ inline void ResetOneofField(const ParseTable& table, int field_number, template <typename UnknownFieldHandler, Cardinality cardinality, bool is_string_type, StringType ctype> static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg, - Arena* arena, uint32* has_bits, - uint32 has_bit_index, int64 offset, + Arena* arena, uint32_t* has_bits, + uint32_t has_bit_index, int64_t offset, const void* default_ptr, const char* field_name) { StringPiece utf8_string_data; @@ -209,6 +225,30 @@ static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg, #endif // GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED switch (ctype) { + case StringType_INLINED: { + TProtoStringType* value = nullptr; + switch (cardinality) { + case Cardinality_SINGULAR: { + // TODO(ckennelly): Is this optimal? + InlinedStringField* s = MutableField<InlinedStringField>( + msg, has_bits, has_bit_index, offset); + value = s->UnsafeMutablePointer(); + } break; + case Cardinality_REPEATED: { + value = AddField<TProtoStringType>(msg, offset); + } break; + case Cardinality_ONEOF: { + InlinedStringField* s = Raw<InlinedStringField>(msg, offset); + value = s->UnsafeMutablePointer(); + } break; + } + GOOGLE_DCHECK(value != nullptr); + if (PROTOBUF_PREDICT_FALSE(!WireFormatLite::ReadString(input, value))) { + return false; + } + utf8_string_data = *value; + break; + } case StringType_STRING: { switch (cardinality) { case Cardinality_SINGULAR: { @@ -260,8 +300,8 @@ static inline bool HandleString(io::CodedInputStream* input, MessageLite* msg, template <typename UnknownFieldHandler, Cardinality cardinality> inline bool HandleEnum(const ParseTable& table, io::CodedInputStream* input, - MessageLite* msg, uint32* presence, - uint32 presence_index, int64 offset, uint32 tag, + MessageLite* msg, uint32_t* presence, + uint32_t presence_index, int64_t offset, uint32_t tag, int field_number) { int value; if (PROTOBUF_PREDICT_FALSE( @@ -326,7 +366,7 @@ class MergePartialFromCodedStreamHelper { } }; -template <typename UnknownFieldHandler, uint32 kMaxTag> +template <typename UnknownFieldHandler, uint32_t kMaxTag> bool MergePartialFromCodedStreamInlined(MessageLite* msg, const ParseTable& table, io::CodedInputStream* input) { @@ -335,11 +375,11 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, // // TODO(ckennelly): Make this a compile-time parameter with templates. GOOGLE_DCHECK_GE(table.has_bits_offset, 0); - uint32* has_bits = Raw<uint32>(msg, table.has_bits_offset); + uint32_t* has_bits = Raw<uint32_t>(msg, table.has_bits_offset); GOOGLE_DCHECK(has_bits != NULL); while (true) { - uint32 tag = input->ReadTagWithCutoffNoLastTag(kMaxTag).first; + uint32_t tag = input->ReadTagWithCutoffNoLastTag(kMaxTag).first; const WireFormatLite::WireType wire_type = WireFormatLite::GetTagWireType(tag); const int field_number = WireFormatLite::GetTagFieldNumber(tag); @@ -367,8 +407,8 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, const ParseTableField* data = table.fields + field_number; // TODO(ckennelly): Avoid sign extension - const int64 presence_index = data->presence_index; - const int64 offset = data->offset; + const int64_t presence_index = data->presence_index; + const int64_t offset = data->offset; const unsigned char processing_type = data->processing_type; if (data->normal_wiretype == static_cast<unsigned char>(wire_type)) { @@ -394,7 +434,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; \ } \ case (WireFormatLite::TYPE_##TYPE) | kOneofMask: { \ - uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset); \ + uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); \ CPPTYPE value; \ if (PROTOBUF_PREDICT_FALSE( \ (!WireFormatLite::ReadPrimitive< \ @@ -408,17 +448,17 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; \ } - HANDLE_TYPE(INT32, int32) - HANDLE_TYPE(INT64, int64) - HANDLE_TYPE(SINT32, int32) - HANDLE_TYPE(SINT64, int64) - HANDLE_TYPE(UINT32, uint32) - HANDLE_TYPE(UINT64, uint64) + HANDLE_TYPE(INT32, int32_t) + HANDLE_TYPE(INT64, int64_t) + HANDLE_TYPE(SINT32, int32_t) + HANDLE_TYPE(SINT64, int64_t) + HANDLE_TYPE(UINT32, uint32_t) + HANDLE_TYPE(UINT64, uint64_t) - HANDLE_TYPE(FIXED32, uint32) - HANDLE_TYPE(FIXED64, uint64) - HANDLE_TYPE(SFIXED32, int32) - HANDLE_TYPE(SFIXED64, int64) + HANDLE_TYPE(FIXED32, uint32_t) + HANDLE_TYPE(FIXED64, uint64_t) + HANDLE_TYPE(SFIXED32, int32_t) + HANDLE_TYPE(SFIXED64, int64_t) HANDLE_TYPE(FLOAT, float) HANDLE_TYPE(DOUBLE, double) @@ -442,13 +482,30 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, } break; } + case TYPE_BYTES_INLINED: +#ifndef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED + case TYPE_STRING_INLINED: +#endif // !GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED + { + Arena* const arena = msg->GetArena(); + const void* default_ptr = table.aux[field_number].strings.default_ptr; + + if (PROTOBUF_PREDICT_FALSE( + (!HandleString<UnknownFieldHandler, Cardinality_SINGULAR, + false, StringType_INLINED>( + input, msg, arena, has_bits, presence_index, offset, + default_ptr, nullptr)))) { + return false; + } + break; + } case WireFormatLite::TYPE_BYTES | kOneofMask: #ifndef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED case WireFormatLite::TYPE_STRING | kOneofMask: #endif // !GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED { Arena* const arena = msg->GetArena(); - uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset); + uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); const void* default_ptr = table.aux[field_number].strings.default_ptr; ResetOneofField<ProcessingType_STRING>( @@ -465,8 +522,10 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; } case (WireFormatLite::TYPE_BYTES) | kRepeatedMask: + case TYPE_BYTES_INLINED | kRepeatedMask: #ifndef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED case (WireFormatLite::TYPE_STRING) | kRepeatedMask: + case TYPE_STRING_INLINED | kRepeatedMask: #endif // !GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED { Arena* const arena = msg->GetArena(); @@ -496,6 +555,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, } break; } + case TYPE_STRING_INLINED | kRepeatedMask: case (WireFormatLite::TYPE_STRING) | kRepeatedMask: { Arena* const arena = msg->GetArena(); const void* default_ptr = table.aux[field_number].strings.default_ptr; @@ -512,7 +572,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, } case (WireFormatLite::TYPE_STRING) | kOneofMask: { Arena* const arena = msg->GetArena(); - uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset); + uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); const void* default_ptr = table.aux[field_number].strings.default_ptr; const char* field_name = table.aux[field_number].strings.field_name; @@ -549,7 +609,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; } case WireFormatLite::TYPE_ENUM | kOneofMask: { - uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset); + uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); if (PROTOBUF_PREDICT_FALSE( (!HandleEnum<UnknownFieldHandler, Cardinality_ONEOF>( table, input, msg, oneof_case, presence_index, offset, @@ -639,7 +699,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, } case WireFormatLite::TYPE_MESSAGE | kOneofMask: { Arena* const arena = msg->GetArena(); - uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset); + uint32_t* oneof_case = Raw<uint32_t>(msg, table.oneof_case_offset); MessageLite** submsg_holder = Raw<MessageLite*>(msg, offset); ResetOneofField<ProcessingType_MESSAGE>( table, field_number, arena, msg, oneof_case + presence_index, @@ -653,6 +713,22 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; } +#ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED + case TYPE_STRING_INLINED: { + Arena* const arena = msg->GetArena(); + const void* default_ptr = table.aux[field_number].strings.default_ptr; + const char* field_name = table.aux[field_number].strings.field_name; + + if (PROTOBUF_PREDICT_FALSE( + (!HandleString<UnknownFieldHandler, Cardinality_SINGULAR, + true, StringType_INLINED>( + input, msg, arena, has_bits, presence_index, offset, + default_ptr, field_name)))) { + return false; + } + break; + } +#endif // GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED case TYPE_MAP: { if (PROTOBUF_PREDICT_FALSE(!(*table.aux[field_number].maps.parse_map)( input, Raw<void>(msg, offset)))) { @@ -675,6 +751,8 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, GOOGLE_DCHECK_NE(processing_type, kRepeatedMask); GOOGLE_DCHECK_EQ(0, processing_type & kOneofMask); + GOOGLE_DCHECK_NE(TYPE_BYTES_INLINED | kRepeatedMask, processing_type); + GOOGLE_DCHECK_NE(TYPE_STRING_INLINED | kRepeatedMask, processing_type); // Mask out kRepeatedMask bit, allowing the jump table to be smaller. switch (static_cast<WireFormatLite::FieldType>(processing_type ^ @@ -690,17 +768,17 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, break; \ } - HANDLE_PACKED_TYPE(INT32, int32, Int32) - HANDLE_PACKED_TYPE(INT64, int64, Int64) - HANDLE_PACKED_TYPE(SINT32, int32, Int32) - HANDLE_PACKED_TYPE(SINT64, int64, Int64) - HANDLE_PACKED_TYPE(UINT32, uint32, UInt32) - HANDLE_PACKED_TYPE(UINT64, uint64, UInt64) + HANDLE_PACKED_TYPE(INT32, int32_t, Int32) + HANDLE_PACKED_TYPE(INT64, int64_t, Int64) + HANDLE_PACKED_TYPE(SINT32, int32_t, Int32) + HANDLE_PACKED_TYPE(SINT64, int64_t, Int64) + HANDLE_PACKED_TYPE(UINT32, uint32_t, UInt32) + HANDLE_PACKED_TYPE(UINT64, uint64_t, UInt64) - HANDLE_PACKED_TYPE(FIXED32, uint32, UInt32) - HANDLE_PACKED_TYPE(FIXED64, uint64, UInt64) - HANDLE_PACKED_TYPE(SFIXED32, int32, Int32) - HANDLE_PACKED_TYPE(SFIXED64, int64, Int64) + HANDLE_PACKED_TYPE(FIXED32, uint32_t, UInt32) + HANDLE_PACKED_TYPE(FIXED64, uint64_t, UInt64) + HANDLE_PACKED_TYPE(SFIXED32, int32_t, Int32) + HANDLE_PACKED_TYPE(SFIXED64, int64_t, Int64) HANDLE_PACKED_TYPE(FLOAT, float, Float) HANDLE_PACKED_TYPE(DOUBLE, double, Double) @@ -712,7 +790,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, // InternalMetadata) when all inputs in the repeated series // are valid, we implement our own parser rather than call // WireFormat::ReadPackedEnumPreserveUnknowns. - uint32 length; + uint32_t length; if (PROTOBUF_PREDICT_FALSE(!input->ReadVarint32(&length))) { return false; } @@ -785,8 +863,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table, msg, table, input); } else { return MergePartialFromCodedStreamInlined< - UnknownFieldHandler, std::numeric_limits<uint32>::max()>(msg, table, - input); + UnknownFieldHandler, std::numeric_limits<uint32_t>::max()>(msg, table, + input); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h index 9d2bc40d90..d294caa5df 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_decl.h @@ -41,6 +41,9 @@ #include <google/protobuf/parse_context.h> #include <google/protobuf/message_lite.h> +// Must come last: +#include <google/protobuf/port_def.inc> + namespace google { namespace protobuf { namespace internal { @@ -52,7 +55,10 @@ struct TcFieldData { : data(static_cast<uint64_t>(offset) << 48 | static_cast<uint64_t>(hasbit_idx) << 16 | coded_tag) {} - uint16_t coded_tag() const { return static_cast<uint16_t>(data); } + template <typename TagType = uint16_t> + TagType coded_tag() const { + return static_cast<TagType>(data); + } uint8_t hasbit_idx() const { return static_cast<uint8_t>(data >> 16); } uint16_t offset() const { return static_cast<uint16_t>(data >> 48); } @@ -62,19 +68,21 @@ struct TcFieldData { struct TailCallParseTableBase; // TailCallParseFunc is the function pointer type used in the tailcall table. -typedef const char* (*TailCallParseFunc)(MessageLite* msg, const char* ptr, - ParseContext* ctx, - const TailCallParseTableBase* table, - uint64_t hasbits, TcFieldData data); +typedef const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL); + +#if defined(_MSC_VER) && !defined(_WIN64) +#pragma warning(push) +// TailCallParseTableBase is intentionally overaligned on 32 bit targets. +#pragma warning(disable : 4324) +#endif // Base class for message-level table with info for the tail-call parser. -struct TailCallParseTableBase { +struct alignas(uint64_t) TailCallParseTableBase { // Common attributes for message layout: uint16_t has_bits_offset; uint16_t extension_offset; uint32_t extension_range_low; uint32_t extension_range_high; - uint32_t has_bits_required_mask; const MessageLite* default_instance; // Handler for fields which are not handled by table dispatch. @@ -93,6 +101,10 @@ struct TailCallParseTableBase { } }; +#if defined(_MSC_VER) && !defined(_WIN64) +#pragma warning(pop) +#endif + static_assert(sizeof(TailCallParseTableBase::FieldEntry) <= 16, "Field entry is too big."); @@ -120,4 +132,6 @@ static_assert(offsetof(TailCallParseTable<1>, entries) == } // namespace protobuf } // namespace google +#include <google/protobuf/port_undef.inc> + #endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_DECL_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h index 8276c73018..6ea72d9bf3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.h @@ -53,20 +53,59 @@ class UnknownFieldSet; namespace internal { -// PROTOBUF_TC_PARAM_DECL are the parameters for tailcall functions. +// PROTOBUF_TC_PARAM_DECL are the parameters for tailcall functions, it is +// defined in port_def.inc. // // Note that this is performance sensitive: changing the parameters will change // the registers used by the ABI calling convention, which subsequently affects // register selection logic inside the function. -#define PROTOBUF_TC_PARAM_DECL \ - ::google::protobuf::MessageLite *msg, const char *ptr, \ - ::google::protobuf::internal::ParseContext *ctx, \ - const ::google::protobuf::internal::TailCallParseTableBase *table, \ - uint64_t hasbits, ::google::protobuf::internal::TcFieldData data // PROTOBUF_TC_PARAM_PASS passes values to match PROTOBUF_TC_PARAM_DECL. #define PROTOBUF_TC_PARAM_PASS msg, ptr, ctx, table, hasbits, data +// PROTOBUF_TC_PARSE_* decide which function is used to parse message-typed +// fields. The guard macros are defined in port_def.inc. +#if PROTOBUF_TC_STATIC_PARSE_SINGULAR1 +#define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) MESSAGE::Tct_ParseS1 +#else +#define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) \ + ::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint8_t> +#endif // PROTOBUF_TC_STATIC_PARSE_SINGULAR1 + +#if PROTOBUF_TC_STATIC_PARSE_SINGULAR2 +#define PROTOBUF_TC_PARSE_SINGULAR2(MESSAGE) MESSAGE::Tct_ParseS2 +#else +#define PROTOBUF_TC_PARSE_SINGULAR2(MESSAGE) \ + ::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint16_t> +#endif // PROTOBUF_TC_STATIC_PARSE_SINGULAR2 + +#if PROTOBUF_TC_STATIC_PARSE_REPEATED1 +#define PROTOBUF_TC_PARSE_REPEATED1(MESSAGE) MESSAGE::Tct_ParseR1 +#else +#define PROTOBUF_TC_PARSE_REPEATED1(MESSAGE) \ + ::google::protobuf::internal::TcParserBase::RepeatedParseMessage<MESSAGE, uint8_t> +#endif // PROTOBUF_TC_STATIC_PARSE_REPEATED1 + +#if PROTOBUF_TC_STATIC_PARSE_REPEATED2 +#define PROTOBUF_TC_PARSE_REPEATED2(MESSAGE) MESSAGE::Tct_ParseR2 +#else +#define PROTOBUF_TC_PARSE_REPEATED2(MESSAGE) \ + ::google::protobuf::internal::TcParserBase::RepeatedParseMessage<MESSAGE, uint16_t> +#endif // PROTOBUF_TC_STATIC_PARSE_REPEATED2 + +#ifndef NDEBUG +template <size_t align> +#ifndef _MSC_VER +[[noreturn]] +#endif +void AlignFail(uintptr_t address) { + GOOGLE_LOG(FATAL) << "Unaligned (" << align << ") access at " << address; +} + +extern template void AlignFail<4>(uintptr_t); +extern template void AlignFail<8>(uintptr_t); +#endif + class TcParserBase { public: static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL); @@ -75,7 +114,7 @@ class TcParserBase { template <typename FieldType, typename TagType> PROTOBUF_NOINLINE static const char* SingularParseMessage( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(static_cast<TagType>(data.coded_tag()) != 0)) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { return table->fallback(PROTOBUF_TC_PARAM_PASS); } ptr += sizeof(TagType); @@ -96,7 +135,7 @@ class TcParserBase { template <typename FieldType, typename TagType> PROTOBUF_NOINLINE static const char* RepeatedParseMessage( PROTOBUF_TC_PARAM_DECL) { - if (PROTOBUF_PREDICT_FALSE(static_cast<TagType>(data.coded_tag()) != 0)) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { return table->fallback(PROTOBUF_TC_PARAM_PASS); } ptr += sizeof(TagType); @@ -123,11 +162,15 @@ class TcParserBase { template <typename TagType, Utf8Type utf8> static const char* RepeatedString(PROTOBUF_TC_PARAM_DECL); - protected: template <typename T> - static T& RefAt(void* x, size_t offset) { + static inline T& RefAt(void* x, size_t offset) { T* target = reinterpret_cast<T*>(static_cast<char*>(x) + offset); - GOOGLE_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(target) % alignof(T)); +#ifndef NDEBUG + if (PROTOBUF_PREDICT_FALSE( + reinterpret_cast<uintptr_t>(target) % alignof(T) != 0)) { + AlignFail<alignof(T)>(reinterpret_cast<uintptr_t>(target)); + } +#endif return *target; } @@ -141,6 +184,7 @@ class TcParserBase { } } + protected: static inline PROTOBUF_ALWAYS_INLINE const char* Return( PROTOBUF_TC_PARAM_DECL) { SyncHasbits(msg, hasbits, table); diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc index e6e5dd515e..8d38a513e2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_impl.inc @@ -30,226 +30,124 @@ // clang-format off #ifdef PROTOBUF_TCT_SOURCE -template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +#define PROTOBUF_TCT_EXTERN #else -extern template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); -extern template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +#define PROTOBUF_TCT_EXTERN extern #endif +PROTOBUF_TCT_EXTERN template const char *TcParser<1>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); +PROTOBUF_TCT_EXTERN template const char *TcParser<2>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); +PROTOBUF_TCT_EXTERN template const char *TcParser<3>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); +PROTOBUF_TCT_EXTERN template const char *TcParser<4>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); +PROTOBUF_TCT_EXTERN template const char *TcParser<5>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +#undef PROTOBUF_TCT_EXTERN // clang-format on diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc index 7e81ad8e94..4da3bff9ba 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc @@ -119,93 +119,93 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_BOOL> { static void Serialize(const void* ptr, io::CodedOutputStream* output) { WireFormatLite::WriteBoolNoTag(Get<bool>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteBoolNoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT32> { - typedef int32 Type; + typedef int32_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteInt32NoTag(Get<int32>(ptr), output); + WireFormatLite::WriteInt32NoTag(Get<int32_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteInt32NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT32> { - typedef int32 Type; + typedef int32_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteSInt32NoTag(Get<int32>(ptr), output); + WireFormatLite::WriteSInt32NoTag(Get<int32_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteSInt32NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT32> { - typedef uint32 Type; + typedef uint32_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteUInt32NoTag(Get<uint32>(ptr), output); + WireFormatLite::WriteUInt32NoTag(Get<uint32_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteUInt32NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_INT64> { - typedef int64 Type; + typedef int64_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteInt64NoTag(Get<int64>(ptr), output); + WireFormatLite::WriteInt64NoTag(Get<int64_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteInt64NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SINT64> { - typedef int64 Type; + typedef int64_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteSInt64NoTag(Get<int64>(ptr), output); + WireFormatLite::WriteSInt64NoTag(Get<int64_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteSInt64NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_UINT64> { - typedef uint64 Type; + typedef uint64_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteUInt64NoTag(Get<uint64>(ptr), output); + WireFormatLite::WriteUInt64NoTag(Get<uint64_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteUInt64NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> { - typedef uint32 Type; + typedef uint32_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteFixed32NoTag(Get<uint32>(ptr), output); + WireFormatLite::WriteFixed32NoTag(Get<uint32_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteFixed32NoTagToArray(Get<Type>(ptr), buffer); } }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> { - typedef uint64 Type; + typedef uint64_t Type; static void Serialize(const void* ptr, io::CodedOutputStream* output) { - WireFormatLite::WriteFixed64NoTag(Get<uint64>(ptr), output); + WireFormatLite::WriteFixed64NoTag(Get<uint64_t>(ptr), output); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { return WireFormatLite::WriteFixed64NoTagToArray(Get<Type>(ptr), buffer); } }; @@ -217,12 +217,12 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_ENUM> template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED32> : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED32> { - typedef int32 Type; + typedef int32_t Type; }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_SFIXED64> : PrimitiveTypeHelper<WireFormatLite::TYPE_FIXED64> { - typedef int64 Type; + typedef int64_t Type; }; template <> struct PrimitiveTypeHelper<WireFormatLite::TYPE_FLOAT> @@ -243,7 +243,7 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> { output->WriteVarint32(value.size()); output->WriteRawMaybeAliased(value.data(), value.size()); } - static uint8* SerializeToArray(const void* ptr, uint8* buffer) { + static uint8_t* SerializeToArray(const void* ptr, uint8_t* buffer) { const Type& value = *static_cast<const Type*>(ptr); return io::CodedOutputStream::WriteStringWithSizeToArray(value, buffer); } @@ -254,6 +254,10 @@ struct PrimitiveTypeHelper<WireFormatLite::TYPE_BYTES> : PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {}; +template <> +struct PrimitiveTypeHelper<FieldMetadata::kInlinedType> + : PrimitiveTypeHelper<WireFormatLite::TYPE_STRING> {}; + // We want to serialize to both CodedOutputStream and directly into byte arrays // without duplicating the code. In fact we might want extra output channels in // the future. @@ -266,12 +270,12 @@ void SerializeTo(const void* ptr, O* output) { } template <typename O> -void WriteTagTo(uint32 tag, O* output) { +void WriteTagTo(uint32_t tag, O* output) { SerializeTo<WireFormatLite::TYPE_UINT32>(&tag, output); } template <typename O> -void WriteLengthTo(uint32 length, O* output) { +void WriteLengthTo(uint32_t length, O* output) { SerializeTo<WireFormatLite::TYPE_UINT32>(&length, output); } @@ -285,7 +289,7 @@ struct OutputHelper<io::CodedOutputStream, type> { // Specialization for writing into a plain array struct ArrayOutput { - uint8* ptr; + uint8_t* ptr; bool is_deterministic; }; @@ -312,17 +316,17 @@ void SerializeMessageNoTable(const MessageLite* msg, ArrayOutput* output) { // Helper to branch to fast path if possible void SerializeMessageDispatch(const MessageLite& msg, const FieldMetadata* field_table, int num_fields, - int32 cached_size, + int32_t cached_size, io::CodedOutputStream* output) { - const uint8* base = reinterpret_cast<const uint8*>(&msg); + const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); SerializeInternal(base, field_table, num_fields, output); } // Helper to branch to fast path if possible void SerializeMessageDispatch(const MessageLite& msg, const FieldMetadata* field_table, int num_fields, - int32 cached_size, ArrayOutput* output) { - const uint8* base = reinterpret_cast<const uint8*>(&msg); + int32_t cached_size, ArrayOutput* output) { + const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); output->ptr = SerializeInternalToArray(base, field_table, num_fields, output->is_deterministic, output->ptr); } @@ -341,8 +345,9 @@ void SerializeMessageTo(const MessageLite* msg, const void* table_ptr, return; } const FieldMetadata* field_table = table->field_table; - const uint8* base = reinterpret_cast<const uint8*>(msg); - int cached_size = *reinterpret_cast<const int32*>(base + field_table->offset); + const uint8_t* base = reinterpret_cast<const uint8_t*>(msg); + int cached_size = + *reinterpret_cast<const int32_t*>(base + field_table->offset); WriteLengthTo(cached_size, output); int num_fields = table->num_fields - 1; SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size, @@ -361,8 +366,9 @@ void SerializeGroupTo(const MessageLite* msg, const void* table_ptr, return; } const FieldMetadata* field_table = table->field_table; - const uint8* base = reinterpret_cast<const uint8*>(msg); - int cached_size = *reinterpret_cast<const int32*>(base + field_table->offset); + const uint8_t* base = reinterpret_cast<const uint8_t*>(msg); + int cached_size = + *reinterpret_cast<const int32_t*>(base + field_table->offset); int num_fields = table->num_fields - 1; SerializeMessageDispatch(*msg, field_table + 1, num_fields, cached_size, output); @@ -412,6 +418,15 @@ struct SingularFieldHelper<WireFormatLite::TYPE_MESSAGE> { } }; +template <> +struct SingularFieldHelper<FieldMetadata::kInlinedType> { + template <typename O> + static void Serialize(const void* field, const FieldMetadata& md, O* output) { + WriteTagTo(md.tag, output); + SerializeTo<FieldMetadata::kInlinedType>(&Get<TProtoStringType>(field), output); + } +}; + template <int type> struct RepeatedFieldHelper { template <typename O> @@ -484,6 +499,10 @@ struct RepeatedFieldHelper<WireFormatLite::TYPE_MESSAGE> { }; +template <> +struct RepeatedFieldHelper<FieldMetadata::kInlinedType> + : RepeatedFieldHelper<WireFormatLite::TYPE_STRING> {}; + template <int type> struct PackedFieldHelper { template <typename O> @@ -493,7 +512,7 @@ struct PackedFieldHelper { if (array.empty()) return; WriteTagTo(md.tag, output); int cached_size = - Get<int>(static_cast<const uint8*>(field) + sizeof(RepeatedField<T>)); + Get<int>(static_cast<const uint8_t*>(field) + sizeof(RepeatedField<T>)); WriteLengthTo(cached_size, output); for (int i = 0; i < array.size(); i++) { SerializeTo<type>(&array[i], output); @@ -519,6 +538,9 @@ struct PackedFieldHelper<WireFormatLite::TYPE_GROUP> template <> struct PackedFieldHelper<WireFormatLite::TYPE_MESSAGE> : PackedFieldHelper<WireFormatLite::TYPE_STRING> {}; +template <> +struct PackedFieldHelper<FieldMetadata::kInlinedType> + : PackedFieldHelper<WireFormatLite::TYPE_STRING> {}; template <int type> struct OneOfFieldHelper { @@ -529,6 +551,15 @@ struct OneOfFieldHelper { }; +template <> +struct OneOfFieldHelper<FieldMetadata::kInlinedType> { + template <typename O> + static void Serialize(const void* field, const FieldMetadata& md, O* output) { + SingularFieldHelper<FieldMetadata::kInlinedType>::Serialize( + Get<const TProtoStringType*>(field), md, output); + } +}; + void SerializeNotImplemented(int field) { GOOGLE_LOG(FATAL) << "Not implemented field number " << field; } @@ -569,6 +600,11 @@ bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) { } +template <> +bool IsNull<FieldMetadata::kInlinedType>(const void* ptr) { + return static_cast<const TProtoStringType*>(ptr)->empty(); +} + #define SERIALIZERS_FOR_TYPE(type) \ case SERIALIZE_TABLE_OP(type, FieldMetadata::kPresence): \ if (!IsPresent(base, field_metadata.has_offset)) continue; \ @@ -590,13 +626,13 @@ bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) { OneOfFieldHelper<type>::Serialize(ptr, field_metadata, output); \ break -void SerializeInternal(const uint8* base, +void SerializeInternal(const uint8_t* base, const FieldMetadata* field_metadata_table, - int32 num_fields, io::CodedOutputStream* output) { + int32_t num_fields, io::CodedOutputStream* output) { SpecialSerializer func = nullptr; for (int i = 0; i < num_fields; i++) { const FieldMetadata& field_metadata = field_metadata_table[i]; - const uint8* ptr = base + field_metadata.offset; + const uint8_t* ptr = base + field_metadata.offset; switch (field_metadata.type) { SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_DOUBLE); SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FLOAT); @@ -616,6 +652,7 @@ void SerializeInternal(const uint8* base, SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED64); SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT32); SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT64); + SERIALIZERS_FOR_TYPE(FieldMetadata::kInlinedType); // Special cases case FieldMetadata::kSpecial: @@ -631,16 +668,16 @@ void SerializeInternal(const uint8* base, } } -uint8* SerializeInternalToArray(const uint8* base, - const FieldMetadata* field_metadata_table, - int32 num_fields, bool is_deterministic, - uint8* buffer) { +uint8_t* SerializeInternalToArray(const uint8_t* base, + const FieldMetadata* field_metadata_table, + int32_t num_fields, bool is_deterministic, + uint8_t* buffer) { ArrayOutput array_output = {buffer, is_deterministic}; ArrayOutput* output = &array_output; SpecialSerializer func = nullptr; for (int i = 0; i < num_fields; i++) { const FieldMetadata& field_metadata = field_metadata_table[i]; - const uint8* ptr = base + field_metadata.offset; + const uint8_t* ptr = base + field_metadata.offset; switch (field_metadata.type) { SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_DOUBLE); SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_FLOAT); @@ -660,6 +697,7 @@ uint8* SerializeInternalToArray(const uint8* base, SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SFIXED64); SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT32); SERIALIZERS_FOR_TYPE(WireFormatLite::TYPE_SINT64); + SERIALIZERS_FOR_TYPE(FieldMetadata::kInlinedType); // Special cases case FieldMetadata::kSpecial: { io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX); @@ -680,14 +718,15 @@ uint8* SerializeInternalToArray(const uint8* base, } #undef SERIALIZERS_FOR_TYPE -void ExtensionSerializer(const uint8* ptr, uint32 offset, uint32 tag, - uint32 has_offset, io::CodedOutputStream* output) { +void ExtensionSerializer(const MessageLite* extendee, const uint8_t* ptr, + uint32_t offset, uint32_t tag, uint32_t has_offset, + io::CodedOutputStream* output) { reinterpret_cast<const ExtensionSet*>(ptr + offset) - ->SerializeWithCachedSizes(tag, has_offset, output); + ->SerializeWithCachedSizes(extendee, tag, has_offset, output); } -void UnknownFieldSerializerLite(const uint8* ptr, uint32 offset, uint32 tag, - uint32 has_offset, +void UnknownFieldSerializerLite(const uint8_t* ptr, uint32_t offset, + uint32_t tag, uint32_t has_offset, io::CodedOutputStream* output) { output->WriteString( reinterpret_cast<const InternalMetadata*>(ptr + offset) @@ -721,9 +760,7 @@ MessageLite* GetOwnedMessageInternal(Arena* message_arena, GOOGLE_DCHECK(Arena::InternalHelper<MessageLite>::GetOwningArena(submessage) == submessage_arena); GOOGLE_DCHECK(message_arena != submessage_arena); -#ifdef PROTOBUF_INTERNAL_USE_MUST_USE_RESULT GOOGLE_DCHECK_EQ(submessage_arena, nullptr); -#endif // PROTOBUF_INTERNAL_USE_MUST_USE_RESULT if (message_arena != NULL && submessage_arena == NULL) { message_arena->Own(submessage); return submessage; diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h index 2f111602ec..65139d032a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h @@ -132,27 +132,28 @@ bool AllAreInitializedWeak(const RepeatedPtrField<T>& t) { return true; } -inline bool IsPresent(const void* base, uint32 hasbit) { - const uint32* has_bits_array = static_cast<const uint32*>(base); +inline bool IsPresent(const void* base, uint32_t hasbit) { + const uint32_t* has_bits_array = static_cast<const uint32_t*>(base); return (has_bits_array[hasbit / 32] & (1u << (hasbit & 31))) != 0; } -inline bool IsOneofPresent(const void* base, uint32 offset, uint32 tag) { - const uint32* oneof = - reinterpret_cast<const uint32*>(static_cast<const uint8*>(base) + offset); +inline bool IsOneofPresent(const void* base, uint32_t offset, uint32_t tag) { + const uint32_t* oneof = reinterpret_cast<const uint32_t*>( + static_cast<const uint8_t*>(base) + offset); return *oneof == tag >> 3; } -typedef void (*SpecialSerializer)(const uint8* base, uint32 offset, uint32 tag, - uint32 has_offset, +typedef void (*SpecialSerializer)(const uint8_t* base, uint32_t offset, + uint32_t tag, uint32_t has_offset, io::CodedOutputStream* output); -PROTOBUF_EXPORT void ExtensionSerializer(const uint8* base, uint32 offset, - uint32 tag, uint32 has_offset, +PROTOBUF_EXPORT void ExtensionSerializer(const MessageLite* extendee, + const uint8_t* ptr, uint32_t offset, + uint32_t tag, uint32_t has_offset, io::CodedOutputStream* output); -PROTOBUF_EXPORT void UnknownFieldSerializerLite(const uint8* base, - uint32 offset, uint32 tag, - uint32 has_offset, +PROTOBUF_EXPORT void UnknownFieldSerializerLite(const uint8_t* base, + uint32_t offset, uint32_t tag, + uint32_t has_offset, io::CodedOutputStream* output); PROTOBUF_EXPORT MessageLite* DuplicateIfNonNullInternal(MessageLite* message); diff --git a/contrib/libs/protobuf/src/google/protobuf/has_bits.h b/contrib/libs/protobuf/src/google/protobuf/has_bits.h index 66d3cd4968..acbca689ed 100644 --- a/contrib/libs/protobuf/src/google/protobuf/has_bits.h +++ b/contrib/libs/protobuf/src/google/protobuf/has_bits.h @@ -53,11 +53,11 @@ class HasBits { memset(has_bits_, 0, sizeof(has_bits_)); } - PROTOBUF_NDEBUG_INLINE uint32& operator[](int index) { + PROTOBUF_NDEBUG_INLINE uint32_t& operator[](int index) { return has_bits_[index]; } - PROTOBUF_NDEBUG_INLINE const uint32& operator[](int index) const { + PROTOBUF_NDEBUG_INLINE const uint32_t& operator[](int index) const { return has_bits_[index]; } @@ -76,7 +76,7 @@ class HasBits { bool empty() const; private: - uint32 has_bits_[doublewords]; + uint32_t has_bits_[doublewords]; }; template <> diff --git a/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.h b/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.h index 0569266301..c9b59076b2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.h +++ b/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.h @@ -80,8 +80,8 @@ class PROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite { size_t ByteSizeLong() const override { return data_.size(); } - uint8* _InternalSerialize(uint8* target, - io::EpsCopyOutputStream* stream) const final { + uint8_t* _InternalSerialize(uint8_t* target, + io::EpsCopyOutputStream* stream) const final { return stream->WriteRaw(data_.data(), static_cast<int>(data_.size()), target); } diff --git a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc new file mode 100644 index 0000000000..62c623366c --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.cc @@ -0,0 +1,110 @@ +// 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. + +#include <google/protobuf/inlined_string_field.h> + +#include <google/protobuf/parse_context.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/message_lite.h> + +// clang-format off +#include <google/protobuf/port_def.inc> +// clang-format on + +namespace google { +namespace protobuf { +namespace internal { + + +TProtoStringType* InlinedStringField::Mutable(const LazyString& /*default_value*/, + Arena* arena, bool donated, + uint32_t* donating_states, + uint32_t mask) { + if (arena == nullptr || !donated) { + return UnsafeMutablePointer(); + } + return MutableSlow(arena, donated, donating_states, mask); +} + +TProtoStringType* InlinedStringField::Mutable(ArenaStringPtr::EmptyDefault, + Arena* arena, bool donated, + uint32_t* donating_states, + uint32_t mask) { + if (arena == nullptr || !donated) { + return UnsafeMutablePointer(); + } + return MutableSlow(arena, donated, donating_states, mask); +} + +TProtoStringType* InlinedStringField::MutableSlow(::google::protobuf::Arena* arena, + bool donated, + uint32_t* donating_states, + uint32_t mask) { + return UnsafeMutablePointer(); +} + +void InlinedStringField::SetAllocated(const TProtoStringType* default_value, + TProtoStringType* value, Arena* arena, + bool donated, uint32_t* donating_states, + uint32_t mask) { + SetAllocatedNoArena(default_value, value); +} + +void InlinedStringField::Set(const TProtoStringType* default_value, + TProtoStringType&& value, Arena* arena, bool donated, + uint32_t* donating_states, uint32_t mask) { + SetNoArena(default_value, std::move(value)); +} + +TProtoStringType* InlinedStringField::Release(const TProtoStringType* default_value, + Arena* arena, bool donated) { + if (arena == nullptr && !donated) { + return ReleaseNonDefaultNoArena(default_value); + } + return ReleaseNonDefault(default_value, arena); +} + +TProtoStringType* InlinedStringField::ReleaseNonDefault( + const TProtoStringType* default_value, Arena* arena) { + return ReleaseNonDefaultNoArena(default_value); +} + +void InlinedStringField::ClearToDefault(const LazyString& default_value, + Arena* arena, bool donated) { + (void)arena; + get_mutable()->assign(default_value.get()); +} + + +} // namespace internal +} // namespace protobuf +} // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h new file mode 100644 index 0000000000..6b8bdc73b9 --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h @@ -0,0 +1,384 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__ +#define GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__ + +#include <string> +#include <utility> + +#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/message_lite.h> +#include <google/protobuf/port.h> +#include <google/protobuf/stubs/strutil.h> + +// Must be included last. +#include <google/protobuf/port_def.inc> + +#ifdef SWIG +#error "You cannot SWIG proto headers" +#endif + +namespace google { +namespace protobuf { + +class Arena; + +namespace internal { + +// InlinedStringField wraps a TProtoStringType instance and exposes an API similar to +// ArenaStringPtr's wrapping of a TProtoStringType* instance. +// +// default_value parameters are taken for consistency with ArenaStringPtr, but +// are not used for most methods. With inlining, these should be removed from +// the generated binary. +// +// InlinedStringField has a donating mechanism that allows string buffer +// allocated on arena. A string is donated means both the string container and +// the data buffer are on arena. The donating mechanism here is similar to the +// one in ArenaStringPtr with some differences: +// +// When an InlinedStringField is constructed, the donating state is true. This +// is because the string container is directly stored in the message on the +// arena: +// +// Construction: donated=true +// Arena: +// +-----------------------+ +// |Message foo: | +// | +-------------------+ | +// | |InlinedStringField:| | +// | | +-----+ | | +// | | | | | | | | +// | | +-----+ | | +// | +-------------------+ | +// +-----------------------+ +// +// When lvalue Set is called, the donating state is still true. String data will +// be allocated on the arena: +// +// Lvalue Set: donated=true +// Arena: +// +-----------------------+ +// |Message foo: | +// | +-------------------+ | +// | |InlinedStringField:| | +// | | +-----+ | | +// | | | | | | | | +// | | +|----+ | | +// | +--|----------------+ | +// | V | +// | +----------------+ | +// | |'f','o','o',... | | +// | +----------------+ | +// +-----------------------+ +// +// Some operations will undonate a donated string, including: Mutable, +// SetAllocated, Rvalue Set, and Swap with a non-donated string. +// +// For more details of the donating states transitions, go/pd-inlined-string. +class PROTOBUF_EXPORT InlinedStringField { + public: + InlinedStringField() { Init(); } + inline void Init() { new (get_mutable()) TProtoStringType(); } + // Add the dummy parameter just to make InlinedStringField(nullptr) + // unambiguous. + constexpr InlinedStringField( + const ExplicitlyConstructed<TProtoStringType>* /*default_value*/, + bool /*dummy*/) + : value_{} {} + explicit InlinedStringField(const TProtoStringType& default_value); + explicit InlinedStringField(Arena* arena); + ~InlinedStringField() { Destruct(); } + + // Lvalue Set. To save space, we pack the donating states of multiple + // InlinedStringFields into an uint32_t `donating_states`. The `mask` + // indicates the position of the bit for this InlinedStringField. `donated` is + // whether this field is donated. + // + // The caller should guarantee that: + // + // `donated == ((donating_states & ~mask) != 0)` + // + // This method never changes the `donating_states`. + void Set(const TProtoStringType* default_value, ConstStringParam value, + Arena* arena, bool donated, uint32_t* /*donating_states*/, + uint32_t /*mask*/) { + (void)arena; + (void)donated; + SetNoArena(default_value, value); + } + + // Rvalue Set. If this field is donated, this method will undonate this field + // by mutating the `donating_states` according to `mask`. + void Set(const TProtoStringType* default_value, TProtoStringType&& value, Arena* arena, + bool donated, uint32_t* donating_states, uint32_t mask); + + template <typename FirstParam> + void Set(FirstParam p1, const char* str, ::google::protobuf::Arena* arena, bool donated, + uint32_t* donating_states, uint32_t mask) { + Set(p1, ConstStringParam(str), arena, donated, donating_states, mask); + } + + template <typename FirstParam> + void Set(FirstParam p1, const char* str, size_t size, ::google::protobuf::Arena* arena, + bool donated, uint32_t* donating_states, uint32_t mask) { + ConstStringParam sp{str, size}; // for string_view and `const string &` + Set(p1, sp, arena, donated, donating_states, mask); + } + + template <typename FirstParam, typename RefWrappedType> + void Set(FirstParam p1, + std::reference_wrapper<RefWrappedType> const_string_ref, + ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states, + uint32_t mask) { + Set(p1, const_string_ref.get(), arena, donated, donating_states, mask); + } + + template <typename FirstParam, typename SecondParam> + void SetBytes(FirstParam p1, SecondParam&& p2, ::google::protobuf::Arena* arena, + bool donated, uint32_t* donating_states, uint32_t mask) { + Set(p1, static_cast<SecondParam&&>(p2), arena, donated, donating_states, + mask); + } + + template <typename FirstParam> + void SetBytes(FirstParam p1, const void* str, size_t size, + ::google::protobuf::Arena* arena, bool donated, uint32_t* donating_states, + uint32_t mask) { + // Must work whether ConstStringParam is string_view or `const string &` + ConstStringParam sp{static_cast<const char*>(str), size}; + Set(p1, sp, arena, donated, donating_states, mask); + } + + PROTOBUF_NDEBUG_INLINE void SetNoArena(const TProtoStringType* default_value, + StringPiece value); + PROTOBUF_NDEBUG_INLINE void SetNoArena(const TProtoStringType* default_value, + TProtoStringType&& value); + + // Basic accessors. + PROTOBUF_NDEBUG_INLINE const TProtoStringType& Get() const { return GetNoArena(); } + PROTOBUF_NDEBUG_INLINE const TProtoStringType& GetNoArena() const; + + // Mutable returns a TProtoStringType* instance that is heap-allocated. If this + // field is donated, this method undonates this field by mutating the + // `donating_states` according to `mask`, and copies the content of the + // original string to the returning string. + TProtoStringType* Mutable(const LazyString& default_value, Arena* arena, + bool donated, uint32_t* donating_states, uint32_t mask); + TProtoStringType* Mutable(ArenaStringPtr::EmptyDefault, Arena* arena, bool donated, + uint32_t* donating_states, uint32_t mask); + + // Release returns a TProtoStringType* instance that is heap-allocated and is not + // Own()'d by any arena. If the field is not set, this returns NULL. The + // caller retains ownership. Clears this field back to NULL state. Used to + // implement release_<field>() methods on generated classes. + PROTOBUF_MUST_USE_RESULT TProtoStringType* Release( + const TProtoStringType* default_value, Arena* arena, bool donated); + PROTOBUF_MUST_USE_RESULT TProtoStringType* ReleaseNonDefault( + const TProtoStringType* default_value, Arena* arena); + TProtoStringType* ReleaseNonDefaultNoArena(const TProtoStringType* default_value); + + // Takes a TProtoStringType that is heap-allocated, and takes ownership. The + // TProtoStringType's destructor is registered with the arena. Used to implement + // set_allocated_<field> in generated classes. + // + // If this field is donated, this method undonates this field by mutating the + // `donating_states` according to `mask`. + void SetAllocated(const TProtoStringType* default_value, TProtoStringType* value, + Arena* arena, bool donated, uint32_t* donating_states, + uint32_t mask); + + void SetAllocatedNoArena(const TProtoStringType* default_value, + TProtoStringType* value); + + // When one of `this` and `from` is donated and the other is not donated, this + // method will undonate the donated one and swap the two heap-allocated + // strings. + PROTOBUF_NDEBUG_INLINE void Swap(InlinedStringField* from, + const TProtoStringType* default_value, + Arena* arena, bool donated, + bool from_donated, uint32_t* donating_states, + uint32_t* from_donating_states, + uint32_t mask); + + // Frees storage (if not on an arena). + PROTOBUF_NDEBUG_INLINE void Destroy(const TProtoStringType* default_value, + Arena* arena) { + if (arena == nullptr) { + DestroyNoArena(default_value); + } + } + PROTOBUF_NDEBUG_INLINE void DestroyNoArena(const TProtoStringType* default_value); + + // Clears content, but keeps allocated TProtoStringType, to avoid the overhead of + // heap operations. After this returns, the content (as seen by the user) will + // always be the empty TProtoStringType. + PROTOBUF_NDEBUG_INLINE void ClearToEmpty() { ClearNonDefaultToEmpty(); } + PROTOBUF_NDEBUG_INLINE void ClearNonDefaultToEmpty() { + get_mutable()->clear(); + } + + // Clears content, but keeps allocated TProtoStringType if arena != NULL, to avoid + // the overhead of heap operations. After this returns, the content (as seen + // by the user) will always be equal to |default_value|. + void ClearToDefault(const LazyString& default_value, Arena* arena, + bool donated); + + // Returns a mutable pointer, but doesn't initialize the string to the + // default value. + PROTOBUF_NDEBUG_INLINE TProtoStringType* MutableNoArenaNoDefault( + const TProtoStringType* /*default_value*/); + + // Generated code / reflection only! Returns a mutable pointer to the string. + PROTOBUF_NDEBUG_INLINE TProtoStringType* UnsafeMutablePointer(); + + // InlinedStringField doesn't have things like the `default_value` pointer in + // ArenaStringPtr. + bool IsDefault(const TProtoStringType* /*default_value*/) const { return false; } + + private: + void Destruct() { get_mutable()->~TBasicString(); } + + PROTOBUF_NDEBUG_INLINE TProtoStringType* get_mutable(); + PROTOBUF_NDEBUG_INLINE const TProtoStringType* get_const() const; + + alignas(TProtoStringType) char value_[sizeof(TProtoStringType)]; + + TProtoStringType* MutableSlow(::google::protobuf::Arena* arena, bool donated, + uint32_t* donating_states, uint32_t mask); + + + // When constructed in an Arena, we want our destructor to be skipped. + friend class ::google::protobuf::Arena; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; +}; + +inline TProtoStringType* InlinedStringField::get_mutable() { + return reinterpret_cast<TProtoStringType*>(&value_); +} + +inline const TProtoStringType* InlinedStringField::get_const() const { + return reinterpret_cast<const TProtoStringType*>(&value_); +} + +inline InlinedStringField::InlinedStringField( + const TProtoStringType& default_value) { + new (get_mutable()) TProtoStringType(default_value); +} + +inline InlinedStringField::InlinedStringField(Arena* arena) { + Init(); + if (arena != nullptr) { + arena->OwnDestructor(get_mutable()); + } +} + +inline const TProtoStringType& InlinedStringField::GetNoArena() const { + return *get_const(); +} + +inline void InlinedStringField::SetAllocatedNoArena( + const TProtoStringType* /*default_value*/, TProtoStringType* value) { + if (value == nullptr) { + // Currently, inlined string field can't have non empty default. + get_mutable()->clear(); + } else { + get_mutable()->assign(std::move(*value)); + delete value; + } +} + +inline void InlinedStringField::DestroyNoArena(const TProtoStringType*) { + // This is invoked from the generated message's ArenaDtor, which is used to + // clean up objects not allocated on the Arena. + this->~InlinedStringField(); +} + +inline TProtoStringType* InlinedStringField::ReleaseNonDefaultNoArena( + const TProtoStringType* /*default_value*/) { + // Currently, inlined string field can't have non empty default. + auto* released = new TProtoStringType(); + get_mutable()->swap(*released); + return released; +} + +inline void InlinedStringField::SetNoArena(const TProtoStringType* /*default_value*/, + StringPiece value) { + get_mutable()->assign(value.data(), value.length()); +} + +inline void InlinedStringField::SetNoArena(const TProtoStringType* /*default_value*/, + TProtoStringType&& value) { + get_mutable()->assign(std::move(value)); +} + +inline void InlinedStringField::Swap( + InlinedStringField* from, const TProtoStringType* /*default_value*/, + Arena* arena, bool donated, bool from_donated, uint32_t* donating_states, + uint32_t* from_donating_states, uint32_t mask) { +#if GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE + // If one is donated and the other is not, undonate the donated one. + if (donated && !from_donated) { + MutableSlow(arena, donated, donating_states, mask); + } else if (!donated && from_donated) { + from->MutableSlow(arena, from_donated, from_donating_states, mask); + } + // Then, swap the two undonated strings. +#else + (void)arena; + (void)donated; + (void)from_donated; + (void)donating_states; + (void)from_donating_states; + (void)mask; +#endif + get_mutable()->swap(*from->get_mutable()); +} + +inline TProtoStringType* InlinedStringField::MutableNoArenaNoDefault( + const TProtoStringType*) { + return get_mutable(); +} + +inline TProtoStringType* InlinedStringField::UnsafeMutablePointer() { + return get_mutable(); +} + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include <google/protobuf/port_undef.inc> + +#endif // GOOGLE_PROTOBUF_INLINED_STRING_FIELD_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc index 43260d5b96..8c61bcbff7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc @@ -151,7 +151,7 @@ CodedInputStream::IncrementRecursionDepthAndPushLimit(int byte_limit) { } CodedInputStream::Limit CodedInputStream::ReadLengthAndPushLimit() { - uint32 length; + uint32_t length; return PushLimit(ReadVarint32(&length) ? length : 0); } @@ -243,7 +243,7 @@ bool CodedInputStream::ReadRaw(void* buffer, int size) { while ((current_buffer_size = BufferSize()) < size) { // Reading past end of buffer. Copy what we have, then refresh. memcpy(buffer, buffer_, current_buffer_size); - buffer = reinterpret_cast<uint8*>(buffer) + current_buffer_size; + buffer = reinterpret_cast<uint8_t*>(buffer) + current_buffer_size; size -= current_buffer_size; Advance(current_buffer_size); if (!Refresh()) return false; @@ -308,11 +308,11 @@ bool CodedInputStream::ReadStringFallback(TProtoStringType* buffer, int size) { } -bool CodedInputStream::ReadLittleEndian32Fallback(uint32* value) { - uint8 bytes[sizeof(*value)]; +bool CodedInputStream::ReadLittleEndian32Fallback(uint32_t* value) { + uint8_t bytes[sizeof(*value)]; - const uint8* ptr; - if (BufferSize() >= static_cast<int64>(sizeof(*value))) { + const uint8_t* ptr; + if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) { // Fast path: Enough bytes in the buffer to read directly. ptr = buffer_; Advance(sizeof(*value)); @@ -326,10 +326,10 @@ bool CodedInputStream::ReadLittleEndian32Fallback(uint32* value) { } bool CodedInputStream::ReadLittleEndian64Fallback(uint64* value) { - uint8 bytes[sizeof(*value)]; + uint8_t bytes[sizeof(*value)]; - const uint8* ptr; - if (BufferSize() >= static_cast<int64>(sizeof(*value))) { + const uint8_t* ptr; + if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) { // Fast path: Enough bytes in the buffer to read directly. ptr = buffer_; Advance(sizeof(*value)); @@ -341,6 +341,24 @@ bool CodedInputStream::ReadLittleEndian64Fallback(uint64* value) { ReadLittleEndian64FromArray(ptr, value); return true; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +bool CodedInputStream::ReadLittleEndian64Fallback(uint64_t* value) { + uint8_t bytes[sizeof(*value)]; + + const uint8_t* ptr; + if (BufferSize() >= static_cast<int64_t>(sizeof(*value))) { + // Fast path: Enough bytes in the buffer to read directly. + ptr = buffer_; + Advance(sizeof(*value)); + } else { + // Slow path: Had to read past the end of the buffer. + if (!ReadRaw(bytes, sizeof(*value))) return false; + ptr = bytes; + } + ReadLittleEndian64FromArray(ptr, value); + return true; +} +#endif namespace { @@ -348,11 +366,11 @@ namespace { // compile time, compiler can generate optimal code. For example, instead of // subtracting 0x80 at each iteration, it subtracts properly shifted mask once. template <size_t N> -const uint8* DecodeVarint64KnownSize(const uint8* buffer, uint64* value) { +const uint8_t* DecodeVarint64KnownSize(const uint8_t* buffer, uint64_t* value) { GOOGLE_DCHECK_GT(N, 0); - uint64 result = static_cast<uint64>(buffer[N - 1]) << (7 * (N - 1)); + uint64_t result = static_cast<uint64_t>(buffer[N - 1]) << (7 * (N - 1)); for (size_t i = 0, offset = 0; i < N - 1; i++, offset += 7) { - result += static_cast<uint64>(buffer[i] - 0x80) << offset; + result += static_cast<uint64_t>(buffer[i] - 0x80) << offset; } *value = result; return buffer + N; @@ -363,18 +381,18 @@ const uint8* DecodeVarint64KnownSize(const uint8* buffer, uint64* value) { // part is buffer + (number of bytes read). This function is always inlined, // so returning a pair is costless. PROTOBUF_ALWAYS_INLINE -::std::pair<bool, const uint8*> ReadVarint32FromArray(uint32 first_byte, - const uint8* buffer, - uint32* value); -inline ::std::pair<bool, const uint8*> ReadVarint32FromArray( - uint32 first_byte, const uint8* buffer, uint32* value) { +::std::pair<bool, const uint8_t*> ReadVarint32FromArray(uint32_t first_byte, + const uint8_t* buffer, + uint32_t* value); +inline ::std::pair<bool, const uint8_t*> ReadVarint32FromArray( + uint32_t first_byte, const uint8_t* buffer, uint32_t* value) { // Fast path: We have enough bytes left in the buffer to guarantee that // this read won't cross the end, so we can skip the checks. GOOGLE_DCHECK_EQ(*buffer, first_byte); GOOGLE_DCHECK_EQ(first_byte & 0x80, 0x80) << first_byte; - const uint8* ptr = buffer; - uint32 b; - uint32 result = first_byte - 0x80; + const uint8_t* ptr = buffer; + uint32_t b; + uint32_t result = first_byte - 0x80; ++ptr; // We just processed the first byte. Move on to the second. b = *(ptr++); result += b << 7; @@ -409,14 +427,14 @@ done: return std::make_pair(true, ptr); } -PROTOBUF_ALWAYS_INLINE::std::pair<bool, const uint8*> ReadVarint64FromArray( - const uint8* buffer, uint64* value); -inline ::std::pair<bool, const uint8*> ReadVarint64FromArray( - const uint8* buffer, uint64* value) { +PROTOBUF_ALWAYS_INLINE::std::pair<bool, const uint8_t*> ReadVarint64FromArray( + const uint8_t* buffer, uint64_t* value); +inline ::std::pair<bool, const uint8_t*> ReadVarint64FromArray( + const uint8_t* buffer, uint64_t* value) { // Assumes varint64 is at least 2 bytes. GOOGLE_DCHECK_GE(buffer[0], 128); - const uint8* next; + const uint8_t* next; if (buffer[1] < 128) { next = DecodeVarint64KnownSize<2>(buffer, value); } else if (buffer[2] < 128) { @@ -446,23 +464,23 @@ inline ::std::pair<bool, const uint8*> ReadVarint64FromArray( } // namespace -bool CodedInputStream::ReadVarint32Slow(uint32* value) { +bool CodedInputStream::ReadVarint32Slow(uint32_t* value) { // Directly invoke ReadVarint64Fallback, since we already tried to optimize // for one-byte varints. - std::pair<uint64, bool> p = ReadVarint64Fallback(); - *value = static_cast<uint32>(p.first); + std::pair<uint64_t, bool> p = ReadVarint64Fallback(); + *value = static_cast<uint32_t>(p.first); return p.second; } -int64 CodedInputStream::ReadVarint32Fallback(uint32 first_byte_or_zero) { +int64_t CodedInputStream::ReadVarint32Fallback(uint32_t first_byte_or_zero) { if (BufferSize() >= kMaxVarintBytes || // Optimization: We're also safe if the buffer is non-empty and it ends // with a byte that would terminate a varint. (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { GOOGLE_DCHECK_NE(first_byte_or_zero, 0) << "Caller should provide us with *buffer_ when buffer is non-empty"; - uint32 temp; - ::std::pair<bool, const uint8*> p = + uint32_t temp; + ::std::pair<bool, const uint8_t*> p = ReadVarint32FromArray(first_byte_or_zero, buffer_, &temp); if (!p.first) return -1; buffer_ = p.second; @@ -471,16 +489,16 @@ int64 CodedInputStream::ReadVarint32Fallback(uint32 first_byte_or_zero) { // Really slow case: we will incur the cost of an extra function call here, // but moving this out of line reduces the size of this function, which // improves the common case. In micro benchmarks, this is worth about 10-15% - uint32 temp; - return ReadVarint32Slow(&temp) ? static_cast<int64>(temp) : -1; + uint32_t temp; + return ReadVarint32Slow(&temp) ? static_cast<int64_t>(temp) : -1; } } int CodedInputStream::ReadVarintSizeAsIntSlow() { // Directly invoke ReadVarint64Fallback, since we already tried to optimize // for one-byte varints. - std::pair<uint64, bool> p = ReadVarint64Fallback(); - if (!p.second || p.first > static_cast<uint64>(INT_MAX)) return -1; + std::pair<uint64_t, bool> p = ReadVarint64Fallback(); + if (!p.second || p.first > static_cast<uint64_t>(INT_MAX)) return -1; return p.first; } @@ -489,9 +507,9 @@ int CodedInputStream::ReadVarintSizeAsIntFallback() { // Optimization: We're also safe if the buffer is non-empty and it ends // with a byte that would terminate a varint. (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { - uint64 temp; - ::std::pair<bool, const uint8*> p = ReadVarint64FromArray(buffer_, &temp); - if (!p.first || temp > static_cast<uint64>(INT_MAX)) return -1; + uint64_t temp; + ::std::pair<bool, const uint8_t*> p = ReadVarint64FromArray(buffer_, &temp); + if (!p.first || temp > static_cast<uint64_t>(INT_MAX)) return -1; buffer_ = p.second; return temp; } else { @@ -502,7 +520,7 @@ int CodedInputStream::ReadVarintSizeAsIntFallback() { } } -uint32 CodedInputStream::ReadTagSlow() { +uint32_t CodedInputStream::ReadTagSlow() { if (buffer_ == buffer_end_) { // Call refresh. if (!Refresh()) { @@ -523,12 +541,12 @@ uint32 CodedInputStream::ReadTagSlow() { // For the slow path, just do a 64-bit read. Try to optimize for one-byte tags // again, since we have now refreshed the buffer. - uint64 result = 0; + uint64_t result = 0; if (!ReadVarint64(&result)) return 0; - return static_cast<uint32>(result); + return static_cast<uint32_t>(result); } -uint32 CodedInputStream::ReadTagFallback(uint32 first_byte_or_zero) { +uint32_t CodedInputStream::ReadTagFallback(uint32_t first_byte_or_zero) { const int buf_size = BufferSize(); if (buf_size >= kMaxVarintBytes || // Optimization: We're also safe if the buffer is non-empty and it ends @@ -539,8 +557,8 @@ uint32 CodedInputStream::ReadTagFallback(uint32 first_byte_or_zero) { ++buffer_; return 0; } - uint32 tag; - ::std::pair<bool, const uint8*> p = + uint32_t tag; + ::std::pair<bool, const uint8_t*> p = ReadVarint32FromArray(first_byte_or_zero, buffer_, &tag); if (!p.first) { return 0; @@ -565,13 +583,13 @@ uint32 CodedInputStream::ReadTagFallback(uint32 first_byte_or_zero) { } } -bool CodedInputStream::ReadVarint64Slow(uint64* value) { +bool CodedInputStream::ReadVarint64Slow(uint64_t* value) { // Slow path: This read might cross the end of the buffer, so we // need to check and refresh the buffer if and when it does. - uint64 result = 0; + uint64_t result = 0; int count = 0; - uint32 b; + uint32_t b; do { if (count == kMaxVarintBytes) { @@ -585,7 +603,7 @@ bool CodedInputStream::ReadVarint64Slow(uint64* value) { } } b = *buffer_; - result |= static_cast<uint64>(b & 0x7F) << (7 * count); + result |= static_cast<uint64_t>(b & 0x7F) << (7 * count); Advance(1); ++count; } while (b & 0x80); @@ -594,20 +612,20 @@ bool CodedInputStream::ReadVarint64Slow(uint64* value) { return true; } -std::pair<uint64, bool> CodedInputStream::ReadVarint64Fallback() { +std::pair<uint64_t, bool> CodedInputStream::ReadVarint64Fallback() { if (BufferSize() >= kMaxVarintBytes || // Optimization: We're also safe if the buffer is non-empty and it ends // with a byte that would terminate a varint. (buffer_end_ > buffer_ && !(buffer_end_[-1] & 0x80))) { - uint64 temp; - ::std::pair<bool, const uint8*> p = ReadVarint64FromArray(buffer_, &temp); + uint64_t temp; + ::std::pair<bool, const uint8_t*> p = ReadVarint64FromArray(buffer_, &temp); if (!p.first) { return std::make_pair(0, false); } buffer_ = p.second; return std::make_pair(temp, true); } else { - uint64 temp; + uint64_t temp; bool success = ReadVarint64Slow(&temp); return std::make_pair(temp, success); } @@ -633,7 +651,7 @@ bool CodedInputStream::Refresh() { const void* void_buffer; int buffer_size; if (NextNonEmpty(input_, &void_buffer, &buffer_size)) { - buffer_ = reinterpret_cast<const uint8*>(void_buffer); + buffer_ = reinterpret_cast<const uint8_t*>(void_buffer); buffer_end_ = buffer_ + buffer_size; GOOGLE_CHECK_GE(buffer_size, 0); @@ -670,7 +688,7 @@ void EpsCopyOutputStream::EnableAliasing(bool enabled) { aliasing_enabled_ = enabled && stream_->AllowsAliasing(); } -int64 EpsCopyOutputStream::ByteCount(uint8* ptr) const { +int64_t EpsCopyOutputStream::ByteCount(uint8_t* ptr) const { // Calculate the current offset relative to the end of the stream buffer. int delta = (end_ - ptr) + (buffer_end_ ? 0 : kSlopBytes); return stream_->ByteCount() - delta; @@ -679,7 +697,7 @@ int64 EpsCopyOutputStream::ByteCount(uint8* ptr) const { // Flushes what's written out to the underlying ZeroCopyOutputStream buffers. // Returns the size remaining in the buffer and sets buffer_end_ to the start // of the remaining buffer, ie. [buffer_end_, buffer_end_ + return value) -int EpsCopyOutputStream::Flush(uint8* ptr) { +int EpsCopyOutputStream::Flush(uint8_t* ptr) { while (buffer_end_ && ptr > end_) { int overrun = ptr - end_; GOOGLE_DCHECK(!had_error_); @@ -701,7 +719,7 @@ int EpsCopyOutputStream::Flush(uint8* ptr) { return s; } -uint8* EpsCopyOutputStream::Trim(uint8* ptr) { +uint8_t* EpsCopyOutputStream::Trim(uint8_t* ptr) { if (had_error_) return ptr; int s = Flush(ptr); if (s) stream_->BackUp(s); @@ -711,14 +729,14 @@ uint8* EpsCopyOutputStream::Trim(uint8* ptr) { } -uint8* EpsCopyOutputStream::FlushAndResetBuffer(uint8* ptr) { +uint8_t* EpsCopyOutputStream::FlushAndResetBuffer(uint8_t* ptr) { if (had_error_) return buffer_; int s = Flush(ptr); if (had_error_) return buffer_; return SetInitialBuffer(buffer_end_, s); } -bool EpsCopyOutputStream::Skip(int count, uint8** pp) { +bool EpsCopyOutputStream::Skip(int count, uint8_t** pp) { if (count < 0) return false; if (had_error_) { *pp = buffer_; @@ -737,12 +755,12 @@ bool EpsCopyOutputStream::Skip(int count, uint8** pp) { return false; } } - *pp = SetInitialBuffer(static_cast<uint8*>(data) + count, size - count); + *pp = SetInitialBuffer(static_cast<uint8_t*>(data) + count, size - count); return true; } bool EpsCopyOutputStream::GetDirectBufferPointer(void** data, int* size, - uint8** pp) { + uint8_t** pp) { if (had_error_) { *pp = buffer_; return false; @@ -763,8 +781,8 @@ bool EpsCopyOutputStream::GetDirectBufferPointer(void** data, int* size, return true; } -uint8* EpsCopyOutputStream::GetDirectBufferForNBytesAndAdvance(int size, - uint8** pp) { +uint8_t* EpsCopyOutputStream::GetDirectBufferForNBytesAndAdvance(int size, + uint8_t** pp) { if (had_error_) { *pp = buffer_; return nullptr; @@ -784,13 +802,13 @@ uint8* EpsCopyOutputStream::GetDirectBufferForNBytesAndAdvance(int size, } } -uint8* EpsCopyOutputStream::Next() { +uint8_t* EpsCopyOutputStream::Next() { GOOGLE_DCHECK(!had_error_); // NOLINT if (PROTOBUF_PREDICT_FALSE(stream_ == nullptr)) return Error(); if (buffer_end_) { // We're in the patch buffer and need to fill up the previous buffer. std::memcpy(buffer_end_, buffer_, end_ - buffer_); - uint8* ptr; + uint8_t* ptr; int size; do { void* data; @@ -799,7 +817,7 @@ uint8* EpsCopyOutputStream::Next() { // able to write. return Error(); } - ptr = static_cast<uint8*>(data); + ptr = static_cast<uint8_t*>(data); } while (size == 0); if (PROTOBUF_PREDICT_TRUE(size > kSlopBytes)) { std::memcpy(ptr, end_, kSlopBytes); @@ -822,7 +840,7 @@ uint8* EpsCopyOutputStream::Next() { } } -uint8* EpsCopyOutputStream::EnsureSpaceFallback(uint8* ptr) { +uint8_t* EpsCopyOutputStream::EnsureSpaceFallback(uint8_t* ptr) { do { if (PROTOBUF_PREDICT_FALSE(had_error_)) return buffer_; int overrun = ptr - end_; @@ -834,13 +852,13 @@ uint8* EpsCopyOutputStream::EnsureSpaceFallback(uint8* ptr) { return ptr; } -uint8* EpsCopyOutputStream::WriteRawFallback(const void* data, int size, - uint8* ptr) { +uint8_t* EpsCopyOutputStream::WriteRawFallback(const void* data, int size, + uint8_t* ptr) { int s = GetSize(ptr); while (s < size) { std::memcpy(ptr, data, s); size -= s; - data = static_cast<const uint8*>(data) + s; + data = static_cast<const uint8_t*>(data) + s; ptr = EnsureSpaceFallback(ptr + s); s = GetSize(ptr); } @@ -848,8 +866,8 @@ uint8* EpsCopyOutputStream::WriteRawFallback(const void* data, int size, return ptr + size; } -uint8* EpsCopyOutputStream::WriteAliasedRaw(const void* data, int size, - uint8* ptr) { +uint8_t* EpsCopyOutputStream::WriteAliasedRaw(const void* data, int size, + uint8_t* ptr) { if (size < GetSize(ptr) ) { return WriteRaw(data, size, ptr); @@ -861,13 +879,13 @@ uint8* EpsCopyOutputStream::WriteAliasedRaw(const void* data, int size, } #ifndef PROTOBUF_LITTLE_ENDIAN -uint8* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size, - uint8* ptr) { - auto p = static_cast<const uint8*>(data); +uint8_t* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size, + uint8_t* ptr) { + auto p = static_cast<const uint8_t*>(data); auto end = p + size; while (end - p >= kSlopBytes) { ptr = EnsureSpace(ptr); - uint32 buffer[4]; + uint32_t buffer[4]; static_assert(sizeof(buffer) == kSlopBytes, "Buffer must be kSlopBytes"); std::memcpy(buffer, p, kSlopBytes); p += kSlopBytes; @@ -876,7 +894,7 @@ uint8* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size, } while (p < end) { ptr = EnsureSpace(ptr); - uint32 buffer; + uint32_t buffer; std::memcpy(&buffer, p, 4); p += 4; ptr = CodedOutputStream::WriteLittleEndian32ToArray(buffer, ptr); @@ -884,13 +902,13 @@ uint8* EpsCopyOutputStream::WriteRawLittleEndian32(const void* data, int size, return ptr; } -uint8* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, - uint8* ptr) { - auto p = static_cast<const uint8*>(data); +uint8_t* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, + uint8_t* ptr) { + auto p = static_cast<const uint8_t*>(data); auto end = p + size; while (end - p >= kSlopBytes) { ptr = EnsureSpace(ptr); - uint64 buffer[2]; + uint64_t buffer[2]; static_assert(sizeof(buffer) == kSlopBytes, "Buffer must be kSlopBytes"); std::memcpy(buffer, p, kSlopBytes); p += kSlopBytes; @@ -899,7 +917,7 @@ uint8* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, } while (p < end) { ptr = EnsureSpace(ptr); - uint64 buffer; + uint64_t buffer; std::memcpy(&buffer, p, 8); p += 8; ptr = CodedOutputStream::WriteLittleEndian64ToArray(buffer, ptr); @@ -909,19 +927,19 @@ uint8* EpsCopyOutputStream::WriteRawLittleEndian64(const void* data, int size, #endif -uint8* EpsCopyOutputStream::WriteStringMaybeAliasedOutline(uint32 num, +uint8_t* EpsCopyOutputStream::WriteStringMaybeAliasedOutline(uint32_t num, const TProtoStringType& s, - uint8* ptr) { + uint8_t* ptr) { ptr = EnsureSpace(ptr); - uint32 size = s.size(); + uint32_t size = s.size(); ptr = WriteLengthDelim(num, size, ptr); return WriteRawMaybeAliased(s.data(), size, ptr); } -uint8* EpsCopyOutputStream::WriteStringOutline(uint32 num, const TProtoStringType& s, - uint8* ptr) { +uint8_t* EpsCopyOutputStream::WriteStringOutline(uint32_t num, const TProtoStringType& s, + uint8_t* ptr) { ptr = EnsureSpace(ptr); - uint32 size = s.size(); + uint32_t size = s.size(); ptr = WriteLengthDelim(num, size, ptr); return WriteRaw(s.data(), size, ptr); } @@ -944,28 +962,28 @@ CodedOutputStream::CodedOutputStream(ZeroCopyOutputStream* stream, CodedOutputStream::~CodedOutputStream() { Trim(); } -uint8* CodedOutputStream::WriteStringWithSizeToArray(const TProtoStringType& str, - uint8* target) { +uint8_t* CodedOutputStream::WriteStringWithSizeToArray(const TProtoStringType& str, + uint8_t* target) { GOOGLE_DCHECK_LE(str.size(), kuint32max); target = WriteVarint32ToArray(str.size(), target); return WriteStringToArray(str, target); } -uint8* CodedOutputStream::WriteVarint32ToArrayOutOfLineHelper(uint32 value, - uint8* target) { +uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLineHelper(uint32_t value, + uint8_t* target) { GOOGLE_DCHECK_GE(value, 0x80); - target[0] |= static_cast<uint8>(0x80); + target[0] |= static_cast<uint8_t>(0x80); value >>= 7; - target[1] = static_cast<uint8>(value); + target[1] = static_cast<uint8_t>(value); if (value < 0x80) { return target + 2; } target += 2; do { // Turn on continuation bit in the byte we just wrote. - target[-1] |= static_cast<uint8>(0x80); + target[-1] |= static_cast<uint8_t>(0x80); value >>= 7; - *target = static_cast<uint8>(value); + *target = static_cast<uint8_t>(value); ++target; } while (value >= 0x80); return target; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h index 534627cd50..9a4d1161c7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h @@ -75,7 +75,7 @@ // return; // } // -// uint32 size; +// uint32_t size; // coded_input->ReadVarint32(&size); // // char* text = new char[size + 1]; @@ -194,7 +194,7 @@ class PROTOBUF_EXPORT CodedInputStream { // Create a CodedInputStream that reads from the given flat array. This is // faster than using an ArrayInputStream. PushLimit(size) is implied by // this constructor. - explicit CodedInputStream(const uint8* buffer, int size); + explicit CodedInputStream(const uint8_t* buffer, int size); // Destroy the CodedInputStream and position the underlying // ZeroCopyInputStream at the first unread byte. If an error occurred while @@ -233,25 +233,35 @@ class PROTOBUF_EXPORT CodedInputStream { // Read a 32-bit little-endian integer. - bool ReadLittleEndian32(uint32* value); + bool ReadLittleEndian32(uint32_t* value); // Read a 64-bit little-endian integer. bool ReadLittleEndian64(uint64* value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + bool ReadLittleEndian64(uint64_t* value); +#endif // These methods read from an externally provided buffer. The caller is // responsible for ensuring that the buffer has sufficient space. // Read a 32-bit little-endian integer. - static const uint8* ReadLittleEndian32FromArray(const uint8* buffer, - uint32* value); + static const uint8_t* ReadLittleEndian32FromArray(const uint8_t* buffer, + uint32_t* value); // Read a 64-bit little-endian integer. - static const uint8* ReadLittleEndian64FromArray(const uint8* buffer, + static const uint8_t* ReadLittleEndian64FromArray(const uint8_t* buffer, uint64* value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static const uint8_t* ReadLittleEndian64FromArray(const uint8_t* buffer, + uint64_t* value); +#endif // Read an unsigned integer with Varint encoding, truncating to 32 bits. // Reading a 32-bit value is equivalent to reading a 64-bit one and casting - // it to uint32, but may be more efficient. - bool ReadVarint32(uint32* value); + // it to uint32_t, but may be more efficient. + bool ReadVarint32(uint32_t* value); // Read an unsigned integer with Varint encoding. bool ReadVarint64(uint64* value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + bool ReadVarint64(uint64_t* value); +#endif // Reads a varint off the wire into an "int". This should be used for reading // sizes off the wire (sizes of strings, submessages, bytes fields, etc). @@ -272,11 +282,11 @@ class PROTOBUF_EXPORT CodedInputStream { // Always inline because this is only called in one place per parse loop // but it is called for every iteration of said loop, so it should be fast. // GCC doesn't want to inline this by default. - PROTOBUF_ALWAYS_INLINE uint32 ReadTag() { + PROTOBUF_ALWAYS_INLINE uint32_t ReadTag() { return last_tag_ = ReadTagNoLastTag(); } - PROTOBUF_ALWAYS_INLINE uint32 ReadTagNoLastTag(); + PROTOBUF_ALWAYS_INLINE uint32_t ReadTagNoLastTag(); // This usually a faster alternative to ReadTag() when cutoff is a manifest // constant. It does particularly well for cutoff >= 127. The first part @@ -287,14 +297,14 @@ class PROTOBUF_EXPORT CodedInputStream { // because that can arise in several ways, and for best performance we want // to avoid an extra "is tag == 0?" check here.) PROTOBUF_ALWAYS_INLINE - std::pair<uint32, bool> ReadTagWithCutoff(uint32 cutoff) { - std::pair<uint32, bool> result = ReadTagWithCutoffNoLastTag(cutoff); + std::pair<uint32_t, bool> ReadTagWithCutoff(uint32_t cutoff) { + std::pair<uint32_t, bool> result = ReadTagWithCutoffNoLastTag(cutoff); last_tag_ = result.first; return result; } PROTOBUF_ALWAYS_INLINE - std::pair<uint32, bool> ReadTagWithCutoffNoLastTag(uint32 cutoff); + std::pair<uint32_t, bool> ReadTagWithCutoffNoLastTag(uint32_t cutoff); // Usually returns true if calling ReadVarint32() now would produce the given // value. Will always return false if ReadVarint32() would not return the @@ -303,7 +313,7 @@ class PROTOBUF_EXPORT CodedInputStream { // parameter. // Always inline because this collapses to a small number of instructions // when given a constant parameter, but GCC doesn't want to inline by default. - PROTOBUF_ALWAYS_INLINE bool ExpectTag(uint32 expected); + PROTOBUF_ALWAYS_INLINE bool ExpectTag(uint32_t expected); // Like above, except this reads from the specified buffer. The caller is // responsible for ensuring that the buffer is large enough to read a varint @@ -313,7 +323,8 @@ class PROTOBUF_EXPORT CodedInputStream { // Returns a pointer beyond the expected tag if it was found, or NULL if it // was not. PROTOBUF_ALWAYS_INLINE - static const uint8* ExpectTagFromArray(const uint8* buffer, uint32 expected); + static const uint8_t* ExpectTagFromArray(const uint8_t* buffer, + uint32_t expected); // Usually returns true if no more bytes can be read. Always returns false // if more bytes can be read. If ExpectAtEnd() returns true, a subsequent @@ -332,8 +343,8 @@ class PROTOBUF_EXPORT CodedInputStream { // of the enclosing message. The enclosing message would like to check that // tag to make sure it had the right number, so it calls LastTagWas() on // return from the embedded parser to check. - bool LastTagWas(uint32 expected); - void SetLastTag(uint32 tag) { last_tag_ = tag; } + bool LastTagWas(uint32_t expected); + void SetLastTag(uint32_t tag) { last_tag_ = tag; } // When parsing message (but NOT a group), this method must be called // immediately after MergeFromCodedStream() returns (if it returns true) @@ -536,8 +547,8 @@ class PROTOBUF_EXPORT CodedInputStream { private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedInputStream); - const uint8* buffer_; - const uint8* buffer_end_; // pointer to the end of the buffer. + const uint8_t* buffer_; + const uint8_t* buffer_end_; // pointer to the end of the buffer. ZeroCopyInputStream* input_; int total_bytes_read_; // total bytes read from input_, including // the current buffer @@ -547,7 +558,7 @@ class PROTOBUF_EXPORT CodedInputStream { int overflow_bytes_; // LastTagWas() stuff. - uint32 last_tag_; // result of last ReadTag() or ReadTagWithCutoff(). + uint32_t last_tag_; // result of last ReadTag() or ReadTagWithCutoff(). // This is set true by ReadTag{Fallback/Slow}() if it is called when exactly // at EOF, or by ExpectAtEnd() when it returns true. This happens when we @@ -615,22 +626,25 @@ class PROTOBUF_EXPORT CodedInputStream { // message crosses multiple buffers. Note: ReadVarint32Fallback() and // ReadVarint64Fallback() are called frequently and generally not inlined, so // they have been optimized to avoid "out" parameters. The former returns -1 - // if it fails and the uint32 it read otherwise. The latter has a bool + // if it fails and the uint32_t it read otherwise. The latter has a bool // indicating success or failure as part of its return type. - int64 ReadVarint32Fallback(uint32 first_byte_or_zero); + int64_t ReadVarint32Fallback(uint32_t first_byte_or_zero); int ReadVarintSizeAsIntFallback(); - std::pair<uint64, bool> ReadVarint64Fallback(); - bool ReadVarint32Slow(uint32* value); - bool ReadVarint64Slow(uint64* value); + std::pair<uint64_t, bool> ReadVarint64Fallback(); + bool ReadVarint32Slow(uint32_t* value); + bool ReadVarint64Slow(uint64_t* value); int ReadVarintSizeAsIntSlow(); - bool ReadLittleEndian32Fallback(uint32* value); + bool ReadLittleEndian32Fallback(uint32_t* value); bool ReadLittleEndian64Fallback(uint64* value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + bool ReadLittleEndian64Fallback(uint64_t* value); +#endif // Fallback/slow methods for reading tags. These do not update last_tag_, // but will set legitimate_message_end_ if we are at the end of the input // stream. - uint32 ReadTagFallback(uint32 first_byte_or_zero); - uint32 ReadTagSlow(); + uint32_t ReadTagFallback(uint32_t first_byte_or_zero); + uint32_t ReadTagSlow(); bool ReadStringFallback(TProtoStringType* buffer, int size); // Return the size of the buffer. @@ -656,7 +670,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { // Initialize from a stream. EpsCopyOutputStream(ZeroCopyOutputStream* stream, bool deterministic, - uint8** pp) + uint8_t** pp) : end_(buffer_), stream_(stream), is_serialization_deterministic_(deterministic) { @@ -667,33 +681,33 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { // pointed to the end of the array. When using this the total size is already // known, so no need to maintain the slop region. EpsCopyOutputStream(void* data, int size, bool deterministic) - : end_(static_cast<uint8*>(data) + size), + : end_(static_cast<uint8_t*>(data) + size), buffer_end_(nullptr), stream_(nullptr), is_serialization_deterministic_(deterministic) {} // Initialize from stream but with the first buffer already given (eager). EpsCopyOutputStream(void* data, int size, ZeroCopyOutputStream* stream, - bool deterministic, uint8** pp) + bool deterministic, uint8_t** pp) : stream_(stream), is_serialization_deterministic_(deterministic) { *pp = SetInitialBuffer(data, size); } // Flush everything that's written into the underlying ZeroCopyOutputStream // and trims the underlying stream to the location of ptr. - uint8* Trim(uint8* ptr); + uint8_t* Trim(uint8_t* ptr); // After this it's guaranteed you can safely write kSlopBytes to ptr. This // will never fail! The underlying stream can produce an error. Use HadError // to check for errors. - PROTOBUF_MUST_USE_RESULT uint8* EnsureSpace(uint8* ptr) { + PROTOBUF_MUST_USE_RESULT uint8_t* EnsureSpace(uint8_t* ptr) { if (PROTOBUF_PREDICT_FALSE(ptr >= end_)) { return EnsureSpaceFallback(ptr); } return ptr; } - uint8* WriteRaw(const void* data, int size, uint8* ptr) { + uint8_t* WriteRaw(const void* data, int size, uint8_t* ptr) { if (PROTOBUF_PREDICT_FALSE(end_ - ptr < size)) { return WriteRawFallback(data, size, ptr); } @@ -704,7 +718,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { // aliasing the buffer (ie. not copying the data). The caller is responsible // to make sure the buffer is alive for the duration of the // ZeroCopyOutputStream. - uint8* WriteRawMaybeAliased(const void* data, int size, uint8* ptr) { + uint8_t* WriteRawMaybeAliased(const void* data, int size, uint8_t* ptr) { if (aliasing_enabled_) { return WriteAliasedRaw(data, size, ptr); } else { @@ -713,78 +727,78 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { } - uint8* WriteStringMaybeAliased(uint32 num, const TProtoStringType& s, uint8* ptr) { + uint8_t* WriteStringMaybeAliased(uint32_t num, const TProtoStringType& s, uint8_t* ptr) { std::ptrdiff_t size = s.size(); if (PROTOBUF_PREDICT_FALSE( size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { return WriteStringMaybeAliasedOutline(num, s, ptr); } ptr = UnsafeVarint((num << 3) | 2, ptr); - *ptr++ = static_cast<uint8>(size); + *ptr++ = static_cast<uint8_t>(size); std::memcpy(ptr, s.data(), size); return ptr + size; } - uint8* WriteBytesMaybeAliased(uint32 num, const TProtoStringType& s, uint8* ptr) { + uint8_t* WriteBytesMaybeAliased(uint32_t num, const TProtoStringType& s, uint8_t* ptr) { return WriteStringMaybeAliased(num, s, ptr); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteString(uint32 num, const T& s, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteString(uint32_t num, const T& s, + uint8_t* ptr) { std::ptrdiff_t size = s.size(); if (PROTOBUF_PREDICT_FALSE( size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { return WriteStringOutline(num, s, ptr); } ptr = UnsafeVarint((num << 3) | 2, ptr); - *ptr++ = static_cast<uint8>(size); + *ptr++ = static_cast<uint8_t>(size); std::memcpy(ptr, s.data(), size); return ptr + size; } template <typename T> - uint8* WriteBytes(uint32 num, const T& s, uint8* ptr) { + uint8_t* WriteBytes(uint32_t num, const T& s, uint8_t* ptr) { return WriteString(num, s, ptr); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteInt32Packed(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt32Packed(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, Encode64); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteUInt32Packed(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteUInt32Packed(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, Encode32); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteSInt32Packed(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteSInt32Packed(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, ZigZagEncode32); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteInt64Packed(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt64Packed(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, Encode64); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteUInt64Packed(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteUInt64Packed(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, Encode64); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteSInt64Packed(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteSInt64Packed(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, ZigZagEncode64); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteEnumPacked(int num, const T& r, int size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteEnumPacked(int num, const T& r, int size, + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, Encode64); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8* WriteFixedPacked(int num, const T& r, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteFixedPacked(int num, const T& r, + uint8_t* ptr) { ptr = EnsureSpace(ptr); constexpr auto element_size = sizeof(typename T::value_type); auto size = r.size() * element_size; @@ -820,34 +834,34 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { // The number of bytes written to the stream at position ptr, relative to the // stream's overall position. - int64 ByteCount(uint8* ptr) const; + int64_t ByteCount(uint8_t* ptr) const; private: - uint8* end_; - uint8* buffer_end_ = buffer_; - uint8 buffer_[2 * kSlopBytes]; + uint8_t* end_; + uint8_t* buffer_end_ = buffer_; + uint8_t buffer_[2 * kSlopBytes]; ZeroCopyOutputStream* stream_; bool had_error_ = false; bool aliasing_enabled_ = false; // See EnableAliasing(). bool is_serialization_deterministic_; - uint8* EnsureSpaceFallback(uint8* ptr); - inline uint8* Next(); - int Flush(uint8* ptr); - std::ptrdiff_t GetSize(uint8* ptr) const { + uint8_t* EnsureSpaceFallback(uint8_t* ptr); + inline uint8_t* Next(); + int Flush(uint8_t* ptr); + std::ptrdiff_t GetSize(uint8_t* ptr) const { GOOGLE_DCHECK(ptr <= end_ + kSlopBytes); // NOLINT return end_ + kSlopBytes - ptr; } - uint8* Error() { + uint8_t* Error() { had_error_ = true; // We use the patch buffer to always guarantee space to write to. end_ = buffer_ + kSlopBytes; return buffer_; } - static constexpr int TagSize(uint32 tag) { + static constexpr int TagSize(uint32_t tag) { return (tag < (1 << 7)) ? 1 : (tag < (1 << 14)) ? 2 : (tag < (1 << 21)) ? 3 @@ -855,28 +869,28 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { : 5; } - PROTOBUF_ALWAYS_INLINE uint8* WriteTag(uint32 num, uint32 wt, uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(uint32_t num, uint32_t wt, uint8_t* ptr) { GOOGLE_DCHECK(ptr < end_); // NOLINT return UnsafeVarint((num << 3) | wt, ptr); } - PROTOBUF_ALWAYS_INLINE uint8* WriteLengthDelim(int num, uint32 size, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteLengthDelim(int num, uint32_t size, + uint8_t* ptr) { ptr = WriteTag(num, 2, ptr); return UnsafeWriteSize(size, ptr); } - uint8* WriteRawFallback(const void* data, int size, uint8* ptr); + uint8_t* WriteRawFallback(const void* data, int size, uint8_t* ptr); - uint8* WriteAliasedRaw(const void* data, int size, uint8* ptr); + uint8_t* WriteAliasedRaw(const void* data, int size, uint8_t* ptr); - uint8* WriteStringMaybeAliasedOutline(uint32 num, const TProtoStringType& s, - uint8* ptr); - uint8* WriteStringOutline(uint32 num, const TProtoStringType& s, uint8* ptr); + uint8_t* WriteStringMaybeAliasedOutline(uint32_t num, const TProtoStringType& s, + uint8_t* ptr); + uint8_t* WriteStringOutline(uint32_t num, const TProtoStringType& s, uint8_t* ptr); template <typename T, typename E> - PROTOBUF_ALWAYS_INLINE uint8* WriteVarintPacked(int num, const T& r, int size, - uint8* ptr, const E& encode) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteVarintPacked(int num, const T& r, int size, + uint8_t* ptr, const E& encode) { ptr = EnsureSpace(ptr); ptr = WriteLengthDelim(num, size, ptr); auto it = r.data(); @@ -888,65 +902,65 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { return ptr; } - static uint32 Encode32(uint32 v) { return v; } - static uint64 Encode64(uint64 v) { return v; } - static uint32 ZigZagEncode32(int32 v) { - return (static_cast<uint32>(v) << 1) ^ static_cast<uint32>(v >> 31); + static uint32_t Encode32(uint32_t v) { return v; } + static uint64_t Encode64(uint64_t v) { return v; } + static uint32_t ZigZagEncode32(int32_t v) { + return (static_cast<uint32_t>(v) << 1) ^ static_cast<uint32_t>(v >> 31); } - static uint64 ZigZagEncode64(int64 v) { - return (static_cast<uint64>(v) << 1) ^ static_cast<uint64>(v >> 63); + static uint64_t ZigZagEncode64(int64_t v) { + return (static_cast<uint64_t>(v) << 1) ^ static_cast<uint64_t>(v >> 63); } template <typename T> - PROTOBUF_ALWAYS_INLINE static uint8* UnsafeVarint(T value, uint8* ptr) { + PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeVarint(T value, uint8_t* ptr) { static_assert(std::is_unsigned<T>::value, "Varint serialization must be unsigned"); - ptr[0] = static_cast<uint8>(value); + ptr[0] = static_cast<uint8_t>(value); if (value < 0x80) { return ptr + 1; } // Turn on continuation bit in the byte we just wrote. - ptr[0] |= static_cast<uint8>(0x80); + ptr[0] |= static_cast<uint8_t>(0x80); value >>= 7; - ptr[1] = static_cast<uint8>(value); + ptr[1] = static_cast<uint8_t>(value); if (value < 0x80) { return ptr + 2; } ptr += 2; do { // Turn on continuation bit in the byte we just wrote. - ptr[-1] |= static_cast<uint8>(0x80); + ptr[-1] |= static_cast<uint8_t>(0x80); value >>= 7; - *ptr = static_cast<uint8>(value); + *ptr = static_cast<uint8_t>(value); ++ptr; } while (value >= 0x80); return ptr; } - PROTOBUF_ALWAYS_INLINE static uint8* UnsafeWriteSize(uint32 value, - uint8* ptr) { + PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeWriteSize(uint32_t value, + uint8_t* ptr) { while (PROTOBUF_PREDICT_FALSE(value >= 0x80)) { - *ptr = static_cast<uint8>(value | 0x80); + *ptr = static_cast<uint8_t>(value | 0x80); value >>= 7; ++ptr; } - *ptr++ = static_cast<uint8>(value); + *ptr++ = static_cast<uint8_t>(value); return ptr; } template <int S> - uint8* WriteRawLittleEndian(const void* data, int size, uint8* ptr); + uint8_t* WriteRawLittleEndian(const void* data, int size, uint8_t* ptr); #ifndef PROTOBUF_LITTLE_ENDIAN - uint8* WriteRawLittleEndian32(const void* data, int size, uint8* ptr); - uint8* WriteRawLittleEndian64(const void* data, int size, uint8* ptr); + uint8_t* WriteRawLittleEndian32(const void* data, int size, uint8_t* ptr); + uint8_t* WriteRawLittleEndian64(const void* data, int size, uint8_t* ptr); #endif // These methods are for CodedOutputStream. Ideally they should be private // but to match current behavior of CodedOutputStream as close as possible // we allow it some functionality. public: - uint8* SetInitialBuffer(void* data, int size) { - auto ptr = static_cast<uint8*>(data); + uint8_t* SetInitialBuffer(void* data, int size) { + auto ptr = static_cast<uint8_t*>(data); if (size > kSlopBytes) { end_ = ptr + size - kSlopBytes; buffer_end_ = nullptr; @@ -961,28 +975,28 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { private: // Needed by CodedOutputStream HadError. HadError needs to flush the patch // buffers to ensure there is no error as of yet. - uint8* FlushAndResetBuffer(uint8*); + uint8_t* FlushAndResetBuffer(uint8_t*); // The following functions mimic the old CodedOutputStream behavior as close // as possible. They flush the current state to the stream, behave as // the old CodedOutputStream and then return to normal operation. - bool Skip(int count, uint8** pp); - bool GetDirectBufferPointer(void** data, int* size, uint8** pp); - uint8* GetDirectBufferForNBytesAndAdvance(int size, uint8** pp); + bool Skip(int count, uint8_t** pp); + bool GetDirectBufferPointer(void** data, int* size, uint8_t** pp); + uint8_t* GetDirectBufferForNBytesAndAdvance(int size, uint8_t** pp); friend class CodedOutputStream; }; template <> -inline uint8* EpsCopyOutputStream::WriteRawLittleEndian<1>(const void* data, +inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<1>(const void* data, int size, - uint8* ptr) { + uint8_t* ptr) { return WriteRaw(data, size, ptr); } template <> -inline uint8* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data, +inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data, int size, - uint8* ptr) { + uint8_t* ptr) { #ifdef PROTOBUF_LITTLE_ENDIAN return WriteRaw(data, size, ptr); #else @@ -990,9 +1004,9 @@ inline uint8* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data, #endif } template <> -inline uint8* EpsCopyOutputStream::WriteRawLittleEndian<8>(const void* data, +inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<8>(const void* data, int size, - uint8* ptr) { + uint8_t* ptr) { #ifdef PROTOBUF_LITTLE_ENDIAN return WriteRaw(data, size, ptr); #else @@ -1028,7 +1042,7 @@ inline uint8* EpsCopyOutputStream::WriteRawLittleEndian<8>(const void* data, // CodedOutputStream::VarintSize32(strlen(text)) + // strlen(text); // -// uint8* buffer = +// uint8_t* buffer = // coded_output->GetDirectBufferForNBytesAndAdvance(coded_size); // if (buffer != nullptr) { // // The output stream has enough space in the buffer: write directly to @@ -1100,7 +1114,7 @@ class PROTOBUF_EXPORT CodedOutputStream { // there are not enough bytes available, returns NULL. The return pointer is // invalidated as soon as any other non-const method of CodedOutputStream // is called. - inline uint8* GetDirectBufferForNBytesAndAdvance(int size) { + inline uint8_t* GetDirectBufferForNBytesAndAdvance(int size) { return impl_.GetDirectBufferForNBytesAndAdvance(size, &cur_); } @@ -1116,72 +1130,77 @@ class PROTOBUF_EXPORT CodedOutputStream { // copy loops. Since this gets called by every field with string or bytes // type, inlining may lead to a significant amount of code bloat, with only a // minor performance gain. - static uint8* WriteRawToArray(const void* buffer, int size, uint8* target); + static uint8_t* WriteRawToArray(const void* buffer, int size, uint8_t* target); // Equivalent to WriteRaw(str.data(), str.size()). void WriteString(const TProtoStringType& str); // Like WriteString() but writing directly to the target array. - static uint8* WriteStringToArray(const TProtoStringType& str, uint8* target); + static uint8_t* WriteStringToArray(const TProtoStringType& str, uint8_t* target); // Write the varint-encoded size of str followed by str. - static uint8* WriteStringWithSizeToArray(const TProtoStringType& str, - uint8* target); + static uint8_t* WriteStringWithSizeToArray(const TProtoStringType& str, + uint8_t* target); // Write a 32-bit little-endian integer. - void WriteLittleEndian32(uint32 value) { + void WriteLittleEndian32(uint32_t value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteLittleEndian32ToArray(value, Cur())); } // Like WriteLittleEndian32() but writing directly to the target array. - static uint8* WriteLittleEndian32ToArray(uint32 value, uint8* target); + static uint8_t* WriteLittleEndian32ToArray(uint32_t value, uint8_t* target); // Write a 64-bit little-endian integer. - void WriteLittleEndian64(uint64 value) { + void WriteLittleEndian64(uint64_t value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteLittleEndian64ToArray(value, Cur())); } // Like WriteLittleEndian64() but writing directly to the target array. - static uint8* WriteLittleEndian64ToArray(uint64 value, uint8* target); + static uint8_t* WriteLittleEndian64ToArray(uint64_t value, uint8_t* target); // Write an unsigned integer with Varint encoding. Writing a 32-bit value - // is equivalent to casting it to uint64 and writing it as a 64-bit value, + // is equivalent to casting it to uint64_t and writing it as a 64-bit value, // but may be more efficient. - void WriteVarint32(uint32 value); + void WriteVarint32(uint32_t value); // Like WriteVarint32() but writing directly to the target array. - static uint8* WriteVarint32ToArray(uint32 value, uint8* target); + static uint8_t* WriteVarint32ToArray(uint32_t value, uint8_t* target); // Like WriteVarint32() but writing directly to the target array, and with the // less common-case paths being out of line rather than inlined. - static uint8* WriteVarint32ToArrayOutOfLine(uint32 value, uint8* target); + static uint8_t* WriteVarint32ToArrayOutOfLine(uint32_t value, uint8_t* target); // Write an unsigned integer with Varint encoding. - void WriteVarint64(uint64 value); + void WriteVarint64(uint64_t value); // Like WriteVarint64() but writing directly to the target array. - static uint8* WriteVarint64ToArray(uint64 value, uint8* target); + static uint8_t* WriteVarint64ToArray(uint64_t value, uint8_t* target); // Equivalent to WriteVarint32() except when the value is negative, // in which case it must be sign-extended to a full 10 bytes. - void WriteVarint32SignExtended(int32 value); + void WriteVarint32SignExtended(int32_t value); // Like WriteVarint32SignExtended() but writing directly to the target array. - static uint8* WriteVarint32SignExtendedToArray(int32 value, uint8* target); + static uint8_t* WriteVarint32SignExtendedToArray(int32_t value, uint8_t* target); // This is identical to WriteVarint32(), but optimized for writing tags. // In particular, if the input is a compile-time constant, this method // compiles down to a couple instructions. // Always inline because otherwise the aforementioned optimization can't work, // but GCC by default doesn't want to inline this. - void WriteTag(uint32 value); + void WriteTag(uint32_t value); // Like WriteTag() but writing directly to the target array. PROTOBUF_ALWAYS_INLINE - static uint8* WriteTagToArray(uint32 value, uint8* target); + static uint8_t* WriteTagToArray(uint32_t value, uint8_t* target); // Returns the number of bytes needed to encode the given value as a varint. - static size_t VarintSize32(uint32 value); + static size_t VarintSize32(uint32_t value); // Returns the number of bytes needed to encode the given value as a varint. - static size_t VarintSize64(uint64 value); + static size_t VarintSize64(uint64_t value); // If negative, 10 bytes. Otherwise, same as VarintSize32(). - static size_t VarintSize32SignExtended(int32 value); + static size_t VarintSize32SignExtended(int32_t value); + + // Same as above, plus one. The additional one comes at no compute cost. + static size_t VarintSize32PlusOne(uint32_t value); + static size_t VarintSize64PlusOne(uint64_t value); + static size_t VarintSize32SignExtendedPlusOne(int32_t value); // Compile-time equivalent of VarintSize32(). - template <uint32 Value> + template <uint32_t Value> struct StaticVarintSize32 { static const size_t value = (Value < (1 << 7)) ? 1 : (Value < (1 << 14)) ? 2 @@ -1244,14 +1263,14 @@ class PROTOBUF_EXPORT CodedOutputStream { template <typename Func> void Serialize(const Func& func); - uint8* Cur() const { return cur_; } - void SetCur(uint8* ptr) { cur_ = ptr; } + uint8_t* Cur() const { return cur_; } + void SetCur(uint8_t* ptr) { cur_ = ptr; } EpsCopyOutputStream* EpsCopy() { return &impl_; } private: EpsCopyOutputStream impl_; - uint8* cur_; - int64 start_count_; + uint8_t* cur_; + int64_t start_count_; static std::atomic<bool> default_serialization_deterministic_; // See above. Other projects may use "friend" to allow them to call this. @@ -1266,7 +1285,7 @@ class PROTOBUF_EXPORT CodedOutputStream { default_serialization_deterministic_.store(true, std::memory_order_relaxed); } // REQUIRES: value >= 0x80, and that (value & 7f) has been written to *target. - static uint8* WriteVarint32ToArrayOutOfLineHelper(uint32 value, uint8* target); + static uint8_t* WriteVarint32ToArrayOutOfLineHelper(uint32_t value, uint8_t* target); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedOutputStream); }; @@ -1274,8 +1293,8 @@ class PROTOBUF_EXPORT CodedOutputStream { // The vast majority of varints are only one byte. These inline // methods optimize for that case. -inline bool CodedInputStream::ReadVarint32(uint32* value) { - uint32 v = 0; +inline bool CodedInputStream::ReadVarint32(uint32_t* value) { + uint32_t v = 0; if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { v = *buffer_; if (v < 0x80) { @@ -1284,8 +1303,8 @@ inline bool CodedInputStream::ReadVarint32(uint32* value) { return true; } } - int64 result = ReadVarint32Fallback(v); - *value = static_cast<uint32>(result); + int64_t result = ReadVarint32Fallback(v); + *value = static_cast<uint32_t>(result); return result >= 0; } @@ -1299,6 +1318,18 @@ inline bool CodedInputStream::ReadVarint64(uint64* value) { *value = p.first; return p.second; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline bool CodedInputStream::ReadVarint64(uint64_t* value) { + if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && *buffer_ < 0x80) { + *value = *buffer_; + Advance(1); + return true; + } + std::pair<uint64_t, bool> p = ReadVarint64Fallback(); + *value = p.first; + return p.second; +} +#endif inline bool CodedInputStream::ReadVarintSizeAsInt(int* value) { if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { @@ -1314,40 +1345,61 @@ inline bool CodedInputStream::ReadVarintSizeAsInt(int* value) { } // static -inline const uint8* CodedInputStream::ReadLittleEndian32FromArray( - const uint8* buffer, uint32* value) { +inline const uint8_t* CodedInputStream::ReadLittleEndian32FromArray( + const uint8_t* buffer, uint32_t* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(value, buffer, sizeof(*value)); return buffer + sizeof(*value); #else - *value = (static_cast<uint32>(buffer[0])) | - (static_cast<uint32>(buffer[1]) << 8) | - (static_cast<uint32>(buffer[2]) << 16) | - (static_cast<uint32>(buffer[3]) << 24); + *value = (static_cast<uint32_t>(buffer[0])) | + (static_cast<uint32_t>(buffer[1]) << 8) | + (static_cast<uint32_t>(buffer[2]) << 16) | + (static_cast<uint32_t>(buffer[3]) << 24); return buffer + sizeof(*value); #endif } // static -inline const uint8* CodedInputStream::ReadLittleEndian64FromArray( - const uint8* buffer, uint64* value) { +inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray( + const uint8_t* buffer, uint64* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(value, buffer, sizeof(*value)); return buffer + sizeof(*value); #else - uint32 part0 = (static_cast<uint32>(buffer[0])) | - (static_cast<uint32>(buffer[1]) << 8) | - (static_cast<uint32>(buffer[2]) << 16) | - (static_cast<uint32>(buffer[3]) << 24); - uint32 part1 = (static_cast<uint32>(buffer[4])) | - (static_cast<uint32>(buffer[5]) << 8) | - (static_cast<uint32>(buffer[6]) << 16) | - (static_cast<uint32>(buffer[7]) << 24); + uint32_t part0 = (static_cast<uint32_t>(buffer[0])) | + (static_cast<uint32_t>(buffer[1]) << 8) | + (static_cast<uint32_t>(buffer[2]) << 16) | + (static_cast<uint32_t>(buffer[3]) << 24); + uint32_t part1 = (static_cast<uint32_t>(buffer[4])) | + (static_cast<uint32_t>(buffer[5]) << 8) | + (static_cast<uint32_t>(buffer[6]) << 16) | + (static_cast<uint32_t>(buffer[7]) << 24); *value = static_cast<uint64>(part0) | (static_cast<uint64>(part1) << 32); return buffer + sizeof(*value); #endif } -inline bool CodedInputStream::ReadLittleEndian32(uint32* value) { +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray( + const uint8_t* buffer, uint64_t* value) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + memcpy(value, buffer, sizeof(*value)); + return buffer + sizeof(*value); +#else + uint32_t part0 = (static_cast<uint32_t>(buffer[0])) | + (static_cast<uint32_t>(buffer[1]) << 8) | + (static_cast<uint32_t>(buffer[2]) << 16) | + (static_cast<uint32_t>(buffer[3]) << 24); + uint32_t part1 = (static_cast<uint32_t>(buffer[4])) | + (static_cast<uint32_t>(buffer[5]) << 8) | + (static_cast<uint32_t>(buffer[6]) << 16) | + (static_cast<uint32_t>(buffer[7]) << 24); + *value = static_cast<uint64_t>(part0) | (static_cast<uint64_t>(part1) << 32); + return buffer + sizeof(*value); +#endif +} +#endif + +inline bool CodedInputStream::ReadLittleEndian32(uint32_t* value) { #if defined(PROTOBUF_LITTLE_ENDIAN) if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { buffer_ = ReadLittleEndian32FromArray(buffer_, value); @@ -1372,9 +1424,23 @@ inline bool CodedInputStream::ReadLittleEndian64(uint64* value) { return ReadLittleEndian64Fallback(value); #endif } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline bool CodedInputStream::ReadLittleEndian64(uint64_t* value) { +#if defined(PROTOBUF_LITTLE_ENDIAN) + if (PROTOBUF_PREDICT_TRUE(BufferSize() >= static_cast<int>(sizeof(*value)))) { + buffer_ = ReadLittleEndian64FromArray(buffer_, value); + return true; + } else { + return ReadLittleEndian64Fallback(value); + } +#else + return ReadLittleEndian64Fallback(value); +#endif +} +#endif -inline uint32 CodedInputStream::ReadTagNoLastTag() { - uint32 v = 0; +inline uint32_t CodedInputStream::ReadTagNoLastTag() { + uint32_t v = 0; if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { v = *buffer_; if (v < 0x80) { @@ -1386,20 +1452,20 @@ inline uint32 CodedInputStream::ReadTagNoLastTag() { return v; } -inline std::pair<uint32, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( - uint32 cutoff) { +inline std::pair<uint32_t, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( + uint32_t cutoff) { // In performance-sensitive code we can expect cutoff to be a compile-time // constant, and things like "cutoff >= kMax1ByteVarint" to be evaluated at // compile time. - uint32 first_byte_or_zero = 0; + uint32_t first_byte_or_zero = 0; if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_)) { // Hot case: buffer_ non_empty, buffer_[0] in [1, 128). // TODO(gpike): Is it worth rearranging this? E.g., if the number of fields // is large enough then is it better to check for the two-byte case first? first_byte_or_zero = buffer_[0]; - if (static_cast<int8>(buffer_[0]) > 0) { - const uint32 kMax1ByteVarint = 0x7f; - uint32 tag = buffer_[0]; + if (static_cast<int8_t>(buffer_[0]) > 0) { + const uint32_t kMax1ByteVarint = 0x7f; + uint32_t tag = buffer_[0]; Advance(1); return std::make_pair(tag, cutoff >= kMax1ByteVarint || tag <= cutoff); } @@ -1408,8 +1474,8 @@ inline std::pair<uint32, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( // first byte and the second byte. if (cutoff >= 0x80 && PROTOBUF_PREDICT_TRUE(buffer_ + 1 < buffer_end_) && PROTOBUF_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) { - const uint32 kMax2ByteVarint = (0x7f << 7) + 0x7f; - uint32 tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80); + const uint32_t kMax2ByteVarint = (0x7f << 7) + 0x7f; + uint32_t tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80); Advance(2); // It might make sense to test for tag == 0 now, but it is so rare that // that we don't bother. A varint-encoded 0 should be one byte unless @@ -1422,11 +1488,11 @@ inline std::pair<uint32, bool> CodedInputStream::ReadTagWithCutoffNoLastTag( } } // Slow path - const uint32 tag = ReadTagFallback(first_byte_or_zero); - return std::make_pair(tag, static_cast<uint32>(tag - 1) < cutoff); + const uint32_t tag = ReadTagFallback(first_byte_or_zero); + return std::make_pair(tag, static_cast<uint32_t>(tag - 1) < cutoff); } -inline bool CodedInputStream::LastTagWas(uint32 expected) { +inline bool CodedInputStream::LastTagWas(uint32_t expected) { return last_tag_ == expected; } @@ -1434,7 +1500,7 @@ inline bool CodedInputStream::ConsumedEntireMessage() { return legitimate_message_end_; } -inline bool CodedInputStream::ExpectTag(uint32 expected) { +inline bool CodedInputStream::ExpectTag(uint32_t expected) { if (expected < (1 << 7)) { if (PROTOBUF_PREDICT_TRUE(buffer_ < buffer_end_) && buffer_[0] == expected) { @@ -1445,8 +1511,8 @@ inline bool CodedInputStream::ExpectTag(uint32 expected) { } } else if (expected < (1 << 14)) { if (PROTOBUF_PREDICT_TRUE(BufferSize() >= 2) && - buffer_[0] == static_cast<uint8>(expected | 0x80) && - buffer_[1] == static_cast<uint8>(expected >> 7)) { + buffer_[0] == static_cast<uint8_t>(expected | 0x80) && + buffer_[1] == static_cast<uint8_t>(expected >> 7)) { Advance(2); return true; } else { @@ -1458,15 +1524,15 @@ inline bool CodedInputStream::ExpectTag(uint32 expected) { } } -inline const uint8* CodedInputStream::ExpectTagFromArray(const uint8* buffer, - uint32 expected) { +inline const uint8_t* CodedInputStream::ExpectTagFromArray(const uint8_t* buffer, + uint32_t expected) { if (expected < (1 << 7)) { if (buffer[0] == expected) { return buffer + 1; } } else if (expected < (1 << 14)) { - if (buffer[0] == static_cast<uint8>(expected | 0x80) && - buffer[1] == static_cast<uint8>(expected >> 7)) { + if (buffer[0] == static_cast<uint8_t>(expected | 0x80) && + buffer[1] == static_cast<uint8_t>(expected >> 7)) { return buffer + 2; } } @@ -1556,7 +1622,7 @@ inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input) Refresh(); } -inline CodedInputStream::CodedInputStream(const uint8* buffer, int size) +inline CodedInputStream::CodedInputStream(const uint8_t* buffer, int size) : buffer_(buffer), buffer_end_(buffer + size), input_(nullptr), @@ -1592,14 +1658,14 @@ inline bool CodedInputStream::Skip(int count) { return SkipFallback(count, original_buffer_size); } -inline uint8* CodedOutputStream::WriteVarint32ToArray(uint32 value, - uint8* target) { +inline uint8_t* CodedOutputStream::WriteVarint32ToArray(uint32_t value, + uint8_t* target) { return EpsCopyOutputStream::UnsafeVarint(value, target); } -inline uint8* CodedOutputStream::WriteVarint32ToArrayOutOfLine(uint32 value, - uint8* target) { - target[0] = static_cast<uint8>(value); +inline uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLine( + uint32_t value, uint8_t* target) { + target[0] = static_cast<uint8_t>(value); if (value < 0x80) { return target + 1; } else { @@ -1607,95 +1673,110 @@ inline uint8* CodedOutputStream::WriteVarint32ToArrayOutOfLine(uint32 value, } } -inline uint8* CodedOutputStream::WriteVarint64ToArray(uint64 value, - uint8* target) { +inline uint8_t* CodedOutputStream::WriteVarint64ToArray(uint64_t value, + uint8_t* target) { return EpsCopyOutputStream::UnsafeVarint(value, target); } -inline void CodedOutputStream::WriteVarint32SignExtended(int32 value) { - WriteVarint64(static_cast<uint64>(value)); +inline void CodedOutputStream::WriteVarint32SignExtended(int32_t value) { + WriteVarint64(static_cast<uint64_t>(value)); } -inline uint8* CodedOutputStream::WriteVarint32SignExtendedToArray( - int32 value, uint8* target) { - return WriteVarint64ToArray(static_cast<uint64>(value), target); +inline uint8_t* CodedOutputStream::WriteVarint32SignExtendedToArray( + int32_t value, uint8_t* target) { + return WriteVarint64ToArray(static_cast<uint64_t>(value), target); } -inline uint8* CodedOutputStream::WriteLittleEndian32ToArray(uint32 value, - uint8* target) { +inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(uint32_t value, + uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(target, &value, sizeof(value)); #else - target[0] = static_cast<uint8>(value); - target[1] = static_cast<uint8>(value >> 8); - target[2] = static_cast<uint8>(value >> 16); - target[3] = static_cast<uint8>(value >> 24); + target[0] = static_cast<uint8_t>(value); + target[1] = static_cast<uint8_t>(value >> 8); + target[2] = static_cast<uint8_t>(value >> 16); + target[3] = static_cast<uint8_t>(value >> 24); #endif return target + sizeof(value); } -inline uint8* CodedOutputStream::WriteLittleEndian64ToArray(uint64 value, - uint8* target) { +inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(uint64_t value, + uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(target, &value, sizeof(value)); #else - uint32 part0 = static_cast<uint32>(value); - uint32 part1 = static_cast<uint32>(value >> 32); - - target[0] = static_cast<uint8>(part0); - target[1] = static_cast<uint8>(part0 >> 8); - target[2] = static_cast<uint8>(part0 >> 16); - target[3] = static_cast<uint8>(part0 >> 24); - target[4] = static_cast<uint8>(part1); - target[5] = static_cast<uint8>(part1 >> 8); - target[6] = static_cast<uint8>(part1 >> 16); - target[7] = static_cast<uint8>(part1 >> 24); + uint32_t part0 = static_cast<uint32_t>(value); + uint32_t part1 = static_cast<uint32_t>(value >> 32); + + target[0] = static_cast<uint8_t>(part0); + target[1] = static_cast<uint8_t>(part0 >> 8); + target[2] = static_cast<uint8_t>(part0 >> 16); + target[3] = static_cast<uint8_t>(part0 >> 24); + target[4] = static_cast<uint8_t>(part1); + target[5] = static_cast<uint8_t>(part1 >> 8); + target[6] = static_cast<uint8_t>(part1 >> 16); + target[7] = static_cast<uint8_t>(part1 >> 24); #endif return target + sizeof(value); } -inline void CodedOutputStream::WriteVarint32(uint32 value) { +inline void CodedOutputStream::WriteVarint32(uint32_t value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteVarint32ToArray(value, Cur())); } -inline void CodedOutputStream::WriteVarint64(uint64 value) { +inline void CodedOutputStream::WriteVarint64(uint64_t value) { cur_ = impl_.EnsureSpace(cur_); SetCur(WriteVarint64ToArray(value, Cur())); } -inline void CodedOutputStream::WriteTag(uint32 value) { WriteVarint32(value); } +inline void CodedOutputStream::WriteTag(uint32_t value) { + WriteVarint32(value); +} -inline uint8* CodedOutputStream::WriteTagToArray(uint32 value, uint8* target) { +inline uint8_t* CodedOutputStream::WriteTagToArray(uint32_t value, + uint8_t* target) { return WriteVarint32ToArray(value, target); } -inline size_t CodedOutputStream::VarintSize32(uint32 value) { +inline size_t CodedOutputStream::VarintSize32(uint32_t value) { // This computes value == 0 ? 1 : floor(log2(value)) / 7 + 1 // Use an explicit multiplication to implement the divide of // a number in the 1..31 range. // Explicit OR 0x1 to avoid calling Bits::Log2FloorNonZero(0), which is // undefined. - uint32 log2value = Bits::Log2FloorNonZero(value | 0x1); + uint32_t log2value = Bits::Log2FloorNonZero(value | 0x1); return static_cast<size_t>((log2value * 9 + 73) / 64); } -inline size_t CodedOutputStream::VarintSize64(uint64 value) { +inline size_t CodedOutputStream::VarintSize32PlusOne(uint32_t value) { + // Same as above, but one more. + uint32_t log2value = Bits::Log2FloorNonZero(value | 0x1); + return static_cast<size_t>((log2value * 9 + 73 + 64) / 64); +} + +inline size_t CodedOutputStream::VarintSize64(uint64_t value) { // This computes value == 0 ? 1 : floor(log2(value)) / 7 + 1 // Use an explicit multiplication to implement the divide of // a number in the 1..63 range. // Explicit OR 0x1 to avoid calling Bits::Log2FloorNonZero(0), which is // undefined. - uint32 log2value = Bits::Log2FloorNonZero64(value | 0x1); + uint32_t log2value = Bits::Log2FloorNonZero64(value | 0x1); return static_cast<size_t>((log2value * 9 + 73) / 64); } -inline size_t CodedOutputStream::VarintSize32SignExtended(int32 value) { - if (value < 0) { - return 10; // TODO(kenton): Make this a symbolic constant. - } else { - return VarintSize32(static_cast<uint32>(value)); - } +inline size_t CodedOutputStream::VarintSize64PlusOne(uint64_t value) { + // Same as above, but one more. + uint32_t log2value = Bits::Log2FloorNonZero64(value | 0x1); + return static_cast<size_t>((log2value * 9 + 73 + 64) / 64); +} + +inline size_t CodedOutputStream::VarintSize32SignExtended(int32_t value) { + return VarintSize64(static_cast<uint64_t>(int64_t{value})); +} + +inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne(int32_t value) { + return VarintSize64PlusOne(static_cast<uint64_t>(int64_t{value})); } inline void CodedOutputStream::WriteString(const TProtoStringType& str) { @@ -1707,14 +1788,14 @@ inline void CodedOutputStream::WriteRawMaybeAliased(const void* data, cur_ = impl_.WriteRawMaybeAliased(data, size, cur_); } -inline uint8* CodedOutputStream::WriteRawToArray(const void* data, int size, - uint8* target) { +inline uint8_t* CodedOutputStream::WriteRawToArray(const void* data, int size, + uint8_t* target) { memcpy(target, data, size); return target + size; } -inline uint8* CodedOutputStream::WriteStringToArray(const TProtoStringType& str, - uint8* target) { +inline uint8_t* CodedOutputStream::WriteStringToArray(const TProtoStringType& str, + uint8_t* target) { return WriteRawToArray(str.data(), static_cast<int>(str.size()), target); } diff --git a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc index ad6bb5f1c4..2f1d26f410 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.cc @@ -186,7 +186,7 @@ bool GzipInputStream::Skip(int count) { return ok; } int64_t GzipInputStream::ByteCount() const { - int64 ret = byte_count_ + zcontext_.total_out; + int64_t ret = byte_count_ + zcontext_.total_out; if (zcontext_.next_out != NULL && output_position_ != NULL) { ret += reinterpret_cast<uintptr_t>(zcontext_.next_out) - reinterpret_cast<uintptr_t>(output_position_); diff --git a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h index b1ce1d36c6..f0283e86f4 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/gzip_stream.h @@ -80,10 +80,10 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream { inline int ZlibErrorCode() const { return zerror_; } // implements ZeroCopyInputStream ---------------------------------- - bool Next(const void** data, int* size); - void BackUp(int count); - bool Skip(int count); - int64_t ByteCount() const; + bool Next(const void** data, int* size) override; + void BackUp(int count) override; + bool Skip(int count) override; + int64_t ByteCount() const override; private: Format format_; @@ -96,7 +96,7 @@ class PROTOBUF_EXPORT GzipInputStream : public ZeroCopyInputStream { void* output_buffer_; void* output_position_; size_t output_buffer_length_; - int64 byte_count_; + int64_t byte_count_; int Inflate(int flush); void DoNextOutput(const void** data, int* size); @@ -167,9 +167,9 @@ class PROTOBUF_EXPORT GzipOutputStream : public ZeroCopyOutputStream { bool Close(); // implements ZeroCopyOutputStream --------------------------------- - bool Next(void** data, int* size); - void BackUp(int count); - int64_t ByteCount() const; + bool Next(void** data, int* size) override; + void BackUp(int count) override; + int64_t ByteCount() const override; private: ZeroCopyOutputStream* sub_stream_; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/printer.h b/contrib/libs/protobuf/src/google/protobuf/io/printer.h index 0f8c3b130c..720f732cfc 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/printer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/printer.h @@ -84,7 +84,7 @@ class AnnotationProtoCollector : public AnnotationCollector { // Override for AnnotationCollector::AddAnnotation. virtual void AddAnnotation(size_t begin_offset, size_t end_offset, const TProtoStringType& file_path, - const std::vector<int>& path) { + const std::vector<int>& path) override { typename AnnotationProto::Annotation* annotation = annotation_proto_->add_annotation(); for (int i = 0; i < path.size(); ++i) { @@ -95,7 +95,7 @@ class AnnotationProtoCollector : public AnnotationCollector { annotation->set_end(end_offset); } // Override for AnnotationCollector::AddAnnotation. - virtual void AddAnnotationNew(Annotation& a) { + virtual void AddAnnotationNew(Annotation& a) override { auto* annotation = annotation_proto_->add_annotation(); annotation->ParseFromString(a.second); annotation->set_begin(a.first.first); diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc index c973b6357a..ed5e012210 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc @@ -860,8 +860,7 @@ bool Tokenizer::NextWithComments(TProtoStringType* prev_trailing_comments, // tokenizing. Also, these can assume that whatever text they // are given is text that the tokenizer actually parsed as a token // of the given type. - -bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64 max_value, +bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, uint64* output) { // Sadly, we can't just use strtoul() since it is only 32-bit and strtoull() // is non-standard. I hate the C standard library. :( @@ -881,7 +880,7 @@ bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64 max_value, } } - uint64 result = 0; + uint64_t result = 0; for (; *ptr != '\0'; ptr++) { int digit = DigitValue(*ptr); if (digit < 0 || digit >= base) { @@ -900,6 +899,47 @@ bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64 max_value, *output = result; return true; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +bool Tokenizer::ParseInteger(const TProtoStringType& text, uint64_t max_value, + uint64_t* output) { + // Sadly, we can't just use strtoul() since it is only 32-bit and strtoull() + // is non-standard. I hate the C standard library. :( + + // return strtoull(text.c_str(), NULL, 0); + + const char* ptr = text.c_str(); + int base = 10; + if (ptr[0] == '0') { + if (ptr[1] == 'x' || ptr[1] == 'X') { + // This is hex. + base = 16; + ptr += 2; + } else { + // This is octal. + base = 8; + } + } + + uint64_t result = 0; + for (; *ptr != '\0'; ptr++) { + int digit = DigitValue(*ptr); + if (digit < 0 || digit >= base) { + // The token provided by Tokenizer is invalid. i.e., 099 is an invalid + // token, but Tokenizer still think it's integer. + return false; + } + if (static_cast<uint64_t>(digit) > max_value || + result > (max_value - digit) / base) { + // Overflow. + return false; + } + result = result * base + digit; + } + + *output = result; + return true; +} +#endif double Tokenizer::ParseFloat(const TProtoStringType& text) { const char* start = text.c_str(); @@ -930,8 +970,8 @@ double Tokenizer::ParseFloat(const TProtoStringType& text) { // Helper to append a Unicode code point to a string as UTF8, without bringing // in any external dependencies. -static void AppendUTF8(uint32 code_point, TProtoStringType* output) { - uint32 tmp = 0; +static void AppendUTF8(uint32_t code_point, TProtoStringType* output) { + uint32_t tmp = 0; int len = 0; if (code_point <= 0x7f) { tmp = code_point; @@ -961,7 +1001,7 @@ static void AppendUTF8(uint32 code_point, TProtoStringType* output) { // Try to read <len> hex digits from ptr, and stuff the numeric result into // *result. Returns true if that many digits were successfully consumed. -static bool ReadHexDigits(const char* ptr, int len, uint32* result) { +static bool ReadHexDigits(const char* ptr, int len, uint32_t* result) { *result = 0; if (len == 0) return false; for (const char* end = ptr + len; ptr < end; ++ptr) { @@ -976,22 +1016,22 @@ static bool ReadHexDigits(const char* ptr, int len, uint32* result) { // surrogate. These numbers are in a reserved range of Unicode code points, so // if we encounter such a pair we know how to parse it and convert it into a // single code point. -static const uint32 kMinHeadSurrogate = 0xd800; -static const uint32 kMaxHeadSurrogate = 0xdc00; -static const uint32 kMinTrailSurrogate = 0xdc00; -static const uint32 kMaxTrailSurrogate = 0xe000; +static const uint32_t kMinHeadSurrogate = 0xd800; +static const uint32_t kMaxHeadSurrogate = 0xdc00; +static const uint32_t kMinTrailSurrogate = 0xdc00; +static const uint32_t kMaxTrailSurrogate = 0xe000; -static inline bool IsHeadSurrogate(uint32 code_point) { +static inline bool IsHeadSurrogate(uint32_t code_point) { return (code_point >= kMinHeadSurrogate) && (code_point < kMaxHeadSurrogate); } -static inline bool IsTrailSurrogate(uint32 code_point) { +static inline bool IsTrailSurrogate(uint32_t code_point) { return (code_point >= kMinTrailSurrogate) && (code_point < kMaxTrailSurrogate); } // Combine a head and trail surrogate into a single Unicode code point. -static uint32 AssembleUTF16(uint32 head_surrogate, uint32 trail_surrogate) { +static uint32_t AssembleUTF16(uint32_t head_surrogate, uint32_t trail_surrogate) { GOOGLE_DCHECK(IsHeadSurrogate(head_surrogate)); GOOGLE_DCHECK(IsTrailSurrogate(trail_surrogate)); return 0x10000 + (((head_surrogate - kMinHeadSurrogate) << 10) | @@ -1009,7 +1049,7 @@ static inline int UnicodeLength(char key) { // to parse that sequence. On success, returns a pointer to the first char // beyond that sequence, and fills in *code_point. On failure, returns ptr // itself. -static const char* FetchUnicodePoint(const char* ptr, uint32* code_point) { +static const char* FetchUnicodePoint(const char* ptr, uint32_t* code_point) { const char* p = ptr; // Fetch the code point. const int len = UnicodeLength(*p++); @@ -1021,7 +1061,7 @@ static const char* FetchUnicodePoint(const char* ptr, uint32* code_point) { // "trail surrogate," and together they form a UTF-16 pair which decodes into // a single Unicode point. Trail surrogates may only use \u, not \U. if (IsHeadSurrogate(*code_point) && *p == '\\' && *(p + 1) == 'u') { - uint32 trail_surrogate; + uint32_t trail_surrogate; if (ReadHexDigits(p + 2, 4, &trail_surrogate) && IsTrailSurrogate(trail_surrogate)) { *code_point = AssembleUTF16(*code_point, trail_surrogate); @@ -1093,7 +1133,7 @@ void Tokenizer::ParseStringAppend(const TProtoStringType& text, output->push_back(static_cast<char>(code)); } else if (*ptr == 'u' || *ptr == 'U') { - uint32 unicode; + uint32_t unicode; const char* end = FetchUnicodePoint(ptr, &unicode); if (end == ptr) { // Failure: Just dump out what we saw, don't try to parse it. diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h index c24b7690af..5021df4fc1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h @@ -217,8 +217,12 @@ class PROTOBUF_EXPORT Tokenizer { // result. If the text is not from a Token of type TYPE_INTEGER originally // parsed by a Tokenizer, the result is undefined (possibly an assert // failure). - static bool ParseInteger(const TProtoStringType& text, uint64 max_value, + static bool ParseInteger(const TProtoStringType& text, uint64_t max_value, uint64* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static bool ParseInteger(const TProtoStringType& text, uint64_t max_value, + uint64_t* output); +#endif // Options --------------------------------------------------------- diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc index 52617e9efe..0986ea271f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc @@ -103,7 +103,13 @@ FileInputStream::CopyingFileInputStream::CopyingFileInputStream( close_on_delete_(false), is_closed_(false), errno_(0), - previous_seek_failed_(false) {} + previous_seek_failed_(false) { +#ifndef _MSC_VER + int flags = fcntl(file_, F_GETFL); + flags &= ~O_NONBLOCK; + fcntl(file_, F_SETFL, flags); +#endif +} FileInputStream::CopyingFileInputStream::~CopyingFileInputStream() { if (close_on_delete_) { @@ -210,7 +216,7 @@ bool FileOutputStream::CopyingFileOutputStream::Write(const void* buffer, GOOGLE_CHECK(!is_closed_); int total_written = 0; - const uint8* buffer_base = reinterpret_cast<const uint8*>(buffer); + const uint8_t* buffer_base = reinterpret_cast<const uint8_t*>(buffer); while (total_written < size) { int bytes; @@ -332,12 +338,12 @@ bool ConcatenatingInputStream::Skip(int count) { while (stream_count_ > 0) { // Assume that ByteCount() can be used to find out how much we actually // skipped when Skip() fails. - int64 target_byte_count = streams_[0]->ByteCount() + count; + int64_t target_byte_count = streams_[0]->ByteCount() + count; if (streams_[0]->Skip(count)) return true; // Hit the end of the stream. Figure out how many more bytes we still have // to skip. - int64 final_byte_count = streams_[0]->ByteCount(); + int64_t final_byte_count = streams_[0]->ByteCount(); GOOGLE_DCHECK_LT(final_byte_count, target_byte_count); count = target_byte_count - final_byte_count; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h index 0206e3887e..e6ba902e8d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h @@ -311,7 +311,7 @@ class PROTOBUF_EXPORT ConcatenatingInputStream : public ZeroCopyInputStream { // decremented. ZeroCopyInputStream* const* streams_; int stream_count_; - int64 bytes_retired_; // Bytes read from previous streams. + int64_t bytes_retired_; // Bytes read from previous streams. GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ConcatenatingInputStream); }; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc index e933dedcb6..8be9ab9c13 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -56,7 +56,7 @@ static const int kDefaultBlockSize = 8192; // =================================================================== ArrayInputStream::ArrayInputStream(const void* data, int size, int block_size) - : data_(reinterpret_cast<const uint8*>(data)), + : data_(reinterpret_cast<const uint8_t*>(data)), size_(size), block_size_(block_size > 0 ? block_size : size), position_(0), @@ -103,7 +103,7 @@ int64_t ArrayInputStream::ByteCount() const { return position_; } // =================================================================== ArrayOutputStream::ArrayOutputStream(void* data, int size, int block_size) - : data_(reinterpret_cast<uint8*>(data)), + : data_(reinterpret_cast<uint8_t*>(data)), size_(size), block_size_(block_size > 0 ? block_size : size), position_(0), @@ -284,7 +284,7 @@ int64_t CopyingInputStreamAdaptor::ByteCount() const { void CopyingInputStreamAdaptor::AllocateBufferIfNeeded() { if (buffer_.get() == NULL) { - buffer_.reset(new uint8[buffer_size_]); + buffer_.reset(new uint8_t[buffer_size_]); } } @@ -394,7 +394,7 @@ bool CopyingOutputStreamAdaptor::WriteBuffer() { void CopyingOutputStreamAdaptor::AllocateBufferIfNeeded() { if (buffer_ == NULL) { - buffer_.reset(new uint8[buffer_size_]); + buffer_.reset(new uint8_t[buffer_size_]); } } @@ -406,7 +406,7 @@ void CopyingOutputStreamAdaptor::FreeBuffer() { // =================================================================== LimitingInputStream::LimitingInputStream(ZeroCopyInputStream* input, - int64 limit) + int64_t limit) : input_(input), limit_(limit) { prior_bytes_read_ = input_->ByteCount(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h index f20630d8f5..200af105b8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h @@ -84,7 +84,7 @@ class PROTOBUF_EXPORT ArrayInputStream : public ZeroCopyInputStream { private: - const uint8* const data_; // The byte array. + const uint8_t* const data_; // The byte array. const int size_; // Total size of the array. const int block_size_; // How many bytes to return at a time. @@ -116,7 +116,7 @@ class PROTOBUF_EXPORT ArrayOutputStream : public ZeroCopyOutputStream { int64_t ByteCount() const override; private: - uint8* const data_; // The byte array. + uint8_t* const data_; // The byte array. const int size_; // Total size of the array. const int block_size_; // How many bytes to return at a time. @@ -236,11 +236,11 @@ class PROTOBUF_EXPORT CopyingInputStreamAdaptor : public ZeroCopyInputStream { // The current position of copying_stream_, relative to the point where // we started reading. - int64 position_; + int64_t position_; // Data is read into this buffer. It may be NULL if no buffer is currently // in use. Otherwise, it points to an array of size buffer_size_. - std::unique_ptr<uint8[]> buffer_; + std::unique_ptr<uint8_t[]> buffer_; const int buffer_size_; // Number of valid bytes currently in the buffer (i.e. the size last @@ -327,11 +327,11 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { // The current position of copying_stream_, relative to the point where // we started writing. - int64 position_; + int64_t position_; // Data is written from this buffer. It may be NULL if no buffer is // currently in use. Otherwise, it points to an array of size buffer_size_. - std::unique_ptr<uint8[]> buffer_; + std::unique_ptr<uint8_t[]> buffer_; const int buffer_size_; // Number of valid bytes currently in the buffer (i.e. the size last @@ -348,7 +348,7 @@ class PROTOBUF_EXPORT CopyingOutputStreamAdaptor : public ZeroCopyOutputStream { // a particular byte count. class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { public: - LimitingInputStream(ZeroCopyInputStream* input, int64 limit); + LimitingInputStream(ZeroCopyInputStream* input, int64_t limit); ~LimitingInputStream() override; // implements ZeroCopyInputStream ---------------------------------- @@ -360,8 +360,8 @@ class PROTOBUF_EXPORT LimitingInputStream : public ZeroCopyInputStream { private: ZeroCopyInputStream* input_; - int64 limit_; // Decreases as we go, becomes negative if we overshoot. - int64 prior_bytes_read_; // Bytes read on underlying stream at construction + int64_t limit_; // Decreases as we go, becomes negative if we overshoot. + int64_t prior_bytes_read_; // Bytes read on underlying stream at construction GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LimitingInputStream); }; diff --git a/contrib/libs/protobuf/src/google/protobuf/map.h b/contrib/libs/protobuf/src/google/protobuf/map.h index 6f317af017..a3f1b42fc9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map.h +++ b/contrib/libs/protobuf/src/google/protobuf/map.h @@ -118,7 +118,7 @@ class MapAllocator { return static_cast<pointer>(::operator new(n * sizeof(value_type))); } else { return reinterpret_cast<pointer>( - Arena::CreateArray<uint8>(arena_, n * sizeof(value_type))); + Arena::CreateArray<uint8_t>(arena_, n * sizeof(value_type))); } } @@ -698,21 +698,18 @@ class Map { p = FindHelper(k); } const size_type b = p.second; // bucket number - Node* node; // If K is not key_type, make the conversion to key_type explicit. using TypeToInit = typename std::conditional< std::is_same<typename std::decay<K>::type, key_type>::value, K&&, key_type>::type; - if (alloc_.arena() == nullptr) { - node = new Node{value_type(static_cast<TypeToInit>(std::forward<K>(k))), - nullptr}; - } else { - node = Alloc<Node>(1); - Arena::CreateInArenaStorage( - const_cast<Key*>(&node->kv.first), alloc_.arena(), - static_cast<TypeToInit>(std::forward<K>(k))); - Arena::CreateInArenaStorage(&node->kv.second, alloc_.arena()); - } + Node* node = Alloc<Node>(1); + // Even when arena is nullptr, CreateInArenaStorage is still used to + // ensure the arena of submessage will be consistent. Otherwise, + // submessage may have its own arena when message-owned arena is enabled. + Arena::CreateInArenaStorage(const_cast<Key*>(&node->kv.first), + alloc_.arena(), + static_cast<TypeToInit>(std::forward<K>(k))); + Arena::CreateInArenaStorage(&node->kv.second, alloc_.arena()); iterator result = InsertUnique(b, node); ++num_elements_; @@ -1026,12 +1023,12 @@ class Map { size_type BucketNumber(const K& k) const { // We xor the hash value against the random seed so that we effectively // have a random hash function. - uint64 h = hash_function()(k) ^ seed_; + uint64_t h = hash_function()(k) ^ seed_; // We use the multiplication method to determine the bucket number from // the hash value. The constant kPhi (suggested by Knuth) is roughly // (sqrt(5) - 1) / 2 * 2^64. - constexpr uint64 kPhi = uint64{0x9e3779b97f4a7c15}; + constexpr uint64_t kPhi = uint64_t{0x9e3779b97f4a7c15}; return ((kPhi * h) >> 32) & (num_buckets_ - 1); } @@ -1071,7 +1068,7 @@ class Map { void** CreateEmptyTable(size_type n) { GOOGLE_DCHECK(n >= kMinTableSize); - GOOGLE_DCHECK_EQ(n & (n - 1), 0); + GOOGLE_DCHECK_EQ(n & (n - 1), 0u); void** result = Alloc<void*>(n); memset(result, 0, n * sizeof(result[0])); return result; @@ -1082,12 +1079,12 @@ class Map { // We get a little bit of randomness from the address of the map. The // lower bits are not very random, due to alignment, so we discard them // and shift the higher bits into their place. - size_type s = reinterpret_cast<uintptr_t>(this) >> 12; + size_type s = reinterpret_cast<uintptr_t>(this) >> 4; #if defined(__x86_64__) && defined(__GNUC__) && \ !defined(GOOGLE_PROTOBUF_NO_RDTSC) - uint32 hi, lo; + uint32_t hi, lo; asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); - s += ((static_cast<uint64>(hi) << 32) | lo); + s += ((static_cast<uint64_t>(hi) << 32) | lo); #endif return s; } diff --git a/contrib/libs/protobuf/src/google/protobuf/map_entry.h b/contrib/libs/protobuf/src/google/protobuf/map_entry.h index 87bc000374..2aec2d4b08 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_entry.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_entry.h @@ -78,8 +78,8 @@ namespace internal { // field. // // cpp type | proto type | in-memory type | MapEntry accessor type -// int32 TYPE_INT32 int32 int32 -// int32 TYPE_FIXED32 int32 int32 +// int32_t TYPE_INT32 int32_t int32_t +// int32_t TYPE_FIXED32 int32_t int32_t // string TYPE_STRING ArenaStringPtr string // FooEnum TYPE_ENUM int int // FooMessage TYPE_MESSAGE FooMessage* FooMessage diff --git a/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h b/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h index a068e414d8..442dc9f623 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h @@ -107,9 +107,9 @@ struct MapEntryFuncs { static const int kKeyFieldNumber = 1; static const int kValueFieldNumber = 2; - static uint8* InternalSerialize(int field_number, const Key& key, - const Value& value, uint8* ptr, - io::EpsCopyOutputStream* stream) { + static uint8_t* InternalSerialize(int field_number, const Key& key, + const Value& value, uint8_t* ptr, + io::EpsCopyOutputStream* stream) { ptr = stream->EnsureSpace(ptr); ptr = WireFormatLite::WriteTagToArray( field_number, WireFormatLite::WIRETYPE_LENGTH_DELIMITED, ptr); @@ -125,7 +125,7 @@ struct MapEntryFuncs { size_t inner_length = 2 + KeyTypeHandler::ByteSize(key) + ValueTypeHandler::ByteSize(value); return inner_length + io::CodedOutputStream::VarintSize32( - static_cast<uint32>(inner_length)); + static_cast<uint32_t>(inner_length)); } static int GetCachedSize(const Key& key, const Value& value) { @@ -167,9 +167,9 @@ class MapEntryImpl : public Base { static const int kValueFieldNumber = 2; // Constants for field tag. - static const uint8 kKeyTag = + static const uint8_t kKeyTag = GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(kKeyFieldNumber, KeyTypeHandler::kWireType); - static const uint8 kValueTag = GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG( + static const uint8_t kValueTag = GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG( kValueFieldNumber, ValueTypeHandler::kWireType); static const size_t kTagSize = 1; @@ -229,7 +229,7 @@ class MapEntryImpl : public Base { const char* _InternalParse(const char* ptr, ParseContext* ctx) final { while (!ctx->Done(&ptr)) { - uint32 tag; + uint32_t tag; ptr = ReadTag(ptr, &tag); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (tag == kKeyTag) { @@ -263,8 +263,8 @@ class MapEntryImpl : public Base { return size; } - ::google::protobuf::uint8* _InternalSerialize(::google::protobuf::uint8* ptr, - io::EpsCopyOutputStream* stream) const override { + ::uint8_t* _InternalSerialize( + ::uint8_t* ptr, io::EpsCopyOutputStream* stream) const override { ptr = KeyTypeHandler::Write(kKeyFieldNumber, key(), ptr, stream); return ValueTypeHandler::Write(kValueFieldNumber, value(), ptr, stream); } @@ -422,7 +422,8 @@ class MapEntryImpl : public Base { template <typename UnknownType> const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, - bool (*is_valid)(int), uint32 field_num, + bool (*is_valid)(int), + uint32_t field_num, InternalMetadata* metadata) { auto entry = NewEntry(); ptr = entry->_InternalParse(ptr, ctx); @@ -500,7 +501,7 @@ class MapEntryImpl : public Base { public: // Needed for constructing tables KeyOnMemory key_; ValueOnMemory value_; - uint32 _has_bits_[1]; + uint32_t _has_bits_[1]; private: friend class ::PROTOBUF_NAMESPACE_ID::Arena; @@ -641,8 +642,8 @@ struct MapEntryHelper< // The proto compiler generates the offsets in this struct as if this was // a regular message. This way the table driven code barely notices it's // dealing with a map field. - uint32 _has_bits_; // NOLINT - uint32 _cached_size_; // NOLINT + uint32_t _has_bits_; // NOLINT + uint32_t _cached_size_; // NOLINT KeyOnMemory key_; // NOLINT ValueOnMemory value_; // NOLINT }; diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field.cc b/contrib/libs/protobuf/src/google/protobuf/map_field.cc index 4687361adc..8fc49b20f3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/map_field.cc @@ -236,15 +236,15 @@ void DynamicMapField::AllocateMapValue(MapValueRef* map_val) { map_val->SetValue(value); \ break; \ } - HANDLE_TYPE(INT32, int32); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(STRING, TProtoStringType); - HANDLE_TYPE(ENUM, int32); + HANDLE_TYPE(ENUM, int32_t); #undef HANDLE_TYPE case FieldDescriptor::CPPTYPE_MESSAGE: { const Message& message = @@ -543,15 +543,15 @@ void DynamicMapField::SyncMapWithRepeatedFieldNoLock() const { map_val.SetValue(value); \ break; \ } - HANDLE_TYPE(INT32, int32, Int32); - HANDLE_TYPE(INT64, int64, Int64); - HANDLE_TYPE(UINT32, uint32, UInt32); - HANDLE_TYPE(UINT64, uint64, UInt64); + HANDLE_TYPE(INT32, int32_t, Int32); + HANDLE_TYPE(INT64, int64_t, Int64); + HANDLE_TYPE(UINT32, uint32_t, UInt32); + HANDLE_TYPE(UINT64, uint64_t, UInt64); HANDLE_TYPE(DOUBLE, double, Double); HANDLE_TYPE(FLOAT, float, Float); HANDLE_TYPE(BOOL, bool, Bool); HANDLE_TYPE(STRING, TProtoStringType, String); - HANDLE_TYPE(ENUM, int32, EnumValue); + HANDLE_TYPE(ENUM, int32_t, EnumValue); #undef HANDLE_TYPE case FieldDescriptor::CPPTYPE_MESSAGE: { const Message& message = reflection->GetMessage(*it, val_des); @@ -586,15 +586,15 @@ size_t DynamicMapField::SpaceUsedExcludingSelfNoLock() const { size += sizeof(TYPE) * map_size; \ break; \ } - HANDLE_TYPE(INT32, int32); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(STRING, TProtoStringType); - HANDLE_TYPE(ENUM, int32); + HANDLE_TYPE(ENUM, int32_t); #undef HANDLE_TYPE case FieldDescriptor::CPPTYPE_MESSAGE: { while (it != map_.end()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field.h b/contrib/libs/protobuf/src/google/protobuf/map_field.h index 4180e28a82..57d691267d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field.h @@ -96,19 +96,19 @@ class PROTOBUF_EXPORT MapKey { return type_; } - void SetInt64Value(int64 value) { + void SetInt64Value(int64_t value) { SetType(FieldDescriptor::CPPTYPE_INT64); val_.int64_value_ = value; } - void SetUInt64Value(uint64 value) { + void SetUInt64Value(uint64_t value) { SetType(FieldDescriptor::CPPTYPE_UINT64); val_.uint64_value_ = value; } - void SetInt32Value(int32 value) { + void SetInt32Value(int32_t value) { SetType(FieldDescriptor::CPPTYPE_INT32); val_.int32_value_ = value; } - void SetUInt32Value(uint32 value) { + void SetUInt32Value(uint32_t value) { SetType(FieldDescriptor::CPPTYPE_UINT32); val_.uint32_value_ = value; } @@ -121,19 +121,19 @@ class PROTOBUF_EXPORT MapKey { *val_.string_value_.get_mutable() = std::move(val); } - int64 GetInt64Value() const { + int64_t GetInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapKey::GetInt64Value"); return val_.int64_value_; } - uint64 GetUInt64Value() const { + uint64_t GetUInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapKey::GetUInt64Value"); return val_.uint64_value_; } - int32 GetInt32Value() const { + int32_t GetInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapKey::GetInt32Value"); return val_.int32_value_; } - uint32 GetUInt32Value() const { + uint32_t GetUInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapKey::GetUInt32Value"); return val_.uint32_value_; } @@ -243,10 +243,10 @@ class PROTOBUF_EXPORT MapKey { union KeyValue { KeyValue() {} internal::ExplicitlyConstructed<TProtoStringType> string_value_; - int64 int64_value_; - int32 int32_value_; - uint64 uint64_value_; - uint32 uint32_value_; + int64_t int64_value_; + int32_t int32_value_; + uint64_t uint64_value_; + uint32_t uint32_value_; bool bool_value_; } val_; @@ -592,7 +592,7 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> { } template <typename UnknownType> const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, - bool (*is_valid)(int), uint32 field_num, + bool (*is_valid)(int), uint32_t field_num, InternalMetadata* metadata) { return impl_.template ParseWithEnumValidation<UnknownType>( ptr, ctx, is_valid, field_num, metadata); @@ -683,25 +683,25 @@ class PROTOBUF_EXPORT MapValueConstRef { public: MapValueConstRef() : data_(nullptr), type_() {} - int64 GetInt64Value() const { + int64_t GetInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueConstRef::GetInt64Value"); - return *reinterpret_cast<int64*>(data_); + return *reinterpret_cast<int64_t*>(data_); } - uint64 GetUInt64Value() const { + uint64_t GetUInt64Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueConstRef::GetUInt64Value"); - return *reinterpret_cast<uint64*>(data_); + return *reinterpret_cast<uint64_t*>(data_); } - int32 GetInt32Value() const { + int32_t GetInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueConstRef::GetInt32Value"); - return *reinterpret_cast<int32*>(data_); + return *reinterpret_cast<int32_t*>(data_); } - uint32 GetUInt32Value() const { + uint32_t GetUInt32Value() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueConstRef::GetUInt32Value"); - return *reinterpret_cast<uint32*>(data_); + return *reinterpret_cast<uint32_t*>(data_); } bool GetBoolValue() const { TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueConstRef::GetBoolValue"); @@ -775,21 +775,21 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { public: MapValueRef() {} - void SetInt64Value(int64 value) { + void SetInt64Value(int64_t value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT64, "MapValueRef::SetInt64Value"); - *reinterpret_cast<int64*>(data_) = value; + *reinterpret_cast<int64_t*>(data_) = value; } - void SetUInt64Value(uint64 value) { + void SetUInt64Value(uint64_t value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT64, "MapValueRef::SetUInt64Value"); - *reinterpret_cast<uint64*>(data_) = value; + *reinterpret_cast<uint64_t*>(data_) = value; } - void SetInt32Value(int32 value) { + void SetInt32Value(int32_t value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_INT32, "MapValueRef::SetInt32Value"); - *reinterpret_cast<int32*>(data_) = value; + *reinterpret_cast<int32_t*>(data_) = value; } - void SetUInt32Value(uint32 value) { + void SetUInt32Value(uint32_t value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_UINT32, "MapValueRef::SetUInt32Value"); - *reinterpret_cast<uint32*>(data_) = value; + *reinterpret_cast<uint32_t*>(data_) = value; } void SetBoolValue(bool value) { TYPE_CHECK(FieldDescriptor::CPPTYPE_BOOL, "MapValueRef::SetBoolValue"); @@ -830,15 +830,15 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { delete reinterpret_cast<TYPE*>(data_); \ break; \ } - HANDLE_TYPE(INT32, int32); - HANDLE_TYPE(INT64, int64); - HANDLE_TYPE(UINT32, uint32); - HANDLE_TYPE(UINT64, uint64); + HANDLE_TYPE(INT32, int32_t); + HANDLE_TYPE(INT64, int64_t); + HANDLE_TYPE(UINT32, uint32_t); + HANDLE_TYPE(UINT64, uint64_t); HANDLE_TYPE(DOUBLE, double); HANDLE_TYPE(FLOAT, float); HANDLE_TYPE(BOOL, bool); HANDLE_TYPE(STRING, TProtoStringType); - HANDLE_TYPE(ENUM, int32); + HANDLE_TYPE(ENUM, int32_t); HANDLE_TYPE(MESSAGE, Message); #undef HANDLE_TYPE } diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h b/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h index 32e4a9158b..0ff81e3dcb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h @@ -49,11 +49,11 @@ namespace internal { template <typename T> T UnwrapMapKey(const MapKey& map_key); template <> -inline int32 UnwrapMapKey<int32>(const MapKey& map_key) { +inline int32_t UnwrapMapKey<int32_t>(const MapKey& map_key) { return map_key.GetInt32Value(); } template <> -inline uint32 UnwrapMapKey<uint32>(const MapKey& map_key) { +inline uint32_t UnwrapMapKey<uint32_t>(const MapKey& map_key) { return map_key.GetUInt32Value(); } template <> @@ -64,6 +64,16 @@ template <> inline uint64 UnwrapMapKey<uint64>(const MapKey& map_key) { return map_key.GetUInt64Value(); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline int64_t UnwrapMapKey<int64_t>(const MapKey& map_key) { + return map_key.GetInt64Value(); +} +template <> +inline uint64_t UnwrapMapKey<uint64_t>(const MapKey& map_key) { + return map_key.GetUInt64Value(); +} +#endif template <> inline bool UnwrapMapKey<bool>(const MapKey& map_key) { return map_key.GetBoolValue(); @@ -77,21 +87,33 @@ inline TProtoStringType UnwrapMapKey<TProtoStringType>(const MapKey& map_key) { template <typename T> inline void SetMapKey(MapKey* map_key, const T& value); template <> -inline void SetMapKey<int32>(MapKey* map_key, const int32& value) { +inline void SetMapKey<int32_t>(MapKey* map_key, const int32_t& value) { map_key->SetInt32Value(value); } template <> -inline void SetMapKey<uint32>(MapKey* map_key, const uint32& value) { +inline void SetMapKey<uint32_t>(MapKey* map_key, const uint32_t& value) { map_key->SetUInt32Value(value); } template <> inline void SetMapKey<int64>(MapKey* map_key, const int64& value) { map_key->SetInt64Value(value); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline void SetMapKey<int64_t>(MapKey* map_key, const int64_t& value) { + map_key->SetInt64Value(value); +} +#endif template <> inline void SetMapKey<uint64>(MapKey* map_key, const uint64& value) { map_key->SetUInt64Value(value); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline void SetMapKey<uint64_t>(MapKey* map_key, const uint64_t& value) { + map_key->SetUInt64Value(value); +} +#endif template <> inline void SetMapKey<bool>(MapKey* map_key, const bool& value) { map_key->SetBoolValue(value); diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h b/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h index 46658d4dae..2a321063e1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h @@ -106,7 +106,7 @@ class MapFieldLite { template <typename UnknownType> const char* ParseWithEnumValidation(const char* ptr, ParseContext* ctx, - bool (*is_valid)(int), uint32 field_num, + bool (*is_valid)(int), uint32_t field_num, InternalMetadata* metadata) { typename Derived::template Parser<MapFieldLite, Map<Key, T>> parser(this); return parser.template ParseWithEnumValidation<UnknownType>( @@ -129,7 +129,7 @@ struct EnumParseWrapper { } T* map_field; bool (*is_valid)(int); - uint32 field_num; + uint32_t field_num; InternalMetadata* metadata; }; @@ -138,7 +138,7 @@ struct EnumParseWrapper { // generated code template <typename UnknownType, typename T> EnumParseWrapper<UnknownType, T> InitEnumParseWrapper( - T* map_field, bool (*is_valid)(int), uint32 field_num, + T* map_field, bool (*is_valid)(int), uint32_t field_num, InternalMetadata* metadata) { return EnumParseWrapper<UnknownType, T>{map_field, is_valid, field_num, metadata}; diff --git a/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h b/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h index e718790ef4..22a0f9325f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h @@ -28,8 +28,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLE_PROTOBUF_TYPE_HANDLER_H__ -#define GOOGLE_PROTOBUF_TYPE_HANDLER_H__ +#ifndef GOOGLE_PROTOBUF_MAP_TYPE_HANDLER_H__ +#define GOOGLE_PROTOBUF_MAP_TYPE_HANDLER_H__ #include <google/protobuf/parse_context.h> #include <google/protobuf/io/coded_stream.h> @@ -102,17 +102,17 @@ TYPE_TRAITS(STRING, ArenaStringPtr, LENGTH_DELIMITED, false, false) TYPE_TRAITS(BYTES, ArenaStringPtr, LENGTH_DELIMITED, false, false) TYPE_TRAITS(INT64, int64, VARINT, false, false) TYPE_TRAITS(UINT64, uint64, VARINT, false, false) -TYPE_TRAITS(INT32, int32, VARINT, false, false) -TYPE_TRAITS(UINT32, uint32, VARINT, false, false) +TYPE_TRAITS(INT32, int32_t, VARINT, false, false) +TYPE_TRAITS(UINT32, uint32_t, VARINT, false, false) TYPE_TRAITS(SINT64, int64, VARINT, false, false) -TYPE_TRAITS(SINT32, int32, VARINT, false, false) +TYPE_TRAITS(SINT32, int32_t, VARINT, false, false) TYPE_TRAITS(ENUM, int, VARINT, false, true) TYPE_TRAITS(DOUBLE, double, FIXED64, false, false) TYPE_TRAITS(FLOAT, float, FIXED32, false, false) TYPE_TRAITS(FIXED64, uint64, FIXED64, false, false) -TYPE_TRAITS(FIXED32, uint32, FIXED32, false, false) +TYPE_TRAITS(FIXED32, uint32_t, FIXED32, false, false) TYPE_TRAITS(SFIXED64, int64, FIXED64, false, false) -TYPE_TRAITS(SFIXED32, int32, FIXED32, false, false) +TYPE_TRAITS(SFIXED32, int32_t, FIXED32, false, false) TYPE_TRAITS(BOOL, bool, VARINT, false, false) #undef TYPE_TRAITS @@ -149,8 +149,8 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> { static inline const char* Read(const char* ptr, ParseContext* ctx, MapEntryAccessorType* value); - static inline uint8* Write(int field, const MapEntryAccessorType& value, - uint8* ptr, io::EpsCopyOutputStream* stream); + static inline uint8_t* Write(int field, const MapEntryAccessorType& value, + uint8_t* ptr, io::EpsCopyOutputStream* stream); // Functions to manipulate data on memory. ======================== static inline const Type& GetExternalReference(const Type* value); @@ -170,46 +170,47 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> { static inline bool IsInitialized(Type* value); }; -#define MAP_HANDLER(FieldType) \ - template <typename Type> \ - class MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type> { \ - public: \ - typedef typename MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ - Type>::MapEntryAccessorType \ - MapEntryAccessorType; \ - typedef typename MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ - Type>::TypeOnMemory TypeOnMemory; \ - static const WireFormatLite::WireType kWireType = \ - MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ - Type>::kWireType; \ - static const bool kIsMessage = \ - MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ - Type>::kIsMessage; \ - static const bool kIsEnum = \ - MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ - Type>::kIsEnum; \ - static inline int ByteSize(const MapEntryAccessorType& value); \ - static inline int GetCachedSize(const MapEntryAccessorType& value); \ - static inline bool Read(io::CodedInputStream* input, \ - MapEntryAccessorType* value); \ - static inline const char* Read(const char* begin, ParseContext* ctx, \ - MapEntryAccessorType* value); \ - static inline uint8* Write(int field, const MapEntryAccessorType& value, \ - uint8* ptr, io::EpsCopyOutputStream* stream); \ - static inline const MapEntryAccessorType& GetExternalReference( \ - const TypeOnMemory& value); \ - static inline void DeleteNoArena(const TypeOnMemory& x); \ - static inline void Merge(const MapEntryAccessorType& from, \ - TypeOnMemory* to, Arena* arena); \ - static inline void Clear(TypeOnMemory* value, Arena* arena); \ - static inline size_t SpaceUsedInMapEntryLong(const TypeOnMemory& value); \ - static inline const MapEntryAccessorType& DefaultIfNotInitialized( \ - const TypeOnMemory& value); \ - static inline bool IsInitialized(const TypeOnMemory& value); \ - static void DeleteNoArena(TypeOnMemory& value); \ - static constexpr TypeOnMemory Constinit(); \ - static inline MapEntryAccessorType* EnsureMutable(TypeOnMemory* value, \ - Arena* arena); \ +#define MAP_HANDLER(FieldType) \ + template <typename Type> \ + class MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type> { \ + public: \ + typedef typename MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ + Type>::MapEntryAccessorType \ + MapEntryAccessorType; \ + typedef typename MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ + Type>::TypeOnMemory TypeOnMemory; \ + static const WireFormatLite::WireType kWireType = \ + MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ + Type>::kWireType; \ + static const bool kIsMessage = \ + MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ + Type>::kIsMessage; \ + static const bool kIsEnum = \ + MapWireFieldTypeTraits<WireFormatLite::TYPE_##FieldType, \ + Type>::kIsEnum; \ + static inline int ByteSize(const MapEntryAccessorType& value); \ + static inline int GetCachedSize(const MapEntryAccessorType& value); \ + static inline bool Read(io::CodedInputStream* input, \ + MapEntryAccessorType* value); \ + static inline const char* Read(const char* begin, ParseContext* ctx, \ + MapEntryAccessorType* value); \ + static inline uint8_t* Write(int field, const MapEntryAccessorType& value, \ + uint8_t* ptr, \ + io::EpsCopyOutputStream* stream); \ + static inline const MapEntryAccessorType& GetExternalReference( \ + const TypeOnMemory& value); \ + static inline void DeleteNoArena(const TypeOnMemory& x); \ + static inline void Merge(const MapEntryAccessorType& from, \ + TypeOnMemory* to, Arena* arena); \ + static inline void Clear(TypeOnMemory* value, Arena* arena); \ + static inline size_t SpaceUsedInMapEntryLong(const TypeOnMemory& value); \ + static inline const MapEntryAccessorType& DefaultIfNotInitialized( \ + const TypeOnMemory& value); \ + static inline bool IsInitialized(const TypeOnMemory& value); \ + static void DeleteNoArena(TypeOnMemory& value); \ + static constexpr TypeOnMemory Constinit(); \ + static inline MapEntryAccessorType* EnsureMutable(TypeOnMemory* value, \ + Arena* arena); \ }; MAP_HANDLER(STRING) MAP_HANDLER(BYTES) @@ -317,33 +318,35 @@ GET_FIXED_CACHED_SIZE(BOOL, Bool) #undef GET_FIXED_CACHED_SIZE template <typename Type> -inline uint8* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Write( - int field, const MapEntryAccessorType& value, uint8* ptr, +inline uint8_t* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Write( + int field, const MapEntryAccessorType& value, uint8_t* ptr, io::EpsCopyOutputStream* stream) { ptr = stream->EnsureSpace(ptr); return WireFormatLite::InternalWriteMessage(field, value, ptr, stream); } -#define WRITE_METHOD(FieldType, DeclaredType) \ - template <typename Type> \ - inline uint8* MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \ - int field, const MapEntryAccessorType& value, uint8* ptr, \ - io::EpsCopyOutputStream* stream) { \ - ptr = stream->EnsureSpace(ptr); \ - return stream->Write##DeclaredType(field, value, ptr); \ +#define WRITE_METHOD(FieldType, DeclaredType) \ + template <typename Type> \ + inline uint8_t* \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \ + int field, const MapEntryAccessorType& value, uint8_t* ptr, \ + io::EpsCopyOutputStream* stream) { \ + ptr = stream->EnsureSpace(ptr); \ + return stream->Write##DeclaredType(field, value, ptr); \ } WRITE_METHOD(STRING, String) WRITE_METHOD(BYTES, Bytes) #undef WRITE_METHOD -#define WRITE_METHOD(FieldType, DeclaredType) \ - template <typename Type> \ - inline uint8* MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \ - int field, const MapEntryAccessorType& value, uint8* ptr, \ - io::EpsCopyOutputStream* stream) { \ - ptr = stream->EnsureSpace(ptr); \ - return WireFormatLite::Write##DeclaredType##ToArray(field, value, ptr); \ +#define WRITE_METHOD(FieldType, DeclaredType) \ + template <typename Type> \ + inline uint8_t* \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Write( \ + int field, const MapEntryAccessorType& value, uint8_t* ptr, \ + io::EpsCopyOutputStream* stream) { \ + ptr = stream->EnsureSpace(ptr); \ + return WireFormatLite::Write##DeclaredType##ToArray(field, value, ptr); \ } WRITE_METHOD(INT64, Int64) @@ -409,17 +412,17 @@ inline const char* ReadINT64(const char* ptr, int64* value) { inline const char* ReadUINT64(const char* ptr, uint64* value) { return VarintParse(ptr, value); } -inline const char* ReadINT32(const char* ptr, int32* value) { - return VarintParse(ptr, reinterpret_cast<uint32*>(value)); +inline const char* ReadINT32(const char* ptr, int32_t* value) { + return VarintParse(ptr, reinterpret_cast<uint32_t*>(value)); } -inline const char* ReadUINT32(const char* ptr, uint32* value) { +inline const char* ReadUINT32(const char* ptr, uint32_t* value) { return VarintParse(ptr, value); } inline const char* ReadSINT64(const char* ptr, int64* value) { *value = ReadVarintZigZag64(&ptr); return ptr; } -inline const char* ReadSINT32(const char* ptr, int32* value) { +inline const char* ReadSINT32(const char* ptr, int32_t* value) { *value = ReadVarintZigZag32(&ptr); return ptr; } @@ -447,13 +450,13 @@ inline const char* ReadDOUBLE(const char* ptr, double* value) { inline const char* ReadFIXED64(const char* ptr, uint64* value) { return ReadUnaligned(ptr, value); } -inline const char* ReadFIXED32(const char* ptr, uint32* value) { +inline const char* ReadFIXED32(const char* ptr, uint32_t* value) { return ReadUnaligned(ptr, value); } inline const char* ReadSFIXED64(const char* ptr, int64* value) { return ReadUnaligned(ptr, value); } -inline const char* ReadSFIXED32(const char* ptr, int32* value) { +inline const char* ReadSFIXED32(const char* ptr, int32_t* value) { return ReadUnaligned(ptr, value); } @@ -685,4 +688,4 @@ PRIMITIVE_HANDLER_FUNCTIONS(BOOL) } // namespace protobuf } // namespace google -#endif // GOOGLE_PROTOBUF_TYPE_HANDLER_H__ +#endif // GOOGLE_PROTOBUF_MAP_TYPE_HANDLER_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/message.cc b/contrib/libs/protobuf/src/google/protobuf/message.cc index c90ff50e72..aa0e24bb0c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message.cc @@ -166,8 +166,8 @@ const char* Message::_InternalParse(const char* ptr, return WireFormat::_InternalParse(this, ptr, ctx); } -uint8* Message::_InternalSerialize(uint8* target, - io::EpsCopyOutputStream* stream) const { +uint8_t* Message::_InternalSerialize(uint8_t* target, + io::EpsCopyOutputStream* stream) const { return WireFormat::_InternalSerialize(*this, target, stream); } @@ -229,11 +229,29 @@ void Message::SetCachedSize(int /* size */) const { "Must implement one or the other."; } +size_t Message::ComputeUnknownFieldsSize( + size_t total_size, internal::CachedSize* cached_size) const { + total_size += WireFormat::ComputeUnknownFieldsSize( + _internal_metadata_.unknown_fields<UnknownFieldSet>( + UnknownFieldSet::default_instance)); + cached_size->Set(internal::ToCachedSize(total_size)); + return total_size; +} + +size_t Message::MaybeComputeUnknownFieldsSize( + size_t total_size, internal::CachedSize* cached_size) const { + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ComputeUnknownFieldsSize(total_size, cached_size); + } + cached_size->Set(internal::ToCachedSize(total_size)); + return total_size; +} + size_t Message::SpaceUsedLong() const { return GetReflection()->SpaceUsedLong(*this); } -uint64 Message::GetInvariantPerBuild(uint64 salt) { +uint64_t Message::GetInvariantPerBuild(uint64_t salt) { return salt; } @@ -371,14 +389,14 @@ const internal::RepeatedFieldAccessor* Reflection::RepeatedFieldAccessor( #define HANDLE_PRIMITIVE_TYPE(TYPE, type) \ case FieldDescriptor::CPPTYPE_##TYPE: \ return GetSingleton<internal::RepeatedFieldPrimitiveAccessor<type> >(); - HANDLE_PRIMITIVE_TYPE(INT32, int32) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32) - HANDLE_PRIMITIVE_TYPE(INT64, int64) - HANDLE_PRIMITIVE_TYPE(UINT64, uint64) + HANDLE_PRIMITIVE_TYPE(INT32, int32_t) + HANDLE_PRIMITIVE_TYPE(UINT32, uint32_t) + HANDLE_PRIMITIVE_TYPE(INT64, int64_t) + HANDLE_PRIMITIVE_TYPE(UINT64, uint64_t) HANDLE_PRIMITIVE_TYPE(FLOAT, float) HANDLE_PRIMITIVE_TYPE(DOUBLE, double) HANDLE_PRIMITIVE_TYPE(BOOL, bool) - HANDLE_PRIMITIVE_TYPE(ENUM, int32) + HANDLE_PRIMITIVE_TYPE(ENUM, int32_t) #undef HANDLE_PRIMITIVE_TYPE case FieldDescriptor::CPPTYPE_STRING: switch (field->options().ctype()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/message.h b/contrib/libs/protobuf/src/google/protobuf/message.h index 37d92ea393..d25d9f414b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.h +++ b/contrib/libs/protobuf/src/google/protobuf/message.h @@ -120,6 +120,7 @@ #include <google/protobuf/arena.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/generated_message_util.h> #include <google/protobuf/message_lite.h> #include <google/protobuf/port.h> @@ -146,6 +147,7 @@ class MessageFactory; // Defined in other files. class AssignDescriptorsHelper; class DynamicMessageFactory; +class DynamicMessageReflectionHelper; class GeneratedMessageReflectionTestHelper; class MapKey; class MapValueConstRef; @@ -157,6 +159,7 @@ namespace internal { struct DescriptorTable; class MapFieldBase; class SwapFieldHelper; +class CachedSize; } class UnknownFieldSet; // unknown_field_set.h namespace io { @@ -203,18 +206,18 @@ struct Metadata { namespace internal { template <class To> -inline To* GetPointerAtOffset(Message* message, uint32 offset) { +inline To* GetPointerAtOffset(Message* message, uint32_t offset) { return reinterpret_cast<To*>(reinterpret_cast<char*>(message) + offset); } template <class To> -const To* GetConstPointerAtOffset(const Message* message, uint32 offset) { +const To* GetConstPointerAtOffset(const Message* message, uint32_t offset) { return reinterpret_cast<const To*>(reinterpret_cast<const char*>(message) + offset); } template <class To> -const To& GetConstRefAtOffset(const Message& message, uint32 offset) { +const To& GetConstRefAtOffset(const Message& message, uint32_t offset) { return *GetConstPointerAtOffset<To>(&message, offset); } @@ -335,8 +338,8 @@ class PROTOBUF_EXPORT Message : public MessageLite { const char* _InternalParse(const char* ptr, internal::ParseContext* ctx) override; size_t ByteSizeLong() const override; - uint8* _InternalSerialize(uint8* target, - io::EpsCopyOutputStream* stream) const override; + uint8_t* _InternalSerialize(uint8_t* target, + io::EpsCopyOutputStream* stream) const override; // Yandex-specific bool ParseFromArcadiaStream(IInputStream* input); @@ -411,10 +414,14 @@ class PROTOBUF_EXPORT Message : public MessageLite { inline explicit Message(Arena* arena, bool is_message_owned = false) : MessageLite(arena, is_message_owned) {} + size_t ComputeUnknownFieldsSize(size_t total_size, + internal::CachedSize* cached_size) const; + size_t MaybeComputeUnknownFieldsSize(size_t total_size, + internal::CachedSize* cached_size) const; protected: - static uint64 GetInvariantPerBuild(uint64 salt); + static uint64_t GetInvariantPerBuild(uint64_t salt); private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Message); @@ -526,6 +533,12 @@ class PROTOBUF_EXPORT Reflection final { PROTOBUF_MUST_USE_RESULT Message* ReleaseLast( Message* message, const FieldDescriptor* field) const; + // Similar to ReleaseLast() without internal safety and ownershp checks. This + // method should only be used when the objects are on the same arena or paired + // with a call to `UnsafeArenaAddAllocatedMessage`. + Message* UnsafeArenaReleaseLast(Message* message, + const FieldDescriptor* field) const; + // Swap the complete contents of two messages. void Swap(Message* message1, Message* message2) const; @@ -537,6 +550,16 @@ class PROTOBUF_EXPORT Reflection final { void SwapElements(Message* message, const FieldDescriptor* field, int index1, int index2) const; + // Swap without internal safety and ownership checks. This method should only + // be used when the objects are on the same arena. + void UnsafeArenaSwap(Message* lhs, Message* rhs) const; + + // SwapFields without internal safety and ownership checks. This method should + // only be used when the objects are on the same arena. + void UnsafeArenaSwapFields( + Message* lhs, Message* rhs, + const std::vector<const FieldDescriptor*>& fields) const; + // List all fields of the message which are currently set, except for unknown // fields, but including extension known to the parser (i.e. compiled in). // Singular fields will only be listed if HasField(field) would return true @@ -552,10 +575,12 @@ class PROTOBUF_EXPORT Reflection final { // These get the value of a non-repeated field. They return the default // value for fields that aren't set. - int32 GetInt32(const Message& message, const FieldDescriptor* field) const; + int32_t GetInt32(const Message& message, const FieldDescriptor* field) const; int64 GetInt64(const Message& message, const FieldDescriptor* field) const; - uint32 GetUInt32(const Message& message, const FieldDescriptor* field) const; - uint64 GetUInt64(const Message& message, const FieldDescriptor* field) const; + uint32_t GetUInt32(const Message& message, + const FieldDescriptor* field) const; + uint64 GetUInt64(const Message& message, + const FieldDescriptor* field) const; float GetFloat(const Message& message, const FieldDescriptor* field) const; double GetDouble(const Message& message, const FieldDescriptor* field) const; bool GetBool(const Message& message, const FieldDescriptor* field) const; @@ -600,11 +625,11 @@ class PROTOBUF_EXPORT Reflection final { // These mutate the value of a non-repeated field. void SetInt32(Message* message, const FieldDescriptor* field, - int32 value) const; + int32_t value) const; void SetInt64(Message* message, const FieldDescriptor* field, int64 value) const; void SetUInt32(Message* message, const FieldDescriptor* field, - uint32 value) const; + uint32_t value) const; void SetUInt64(Message* message, const FieldDescriptor* field, uint64 value) const; void SetFloat(Message* message, const FieldDescriptor* field, @@ -675,14 +700,14 @@ class PROTOBUF_EXPORT Reflection final { // Repeated field getters ------------------------------------------ // These get the value of one element of a repeated field. - int32 GetRepeatedInt32(const Message& message, const FieldDescriptor* field, - int index) const; - int64 GetRepeatedInt64(const Message& message, const FieldDescriptor* field, - int index) const; - uint32 GetRepeatedUInt32(const Message& message, const FieldDescriptor* field, + int32_t GetRepeatedInt32(const Message& message, const FieldDescriptor* field, int index) const; - uint64 GetRepeatedUInt64(const Message& message, const FieldDescriptor* field, + int64 GetRepeatedInt64(const Message& message, const FieldDescriptor* field, int index) const; + uint32_t GetRepeatedUInt32(const Message& message, + const FieldDescriptor* field, int index) const; + uint64 GetRepeatedUInt64(const Message& message, + const FieldDescriptor* field, int index) const; float GetRepeatedFloat(const Message& message, const FieldDescriptor* field, int index) const; double GetRepeatedDouble(const Message& message, const FieldDescriptor* field, @@ -716,11 +741,11 @@ class PROTOBUF_EXPORT Reflection final { // These mutate the value of one element of a repeated field. void SetRepeatedInt32(Message* message, const FieldDescriptor* field, - int index, int32 value) const; + int index, int32_t value) const; void SetRepeatedInt64(Message* message, const FieldDescriptor* field, int index, int64 value) const; void SetRepeatedUInt32(Message* message, const FieldDescriptor* field, - int index, uint32 value) const; + int index, uint32_t value) const; void SetRepeatedUInt64(Message* message, const FieldDescriptor* field, int index, uint64 value) const; void SetRepeatedFloat(Message* message, const FieldDescriptor* field, @@ -753,11 +778,11 @@ class PROTOBUF_EXPORT Reflection final { // These add an element to a repeated field. void AddInt32(Message* message, const FieldDescriptor* field, - int32 value) const; + int32_t value) const; void AddInt64(Message* message, const FieldDescriptor* field, int64 value) const; void AddUInt32(Message* message, const FieldDescriptor* field, - uint32 value) const; + uint32_t value) const; void AddUInt64(Message* message, const FieldDescriptor* field, uint64 value) const; void AddFloat(Message* message, const FieldDescriptor* field, @@ -788,6 +813,13 @@ class PROTOBUF_EXPORT Reflection final { void AddAllocatedMessage(Message* message, const FieldDescriptor* field, Message* new_entry) const; + // Similar to AddAllocatedMessage() without internal safety and ownership + // checks. This method should only be used when the objects are on the same + // arena or paired with a call to `UnsafeArenaReleaseLast`. + void UnsafeArenaAddAllocatedMessage(Message* message, + const FieldDescriptor* field, + Message* new_entry) const; + // Get a RepeatedFieldRef object that can be used to read the underlying // repeated field. The type parameter T must be set according to the @@ -795,14 +827,14 @@ class PROTOBUF_EXPORT Reflection final { // to acceptable T. // // field->cpp_type() T - // CPPTYPE_INT32 int32 - // CPPTYPE_UINT32 uint32 - // CPPTYPE_INT64 int64 - // CPPTYPE_UINT64 uint64 + // CPPTYPE_INT32 int32_t + // CPPTYPE_UINT32 uint32_t + // CPPTYPE_INT64 int64_t + // CPPTYPE_UINT64 uint64_t // CPPTYPE_DOUBLE double // CPPTYPE_FLOAT float // CPPTYPE_BOOL bool - // CPPTYPE_ENUM generated enum type or int32 + // CPPTYPE_ENUM generated enum type or int32_t // CPPTYPE_STRING TProtoStringType // CPPTYPE_MESSAGE generated message type or google::protobuf::Message // @@ -1033,6 +1065,7 @@ class PROTOBUF_EXPORT Reflection final { friend class ::PROTOBUF_NAMESPACE_ID::MessageLayoutInspector; friend class ::PROTOBUF_NAMESPACE_ID::AssignDescriptorsHelper; friend class DynamicMessageFactory; + friend class DynamicMessageReflectionHelper; friend class GeneratedMessageReflectionTestHelper; friend class python::MapReflectionFriend; friend class python::MessageReflectionFriend; @@ -1124,11 +1157,11 @@ class PROTOBUF_EXPORT Reflection final { const Message* GetDefaultMessageInstance(const FieldDescriptor* field) const; - inline const uint32* GetHasBits(const Message& message) const; - inline uint32* MutableHasBits(Message* message) const; - inline uint32 GetOneofCase(const Message& message, - const OneofDescriptor* oneof_descriptor) const; - inline uint32* MutableOneofCase( + inline const uint32_t* GetHasBits(const Message& message) const; + inline uint32_t* MutableHasBits(Message* message) const; + inline uint32_t GetOneofCase(const Message& message, + const OneofDescriptor* oneof_descriptor) const; + inline uint32_t* MutableOneofCase( Message* message, const OneofDescriptor* oneof_descriptor) const; inline bool HasExtensionSet(const Message& /* message */) const { return schema_.HasExtensionSet(); @@ -1141,6 +1174,8 @@ class PROTOBUF_EXPORT Reflection final { internal::InternalMetadata* MutableInternalMetadata(Message* message) const; + inline bool IsInlined(const FieldDescriptor* field) const; + inline bool HasBit(const Message& message, const FieldDescriptor* field) const; inline void SetBit(Message* message, const FieldDescriptor* field) const; @@ -1148,6 +1183,12 @@ class PROTOBUF_EXPORT Reflection final { inline void SwapBit(Message* message1, Message* message2, const FieldDescriptor* field) const; + inline const uint32_t* GetInlinedStringDonatedArray( + const Message& message) const; + inline uint32_t* MutableInlinedStringDonatedArray(Message* message) const; + inline bool IsInlinedStringDonated(const Message& message, + const FieldDescriptor* field) const; + // Shallow-swap fields listed in fields vector of two messages. It is the // caller's responsibility to make sure shallow swap is safe. void UnsafeShallowSwapFields( @@ -1167,14 +1208,10 @@ class PROTOBUF_EXPORT Reflection final { void SwapFieldsImpl(Message* message1, Message* message2, const std::vector<const FieldDescriptor*>& fields) const; - void SwapOneofField(Message* message1, Message* message2, + template <bool unsafe_shallow_swap> + void SwapOneofField(Message* lhs, Message* rhs, const OneofDescriptor* oneof_descriptor) const; - // Unsafe but shallow version of SwapOneofField. - void UnsafeShallowSwapOneofField( - Message* message1, Message* message2, - const OneofDescriptor* oneof_descriptor) const; - inline bool HasOneofField(const Message& message, const FieldDescriptor* field) const; inline void SetOneofCase(Message* message, @@ -1317,9 +1354,9 @@ class PROTOBUF_EXPORT MessageFactory { Reflection::MutableRepeatedFieldInternal<TYPE>( \ Message * message, const FieldDescriptor* field) const; -DECLARE_GET_REPEATED_FIELD(int32) +DECLARE_GET_REPEATED_FIELD(int32_t) DECLARE_GET_REPEATED_FIELD(int64) -DECLARE_GET_REPEATED_FIELD(uint32) +DECLARE_GET_REPEATED_FIELD(uint32_t) DECLARE_GET_REPEATED_FIELD(uint64) DECLARE_GET_REPEATED_FIELD(float) DECLARE_GET_REPEATED_FIELD(double) @@ -1445,6 +1482,28 @@ template <typename Type> const Type& Reflection::DefaultRaw(const FieldDescriptor* field) const { return *reinterpret_cast<const Type*>(schema_.GetFieldDefault(field)); } + +uint32_t Reflection::GetOneofCase( + const Message& message, const OneofDescriptor* oneof_descriptor) const { + GOOGLE_DCHECK(!oneof_descriptor->is_synthetic()); + return internal::GetConstRefAtOffset<uint32_t>( + message, schema_.GetOneofCaseOffset(oneof_descriptor)); +} + +bool Reflection::HasOneofField(const Message& message, + const FieldDescriptor* field) const { + return (GetOneofCase(message, field->containing_oneof()) == + static_cast<uint32_t>(field->number())); +} + +template <typename Type> +const Type& Reflection::GetRaw(const Message& message, + const FieldDescriptor* field) const { + GOOGLE_DCHECK(!schema_.InRealOneof(field) || HasOneofField(message, field)) + << "Field = " << field->full_name(); + return internal::GetConstRefAtOffset<Type>(message, + schema_.GetFieldOffset(field)); +} } // namespace protobuf } // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/message_lite.cc b/contrib/libs/protobuf/src/google/protobuf/message_lite.cc index a3f5437556..1fa4ee5c21 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message_lite.cc @@ -340,15 +340,15 @@ bool MessageLite::MergeFromString(ConstStringParam data) { // =================================================================== -inline uint8* SerializeToArrayImpl(const MessageLite& msg, uint8* target, - int size) { +inline uint8_t* SerializeToArrayImpl(const MessageLite& msg, uint8_t* target, + int size) { constexpr bool debug = false; if (debug) { // Force serialization to a stream with a block size of 1, which forces // all writes to the stream to cross buffers triggering all fallback paths // in the unittests when serializing to string / array. io::ArrayOutputStream stream(target, size, 1); - uint8* ptr; + uint8_t* ptr; io::EpsCopyOutputStream out( &stream, io::CodedOutputStream::IsDefaultSerializationDeterministic(), &ptr); @@ -366,7 +366,7 @@ inline uint8* SerializeToArrayImpl(const MessageLite& msg, uint8* target, } } -uint8* MessageLite::SerializeWithCachedSizesToArray(uint8* target) const { +uint8_t* MessageLite::SerializeWithCachedSizesToArray(uint8_t* target) const { // We only optimize this when using optimize_for = SPEED. In other cases // we just use the CodedOutputStream path. return SerializeToArrayImpl(*this, target, GetCachedSize()); @@ -393,7 +393,7 @@ bool MessageLite::SerializePartialToCodedStream( } int final_byte_count = output->ByteCount(); - if (final_byte_count - original_byte_count != static_cast<int64>(size)) { + if (final_byte_count - original_byte_count != static_cast<int64_t>(size)) { ByteSizeConsistencyError(size, ByteSizeLong(), final_byte_count - original_byte_count, *this); } @@ -416,7 +416,7 @@ bool MessageLite::SerializePartialToZeroCopyStream( return false; } - uint8* target; + uint8_t* target; io::EpsCopyOutputStream stream( output, io::CodedOutputStream::IsDefaultSerializationDeterministic(), &target); @@ -463,9 +463,9 @@ bool MessageLite::AppendPartialToString(TProtoStringType* output) const { return false; } - STLStringResizeUninitialized(output, old_size + byte_size); - uint8* start = - reinterpret_cast<uint8*>(io::mutable_string_data(output) + old_size); + STLStringResizeUninitializedAmortized(output, old_size + byte_size); + uint8_t* start = + reinterpret_cast<uint8_t*>(io::mutable_string_data(output) + old_size); SerializeToArrayImpl(*this, start, byte_size); return true; } @@ -492,8 +492,8 @@ bool MessageLite::SerializePartialToArray(void* data, int size) const { << " exceeded maximum protobuf size of 2GB: " << byte_size; return false; } - if (size < static_cast<int64>(byte_size)) return false; - uint8* start = reinterpret_cast<uint8*>(data); + if (size < static_cast<int64_t>(byte_size)) return false; + uint8_t* start = reinterpret_cast<uint8_t*>(data); SerializeToArrayImpl(*this, start, byte_size); return true; } diff --git a/contrib/libs/protobuf/src/google/protobuf/message_lite.h b/contrib/libs/protobuf/src/google/protobuf/message_lite.h index 0bbf1eb6ed..d7a9f678b3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/message_lite.h @@ -158,7 +158,7 @@ class ExplicitlyConstructed { // Prefer c++14 aligned_storage, but for compatibility this will do. union AlignedUnion { alignas(T) char space[sizeof(T)]; - int64 align_to_int64; + int64_t align_to_int64; void* align_to_ptr; } union_; }; @@ -449,7 +449,7 @@ class PROTOBUF_EXPORT MessageLite { // must point at a byte array of at least ByteSize() bytes. Whether to use // deterministic serialization, e.g., maps in sorted order, is determined by // CodedOutputStream::IsDefaultSerializationDeterministic(). - uint8* SerializeWithCachedSizesToArray(uint8* target) const; + uint8_t* SerializeWithCachedSizesToArray(uint8_t* target) const; // Returns the result of the last call to ByteSize(). An embedded message's // size is needed both to serialize it (because embedded messages are @@ -507,9 +507,9 @@ class PROTOBUF_EXPORT MessageLite { bool ParseFrom(const T& input); // Fast path when conditions match (ie. non-deterministic) - // uint8* _InternalSerialize(uint8* ptr) const; - virtual uint8* _InternalSerialize(uint8* ptr, - io::EpsCopyOutputStream* stream) const = 0; + // uint8_t* _InternalSerialize(uint8_t* ptr) const; + virtual uint8_t* _InternalSerialize( + uint8_t* ptr, io::EpsCopyOutputStream* stream) const = 0; // Identical to IsInitialized() except that it logs an error message. bool IsInitializedWithErrors() const { diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.cc b/contrib/libs/protobuf/src/google/protobuf/parse_context.cc index 644db7e32d..ca5afad600 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.cc +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.cc @@ -55,7 +55,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { auto ptr = begin + overrun; auto end = begin + kSlopBytes; while (ptr < end) { - uint32 tag; + uint32_t tag; ptr = ReadTag(ptr, &tag); if (ptr == nullptr || ptr > end) return false; // ending on 0 tag is allowed and is the major reason for the necessity of @@ -63,7 +63,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { if (tag == 0) return true; switch (tag & 7) { case 0: { // Varint - uint64 val; + uint64_t val; ptr = VarintParse(ptr, &val); if (ptr == nullptr) return false; break; @@ -73,7 +73,7 @@ bool ParseEndsInSlopRegion(const char* begin, int overrun, int depth) { break; } case 2: { // len delim - int32 size = ReadSize(&ptr); + int32_t size = ReadSize(&ptr); if (ptr == nullptr || size > end - ptr) return false; ptr += size; break; @@ -240,11 +240,11 @@ template <> void byteswap<1>(void* p) {} template <> void byteswap<4>(void* p) { - *static_cast<uint32*>(p) = bswap_32(*static_cast<uint32*>(p)); + *static_cast<uint32_t*>(p) = bswap_32(*static_cast<uint32_t*>(p)); } template <> void byteswap<8>(void* p) { - *static_cast<uint64*>(p) = bswap_64(*static_cast<uint64*>(p)); + *static_cast<uint64_t*>(p) = bswap_64(*static_cast<uint64_t*>(p)); } const char* EpsCopyInputStream::InitFrom(io::ZeroCopyInputStream* zcis) { @@ -289,36 +289,38 @@ const char* ParseContext::ReadSizeAndPushLimitAndDepth(const char* ptr, } const char* ParseContext::ParseMessage(MessageLite* msg, const char* ptr) { - return ParseMessage<MessageLite>(msg, ptr); -} -const char* ParseContext::ParseMessage(Message* msg, const char* ptr) { - // Use reinterptret case to prevent inclusion of non lite header - return ParseMessage(reinterpret_cast<MessageLite*>(msg), ptr); + int old; + ptr = ReadSizeAndPushLimitAndDepth(ptr, &old); + ptr = ptr ? msg->_InternalParse(ptr, this) : nullptr; + depth_++; + if (!PopLimit(old)) return nullptr; + return ptr; } -inline void WriteVarint(uint64 val, TProtoStringType* s) { +inline void WriteVarint(uint64_t val, TProtoStringType* s) { while (val >= 128) { - uint8 c = val | 0x80; + uint8_t c = val | 0x80; s->push_back(c); val >>= 7; } s->push_back(val); } -void WriteVarint(uint32 num, uint64 val, TProtoStringType* s) { +void WriteVarint(uint32_t num, uint64_t val, TProtoStringType* s) { WriteVarint(num << 3, s); WriteVarint(val, s); } -void WriteLengthDelimited(uint32 num, StringPiece val, TProtoStringType* s) { +void WriteLengthDelimited(uint32_t num, StringPiece val, TProtoStringType* s) { WriteVarint((num << 3) + 2, s); WriteVarint(val.size(), s); s->append(val.data(), val.size()); } -std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res) { +std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, + uint32_t res) { for (std::uint32_t i = 2; i < 5; i++) { - uint32 byte = static_cast<uint8>(p[i]); + uint32_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; @@ -326,7 +328,7 @@ std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res) { } // Accept >5 bytes for (std::uint32_t i = 5; i < 10; i++) { - uint32 byte = static_cast<uint8>(p[i]); + uint32_t byte = static_cast<uint8_t>(p[i]); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } @@ -334,10 +336,11 @@ std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res) { return {nullptr, 0}; } -std::pair<const char*, uint64> VarintParseSlow64(const char* p, uint32 res32) { - uint64 res = res32; +std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, + uint32_t res32) { + uint64_t res = res32; for (std::uint32_t i = 2; i < 10; i++) { - uint64 byte = static_cast<uint8>(p[i]); + uint64_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; @@ -346,9 +349,9 @@ std::pair<const char*, uint64> VarintParseSlow64(const char* p, uint32 res32) { return {nullptr, 0}; } -std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res) { +std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res) { for (std::uint32_t i = 2; i < 5; i++) { - uint32 byte = static_cast<uint8>(p[i]); + uint32_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; @@ -357,15 +360,15 @@ std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res) { return {nullptr, 0}; } -std::pair<const char*, int32> ReadSizeFallback(const char* p, uint32 res) { +std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t res) { for (std::uint32_t i = 1; i < 4; i++) { - uint32 byte = static_cast<uint8>(p[i]); + uint32_t byte = static_cast<uint8_t>(p[i]); res += (byte - 1) << (7 * i); if (PROTOBUF_PREDICT_TRUE(byte < 128)) { return {p + i + 1, res}; } } - std::uint32_t byte = static_cast<uint8>(p[4]); + std::uint32_t byte = static_cast<uint8_t>(p[4]); if (PROTOBUF_PREDICT_FALSE(byte >= 8)) return {nullptr, 0}; // size >= 2gb res += (byte - 1) << 28; // Protect against sign integer overflow in PushLimit. Limits are relative @@ -406,7 +409,7 @@ const char* InlineGreedyStringParser(TProtoStringType* s, const char* ptr, template <typename T, bool sign> const char* VarintParser(void* object, const char* ptr, ParseContext* ctx) { - return ctx->ReadPackedVarint(ptr, [object](uint64 varint) { + return ctx->ReadPackedVarint(ptr, [object](uint64_t varint) { T val; if (sign) { if (sizeof(T) == 8) { @@ -423,27 +426,27 @@ const char* VarintParser(void* object, const char* ptr, ParseContext* ctx) { const char* PackedInt32Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int32, false>(object, ptr, ctx); + return VarintParser<int32_t, false>(object, ptr, ctx); } const char* PackedUInt32Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<uint32, false>(object, ptr, ctx); + return VarintParser<uint32_t, false>(object, ptr, ctx); } const char* PackedInt64Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int64, false>(object, ptr, ctx); + return VarintParser<int64_t, false>(object, ptr, ctx); } const char* PackedUInt64Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<uint64, false>(object, ptr, ctx); + return VarintParser<uint64_t, false>(object, ptr, ctx); } const char* PackedSInt32Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int32, true>(object, ptr, ctx); + return VarintParser<int32_t, true>(object, ptr, ctx); } const char* PackedSInt64Parser(void* object, const char* ptr, ParseContext* ctx) { - return VarintParser<int64, true>(object, ptr, ctx); + return VarintParser<int64_t, true>(object, ptr, ctx); } const char* PackedEnumParser(void* object, const char* ptr, ParseContext* ctx) { @@ -464,19 +467,19 @@ const char* FixedParser(void* object, const char* ptr, ParseContext* ctx) { const char* PackedFixed32Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<uint32>(object, ptr, ctx); + return FixedParser<uint32_t>(object, ptr, ctx); } const char* PackedSFixed32Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<int32>(object, ptr, ctx); + return FixedParser<int32_t>(object, ptr, ctx); } const char* PackedFixed64Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<uint64>(object, ptr, ctx); + return FixedParser<uint64_t>(object, ptr, ctx); } const char* PackedSFixed64Parser(void* object, const char* ptr, ParseContext* ctx) { - return FixedParser<int64>(object, ptr, ctx); + return FixedParser<int64_t>(object, ptr, ctx); } const char* PackedFloatParser(void* object, const char* ptr, ParseContext* ctx) { @@ -492,20 +495,20 @@ class UnknownFieldLiteParserHelper { explicit UnknownFieldLiteParserHelper(TProtoStringType* unknown) : unknown_(unknown) {} - void AddVarint(uint32 num, uint64 value) { + void AddVarint(uint32_t num, uint64_t value) { if (unknown_ == nullptr) return; WriteVarint(num * 8, unknown_); WriteVarint(value, unknown_); } - void AddFixed64(uint32 num, uint64 value) { + void AddFixed64(uint32_t num, uint64_t value) { if (unknown_ == nullptr) return; WriteVarint(num * 8 + 1, unknown_); char buffer[8]; io::CodedOutputStream::WriteLittleEndian64ToArray( - value, reinterpret_cast<uint8*>(buffer)); + value, reinterpret_cast<uint8_t*>(buffer)); unknown_->append(buffer, 8); } - const char* ParseLengthDelimited(uint32 num, const char* ptr, + const char* ParseLengthDelimited(uint32_t num, const char* ptr, ParseContext* ctx) { int size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); @@ -514,19 +517,19 @@ class UnknownFieldLiteParserHelper { WriteVarint(size, unknown_); return ctx->AppendString(ptr, size, unknown_); } - const char* ParseGroup(uint32 num, const char* ptr, ParseContext* ctx) { + const char* ParseGroup(uint32_t num, const char* ptr, ParseContext* ctx) { if (unknown_) WriteVarint(num * 8 + 3, unknown_); ptr = ctx->ParseGroup(this, ptr, num * 8 + 3); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); if (unknown_) WriteVarint(num * 8 + 4, unknown_); return ptr; } - void AddFixed32(uint32 num, uint32 value) { + void AddFixed32(uint32_t num, uint32_t value) { if (unknown_ == nullptr) return; WriteVarint(num * 8 + 5, unknown_); char buffer[4]; io::CodedOutputStream::WriteLittleEndian32ToArray( - value, reinterpret_cast<uint8*>(buffer)); + value, reinterpret_cast<uint8_t*>(buffer)); unknown_->append(buffer, 4); } @@ -544,8 +547,8 @@ const char* UnknownGroupLiteParse(TProtoStringType* unknown, const char* ptr, return WireFormatParser(field_parser, ptr, ctx); } -const char* UnknownFieldParse(uint32 tag, TProtoStringType* unknown, const char* ptr, - ParseContext* ctx) { +const char* UnknownFieldParse(uint32_t tag, TProtoStringType* unknown, + const char* ptr, ParseContext* ctx) { UnknownFieldLiteParserHelper field_parser(unknown); return FieldParser(tag, field_parser, ptr, ctx); } diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.h b/contrib/libs/protobuf/src/google/protobuf/parse_context.h index 78c3054ffe..242dc27e82 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.h +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.h @@ -40,6 +40,7 @@ #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/implicit_weak_message.h> +#include <google/protobuf/inlined_string_field.h> #include <google/protobuf/metadata_lite.h> #include <google/protobuf/port.h> #include <google/protobuf/repeated_field.h> @@ -59,12 +60,12 @@ class MessageFactory; namespace internal { // Template code below needs to know about the existence of these functions. -PROTOBUF_EXPORT void WriteVarint(uint32 num, uint64 val, TProtoStringType* s); -PROTOBUF_EXPORT void WriteLengthDelimited(uint32 num, StringPiece val, +PROTOBUF_EXPORT void WriteVarint(uint32_t num, uint64_t val, TProtoStringType* s); +PROTOBUF_EXPORT void WriteLengthDelimited(uint32_t num, StringPiece val, TProtoStringType* s); // Inline because it is just forwarding to s->WriteVarint -inline void WriteVarint(uint32 num, uint64 val, UnknownFieldSet* s); -inline void WriteLengthDelimited(uint32 num, StringPiece val, +inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* s); +inline void WriteLengthDelimited(uint32_t num, StringPiece val, UnknownFieldSet* s); @@ -184,15 +185,15 @@ class PROTOBUF_EXPORT EpsCopyInputStream { PROTOBUF_MUST_USE_RESULT const char* ReadPackedVarint(const char* ptr, Add add); - uint32 LastTag() const { return last_tag_minus_1_ + 1; } - bool ConsumeEndGroup(uint32 start_tag) { + uint32_t LastTag() const { return last_tag_minus_1_ + 1; } + bool ConsumeEndGroup(uint32_t start_tag) { bool res = last_tag_minus_1_ == start_tag; last_tag_minus_1_ = 0; return res; } bool EndedAtLimit() const { return last_tag_minus_1_ == 0; } bool EndedAtEndOfStream() const { return last_tag_minus_1_ == 1; } - void SetLastTag(uint32 tag) { last_tag_minus_1_ = tag - 1; } + void SetLastTag(uint32_t tag) { last_tag_minus_1_ = tag - 1; } void SetEndOfStream() { last_tag_minus_1_ = 1; } bool IsExceedingLimit(const char* ptr) { return ptr > limit_end_ && @@ -281,7 +282,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { // This var doesn't really belong in EpsCopyInputStream and should be part of // the ParseContext, but case 2 is most easily and optimally implemented in // DoneFallback. - uint32 last_tag_minus_1_ = 0; + uint32_t last_tag_minus_1_ = 0; int overall_limit_ = INT_MAX; // Overall limit independent of pushed limits. // Pretty random large number that seems like a safe allocation on most // systems. TODO(gerbens) do we need to set this as build flag? @@ -398,15 +399,19 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { Data& data() { return data_; } const Data& data() const { return data_; } - template <typename T> - PROTOBUF_MUST_USE_RESULT const char* ParseMessage(T* msg, const char* ptr); - // We outline when the type is generic and we go through a virtual const char* ParseMessage(MessageLite* msg, const char* ptr); - const char* ParseMessage(Message* msg, const char* ptr); + + // This overload supports those few cases where ParseMessage is called + // on a class that is not actually a proto message. + // TODO(jorg): Eliminate this use case. + template <typename T, + typename std::enable_if<!std::is_base_of<MessageLite, T>::value, + bool>::type = true> + PROTOBUF_MUST_USE_RESULT const char* ParseMessage(T* msg, const char* ptr); template <typename T> PROTOBUF_MUST_USE_RESULT PROTOBUF_NDEBUG_INLINE const char* ParseGroup( - T* msg, const char* ptr, uint32 tag) { + T* msg, const char* ptr, uint32_t tag) { if (--depth_ < 0) return nullptr; group_depth_++; ptr = msg->_InternalParse(ptr, this); @@ -440,7 +445,7 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { Data data_; }; -template <uint32 tag> +template <uint32_t tag> bool ExpectTag(const char* ptr) { if (tag < 128) { return *ptr == static_cast<char>(tag); @@ -456,13 +461,13 @@ struct EndianHelper; template <> struct EndianHelper<1> { - static uint8 Load(const void* p) { return *static_cast<const uint8*>(p); } + static uint8_t Load(const void* p) { return *static_cast<const uint8_t*>(p); } }; template <> struct EndianHelper<2> { - static uint16 Load(const void* p) { - uint16 tmp; + static uint16_t Load(const void* p) { + uint16_t tmp; std::memcpy(&tmp, p, 2); #ifndef PROTOBUF_LITTLE_ENDIAN tmp = bswap_16(tmp); @@ -473,8 +478,8 @@ struct EndianHelper<2> { template <> struct EndianHelper<4> { - static uint32 Load(const void* p) { - uint32 tmp; + static uint32_t Load(const void* p) { + uint32_t tmp; std::memcpy(&tmp, p, 4); #ifndef PROTOBUF_LITTLE_ENDIAN tmp = bswap_32(tmp); @@ -485,8 +490,8 @@ struct EndianHelper<4> { template <> struct EndianHelper<8> { - static uint64 Load(const void* p) { - uint64 tmp; + static uint64_t Load(const void* p) { + uint64_t tmp; std::memcpy(&tmp, p, 8); #ifndef PROTOBUF_LITTLE_ENDIAN tmp = bswap_64(tmp); @@ -504,31 +509,38 @@ T UnalignedLoad(const char* p) { } PROTOBUF_EXPORT -std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res); +std::pair<const char*, uint32_t> VarintParseSlow32(const char* p, uint32_t res); PROTOBUF_EXPORT -std::pair<const char*, uint64> VarintParseSlow64(const char* p, uint32 res); +std::pair<const char*, uint64_t> VarintParseSlow64(const char* p, uint32_t res); -inline const char* VarintParseSlow(const char* p, uint32 res, uint32* out) { +inline const char* VarintParseSlow(const char* p, uint32_t res, uint32_t* out) { auto tmp = VarintParseSlow32(p, res); *out = tmp.second; return tmp.first; } -inline const char* VarintParseSlow(const char* p, uint32 res, uint64* out) { +inline const char* VarintParseSlow(const char* p, uint32_t res, uint64* out) { + auto tmp = VarintParseSlow64(p, res); + *out = tmp.second; + return tmp.first; +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) { auto tmp = VarintParseSlow64(p, res); *out = tmp.second; return tmp.first; } +#endif template <typename T> PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { - auto ptr = reinterpret_cast<const uint8*>(p); - uint32 res = ptr[0]; + auto ptr = reinterpret_cast<const uint8_t*>(p); + uint32_t res = ptr[0]; if (!(res & 0x80)) { *out = res; return p + 1; } - uint32 byte = ptr[1]; + uint32_t byte = ptr[1]; res += (byte - 1) << 7; if (!(byte & 0x80)) { *out = res; @@ -541,16 +553,17 @@ PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { // Caller must ensure its safe to call. PROTOBUF_EXPORT -std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res); +std::pair<const char*, uint32_t> ReadTagFallback(const char* p, uint32_t res); // Same as ParseVarint but only accept 5 bytes at most. -inline const char* ReadTag(const char* p, uint32* out, uint32 /*max_tag*/ = 0) { - uint32 res = static_cast<uint8>(p[0]); +inline const char* ReadTag(const char* p, uint32_t* out, + uint32_t /*max_tag*/ = 0) { + uint32_t res = static_cast<uint8_t>(p[0]); if (res < 128) { *out = res; return p + 1; } - uint32 second = static_cast<uint8>(p[1]); + uint32_t second = static_cast<uint8_t>(p[1]); res += (second - 1) << 7; if (second < 128) { *out = res; @@ -571,8 +584,8 @@ inline const char* ReadTag(const char* p, uint32* out, uint32 /*max_tag*/ = 0) { // adc [rsi], 1 // add eax, eax // and eax, edi -inline uint32 DecodeTwoBytes(const char** ptr) { - uint32 value = UnalignedLoad<uint16>(*ptr); +inline uint32_t DecodeTwoBytes(const char** ptr) { + uint32_t value = UnalignedLoad<uint16_t>(*ptr); // Sign extend the low byte continuation bit uint32_t x = static_cast<int8_t>(value); // This add is an amazing operation, it cancels the low byte continuation bit @@ -586,11 +599,11 @@ inline uint32 DecodeTwoBytes(const char** ptr) { } // More efficient varint parsing for big varints -inline const char* ParseBigVarint(const char* p, uint64* out) { +inline const char* ParseBigVarint(const char* p, uint64_t* out) { auto pnew = p; auto tmp = DecodeTwoBytes(&pnew); - uint64 res = tmp >> 1; - if (PROTOBUF_PREDICT_TRUE(std::int16_t(tmp) >= 0)) { + uint64_t res = tmp >> 1; + if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { *out = res; return pnew; } @@ -598,7 +611,7 @@ inline const char* ParseBigVarint(const char* p, uint64* out) { pnew = p + 2 * i; tmp = DecodeTwoBytes(&pnew); res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1); - if (PROTOBUF_PREDICT_TRUE(std::int16_t(tmp) >= 0)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<std::int16_t>(tmp) >= 0)) { *out = res; return pnew; } @@ -607,13 +620,13 @@ inline const char* ParseBigVarint(const char* p, uint64* out) { } PROTOBUF_EXPORT -std::pair<const char*, int32> ReadSizeFallback(const char* p, uint32 first); +std::pair<const char*, int32_t> ReadSizeFallback(const char* p, uint32_t first); // Used for tags, could read up to 5 bytes which must be available. Additionally -// it makes sure the unsigned value fits a int32, otherwise returns nullptr. +// it makes sure the unsigned value fits a int32_t, otherwise returns nullptr. // Caller must ensure its safe to call. -inline uint32 ReadSize(const char** pp) { +inline uint32_t ReadSize(const char** pp) { auto p = *pp; - uint32 res = static_cast<uint8>(p[0]); + uint32_t res = static_cast<uint8_t>(p[0]); if (res < 128) { *pp = p + 1; return res; @@ -628,31 +641,32 @@ inline uint32 ReadSize(const char** pp) { // function composition. We rely on the compiler to inline this. // Also in debug compiles having local scoped variables tend to generated // stack frames that scale as O(num fields). -inline uint64 ReadVarint64(const char** p) { - uint64 tmp; +inline uint64_t ReadVarint64(const char** p) { + uint64_t tmp; *p = VarintParse(*p, &tmp); return tmp; } -inline uint32 ReadVarint32(const char** p) { - uint32 tmp; +inline uint32_t ReadVarint32(const char** p) { + uint32_t tmp; *p = VarintParse(*p, &tmp); return tmp; } -inline int64 ReadVarintZigZag64(const char** p) { - uint64 tmp; +inline int64_t ReadVarintZigZag64(const char** p) { + uint64_t tmp; *p = VarintParse(*p, &tmp); return WireFormatLite::ZigZagDecode64(tmp); } -inline int32 ReadVarintZigZag32(const char** p) { - uint64 tmp; +inline int32_t ReadVarintZigZag32(const char** p) { + uint64_t tmp; *p = VarintParse(*p, &tmp); - return WireFormatLite::ZigZagDecode32(static_cast<uint32>(tmp)); + return WireFormatLite::ZigZagDecode32(static_cast<uint32_t>(tmp)); } -template <typename T> +template <typename T, typename std::enable_if< + !std::is_base_of<MessageLite, T>::value, bool>::type> PROTOBUF_MUST_USE_RESULT const char* ParseContext::ParseMessage( T* msg, const char* ptr) { int old; @@ -716,7 +730,7 @@ const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size, template <typename Add> const char* ReadPackedVarintArray(const char* ptr, const char* end, Add add) { while (ptr < end) { - uint64 varint; + uint64_t varint; ptr = VarintParse(ptr, &varint); if (ptr == nullptr) return nullptr; add(varint); @@ -786,22 +800,22 @@ PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* InlineGreedyStringParser( GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr) template <typename T> -PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64 tag, T& field_parser, +PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64_t tag, T& field_parser, const char* ptr, ParseContext* ctx) { - uint32 number = tag >> 3; + uint32_t number = tag >> 3; GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0); using WireType = internal::WireFormatLite::WireType; switch (tag & 7) { case WireType::WIRETYPE_VARINT: { - uint64 value; + uint64_t value; ptr = VarintParse(ptr, &value); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); field_parser.AddVarint(number, value); break; } case WireType::WIRETYPE_FIXED64: { - uint64 value = UnalignedLoad<uint64>(ptr); + uint64_t value = UnalignedLoad<uint64_t>(ptr); ptr += 8; field_parser.AddFixed64(number, value); break; @@ -821,7 +835,7 @@ PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64 tag, T& field_parser, break; } case WireType::WIRETYPE_FIXED32: { - uint32 value = UnalignedLoad<uint32>(ptr); + uint32_t value = UnalignedLoad<uint32_t>(ptr); ptr += 4; field_parser.AddFixed32(number, value); break; @@ -837,7 +851,7 @@ PROTOBUF_MUST_USE_RESULT const char* WireFormatParser(T& field_parser, const char* ptr, ParseContext* ctx) { while (!ctx->Done(&ptr)) { - uint32 tag; + uint32_t tag; ptr = ReadTag(ptr, &tag); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); if (tag == 0 || (tag & 7) == 4) { @@ -874,7 +888,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser( void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int), InternalMetadata* metadata, int field_num) { return ctx->ReadPackedVarint( - ptr, [object, is_valid, metadata, field_num](uint64 val) { + ptr, [object, is_valid, metadata, field_num](uint64_t val) { if (is_valid(val)) { static_cast<RepeatedField<int>*>(object)->Add(val); } else { @@ -889,7 +903,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg( bool (*is_valid)(const void*, int), const void* data, InternalMetadata* metadata, int field_num) { return ctx->ReadPackedVarint( - ptr, [object, is_valid, data, metadata, field_num](uint64 val) { + ptr, [object, is_valid, data, metadata, field_num](uint64_t val) { if (is_valid(data, val)) { static_cast<RepeatedField<int>*>(object)->Add(val); } else { @@ -920,7 +934,7 @@ PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownGroupLiteParse( // useful in the generated code. It uses overload on TProtoStringType* vs // UnknownFieldSet* to make the generated code isomorphic between full and lite. PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownFieldParse( - uint32 tag, TProtoStringType* unknown, const char* ptr, ParseContext* ctx); + uint32_t tag, TProtoStringType* unknown, const char* ptr, ParseContext* ctx); } // namespace internal } // namespace protobuf diff --git a/contrib/libs/protobuf/src/google/protobuf/port_def.inc b/contrib/libs/protobuf/src/google/protobuf/port_def.inc index 045433848b..d488975a39 100644 --- a/contrib/libs/protobuf/src/google/protobuf/port_def.inc +++ b/contrib/libs/protobuf/src/google/protobuf/port_def.inc @@ -52,6 +52,35 @@ // GCC, and MSVC. Function-like macros are usable without an #ifdef guard. // Syntax macros (for example, attributes) are always defined, although // they may be empty. +// +// Some definitions rely on the NDEBUG macro and/or (in MSVC) _DEBUG: +// - https://en.cppreference.com/w/c/error/assert +// - https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros#microsoft-specific-predefined-macros +// +// References for predefined macros: +// - Standard: https://en.cppreference.com/w/cpp/preprocessor/replace +// - Clang: https://clang.llvm.org/docs/LanguageExtensions.html +// (see also GCC predefined macros) +// - GCC: https://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html +// - MSVC: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros +// - Interactive (Clang/GCC only): https://www.compiler-explorer.com/z/hc6jKd3sj +// +// References for attributes (and extension attributes): +// - Standard: https://en.cppreference.com/w/cpp/language/attributes +// - Clang: https://clang.llvm.org/docs/AttributeReference.html +// - GCC: https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html +// (see Clang attribute docs as well) +// +// References for standard C++ language conformance (and minimum versions): +// - Clang: https://clang.llvm.org/cxx_status.html +// - GCC: https://gcc.gnu.org/projects/cxx-status.html +// - MSVC: https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance +// +// Historical release notes (which can help to determine minimum versions): +// - Clang: https://releases.llvm.org/ +// - GCC: https://gcc.gnu.org/releases.html +// - MSVC: https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-history +// https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes-history // Portable fallbacks for C++20 feature test macros: // https://en.cppreference.com/w/cpp/feature_test @@ -99,6 +128,23 @@ # define PROTOBUF_GNUC_MIN(x, y) 0 #endif +// Portable check for MSVC minimum version: +// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros +#if defined(_MSC_VER) +#define PROTOBUF_MSC_VER_MIN(x) (_MSC_VER >= x) +#else +#define PROTOBUF_MSC_VER_MIN(x) 0 +#endif + +// Portable check for minimum C++ language version: +// https://en.cppreference.com/w/cpp/preprocessor/replace +// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros +#if !defined(_MSVC_LANG) +#define PROTOBUF_CPLUSPLUS_MIN(x) (__cplusplus >= x) +#else +#define PROTOBUF_CPLUSPLUS_MIN(x) (_MSVC_LANG >= x) +#endif + // Future versions of protobuf will include breaking changes to some APIs. // This macro can be set to enable these API changes ahead of time, so that // user code can be updated before upgrading versions of protobuf. @@ -107,17 +153,17 @@ #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 3017003 +#define PROTOBUF_VERSION 3018001 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined #endif -#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3017000 +#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3018000 #ifdef PROTOBUF_MIN_PROTOC_VERSION #error PROTOBUF_MIN_PROTOC_VERSION was previously defined #endif -#define PROTOBUF_MIN_PROTOC_VERSION 3017000 +#define PROTOBUF_MIN_PROTOC_VERSION 3018000 #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined @@ -184,8 +230,9 @@ #error PROTOBUF_TAILCALL was previously defined #endif #if __has_cpp_attribute(clang::musttail) && \ - !defined(_ARCH_PPC) && !defined(__wasm__) + !defined(__arm__) && !defined(_ARCH_PPC) && !defined(__wasm__) # ifndef PROTO2_OPENSOURCE +// Compilation fails on ARM32: b/195943306 // Compilation fails on powerpc64le: b/187985113 # endif #define PROTOBUF_MUSTTAIL [[clang::musttail]] @@ -291,7 +338,7 @@ // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3017000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3018000 #ifdef PROTOBUF_RTTI #error PROTOBUF_RTTI was previously defined @@ -384,8 +431,8 @@ #error PROTOBUF_PREDICT_(TRUE|FALSE) was previously defined #endif #if PROTOBUF_GNUC_MIN(3, 0) -# define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) -# define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect((x), 0)) +# define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(false || (x), true)) +# define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect(false || (x), false)) #else # define PROTOBUF_PREDICT_TRUE(x) (x) # define PROTOBUF_PREDICT_FALSE(x) (x) @@ -400,10 +447,6 @@ # define PROTOBUF_MUST_USE_RESULT # endif -#ifdef PROTOBUF_MUST_USE_EXTRACT_RESULT -#error PROTOBUF_MUST_USE_EXTRACT_RESULT was previously defined -#endif - #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #error PROTOBUF_FORCE_COPY_IN_RELEASE was previously defined #endif @@ -412,10 +455,16 @@ #error PROTOBUF_FORCE_COPY_IN_SWAP was previously defined #endif +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE +#error PROTOBUF_FORCE_COPY_IN_MOVE was previously defined +#endif + #ifdef PROTOBUF_FALLTHROUGH_INTENDED #error PROTOBUF_FALLTHROUGH_INTENDED was previously defined #endif -#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") +#if __has_cpp_attribute(fallthrough) +#define PROTOBUF_FALLTHROUGH_INTENDED [[fallthrough]] +#elif __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") #define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]] #elif PROTOBUF_GNUC_MIN(7, 0) #define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]] @@ -550,10 +599,15 @@ #ifdef PROTOBUF_ATTRIBUTE_WEAK #error PROTOBUF_ATTRIBUTE_WEAK was previously defined #endif -#if __has_attribute(weak) && !defined(__MINGW32__) +#if __has_attribute(weak) && \ + !defined(__APPLE__) && \ + (!defined(_WIN32) || __clang_major__ < 9) && \ + !defined(__MINGW32__) #define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak)) +#define PROTOBUF_HAVE_ATTRIBUTE_WEAK 1 #else #define PROTOBUF_ATTRIBUTE_WEAK +#define PROTOBUF_HAVE_ATTRIBUTE_WEAK 0 #endif // Macros to detect sanitizers. @@ -581,11 +635,42 @@ # define PROTOBUF_TSAN __SANITIZE_THREAD__ #endif +// Tail call table-driven parsing can be enabled by defining +// PROTOBUF_EXPERIMENTAL_USE_TAIL_CALL_TABLE_PARSER at compilation time. Note +// that this macro is for small-scale testing only, and is not supported. +#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED +#error PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED was previously declared +#endif +#if defined(PROTOBUF_EXPERIMENTAL_USE_TAIL_CALL_TABLE_PARSER) +#define PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED 1 +// Selectively use static member functions instead of templates: +#ifndef PROTOBUF_TC_STATIC_PARSE_SINGULAR1 +# define PROTOBUF_TC_STATIC_PARSE_SINGULAR1 1 +#endif +#ifndef PROTOBUF_TC_STATIC_PARSE_SINGULAR2 +# define PROTOBUF_TC_STATIC_PARSE_SINGULAR2 0 +#endif +#ifndef PROTOBUF_TC_STATIC_PARSE_REPEATED1 +# define PROTOBUF_TC_STATIC_PARSE_REPEATED1 0 +#endif +#ifndef PROTOBUF_TC_STATIC_PARSE_REPEATED2 +# define PROTOBUF_TC_STATIC_PARSE_REPEATED2 0 +#endif +#endif + +#define PROTOBUF_TC_PARAM_DECL \ + ::google::protobuf::MessageLite *msg, const char *ptr, \ + ::google::protobuf::internal::ParseContext *ctx, \ + const ::google::protobuf::internal::TailCallParseTableBase *table, \ + uint64_t hasbits, ::google::protobuf::internal::TcFieldData data + #ifdef PROTOBUF_UNUSED #error PROTOBUF_UNUSED was previously defined #endif -#if __has_cpp_attribute(unused) || \ - (PROTOBUF_GNUC_MIN(3, 0) && !defined(__clang__)) +#if __has_cpp_attribute(maybe_unused) || \ + (PROTOBUF_MSC_VER_MIN(1911) && PROTOBUF_CPLUSPLUS_MIN(201703L)) +#define PROTOBUF_UNUSED [[maybe_unused]] +#elif __has_attribute(unused) || PROTOBUF_GNUC_MIN(3, 0) #define PROTOBUF_UNUSED __attribute__((__unused__)) #else #define PROTOBUF_UNUSED @@ -699,4 +784,3 @@ # undef __has_builtin # undef PROTOBUF_has_builtin_DEFINED_ #endif -#undef PROTOBUF_GNUC_MIN diff --git a/contrib/libs/protobuf/src/google/protobuf/port_undef.inc b/contrib/libs/protobuf/src/google/protobuf/port_undef.inc index 34b1b064a8..16a951d2fd 100644 --- a/contrib/libs/protobuf/src/google/protobuf/port_undef.inc +++ b/contrib/libs/protobuf/src/google/protobuf/port_undef.inc @@ -34,6 +34,9 @@ #ifndef PROTOBUF_NAMESPACE #error "port_undef.inc must be included after port_def.inc" #endif +#undef PROTOBUF_GNUC_MIN +#undef PROTOBUF_MSC_VER_MIN +#undef PROTOBUF_CPLUSPLUS_MIN #undef PROTOBUF_NAMESPACE #undef PROTOBUF_NAMESPACE_ID #undef PROTOBUF_ALWAYS_INLINE @@ -61,9 +64,9 @@ #undef PROTOBUF_EXPORT #undef PROTOC_EXPORT #undef PROTOBUF_MUST_USE_RESULT -#undef PROTOBUF_MUST_USE_EXTRACT_RESULT #undef PROTOBUF_FORCE_COPY_IN_RELEASE #undef PROTOBUF_FORCE_COPY_IN_SWAP +#undef PROTOBUF_FORCE_COPY_IN_MOVE #undef PROTOBUF_NAMESPACE_OPEN #undef PROTOBUF_NAMESPACE_CLOSE #undef PROTOBUF_UNUSED @@ -76,12 +79,19 @@ #undef PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT #undef PROTOBUF_CONSTINIT #undef PROTOBUF_ATTRIBUTE_WEAK +#undef PROTOBUF_HAVE_ATTRIBUTE_WEAK #undef PROTOBUF_ATTRIBUTE_NO_DESTROY #undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY #undef PROTOBUF_PRAGMA_INIT_SEG #undef PROTOBUF_ASAN #undef PROTOBUF_MSAN #undef PROTOBUF_TSAN +#undef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED +#undef PROTOBUF_TC_STATIC_PARSE_SINGULAR1 +#undef PROTOBUF_TC_STATIC_PARSE_SINGULAR2 +#undef PROTOBUF_TC_STATIC_PARSE_REPEATED1 +#undef PROTOBUF_TC_STATIC_PARSE_REPEATED2 +#undef PROTOBUF_TC_PARAM_DECL #undef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED #undef PROTOBUF_LOCKS_EXCLUDED #undef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS diff --git a/contrib/libs/protobuf/src/google/protobuf/reflection.h b/contrib/libs/protobuf/src/google/protobuf/reflection.h index d55a0e0f56..52749b6786 100644 --- a/contrib/libs/protobuf/src/google/protobuf/reflection.h +++ b/contrib/libs/protobuf/src/google/protobuf/reflection.h @@ -282,19 +282,19 @@ namespace internal { // cpp_type to the type that should be used in this interface: // // field->cpp_type() T Actual type of void* -// CPPTYPE_INT32 int32 int32 -// CPPTYPE_UINT32 uint32 uint32 -// CPPTYPE_INT64 int64 int64 -// CPPTYPE_UINT64 uint64 uint64 +// CPPTYPE_INT32 int32_t int32_t +// CPPTYPE_UINT32 uint32_t uint32_t +// CPPTYPE_INT64 int64_t int64_t +// CPPTYPE_UINT64 uint64_t uint64_t // CPPTYPE_DOUBLE double double // CPPTYPE_FLOAT float float // CPPTYPE_BOOL bool bool -// CPPTYPE_ENUM generated enum type int32 +// CPPTYPE_ENUM generated enum type int32_t // CPPTYPE_STRING string TProtoStringType // CPPTYPE_MESSAGE generated message type google::protobuf::Message // or google::protobuf::Message // -// Note that for enums we use int32 in the interface. +// Note that for enums we use int32_t in the interface. // // You can map from T to the actual type using RefTypeTraits: // typedef RefTypeTraits<T>::AccessorValueType ActualType; @@ -362,7 +362,7 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { // be ActualType. Here we have a ValueType object and want a ActualType // pointer. We can't cast a ValueType pointer to an ActualType pointer // directly because their type might be different (for enums ValueType - // may be a generated enum type while ActualType is int32). To be safe + // may be a generated enum type while ActualType is int32_t). To be safe // we make a copy to get a temporary ActualType object and use it. ActualType tmp = static_cast<ActualType>(value); Set(data, index, static_cast<const Value*>(&tmp)); @@ -376,7 +376,7 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { // be ActualType. Here we have a ValueType object and want a ActualType // pointer. We can't cast a ValueType pointer to an ActualType pointer // directly because their type might be different (for enums ValueType - // may be a generated enum type while ActualType is int32). To be safe + // may be a generated enum type while ActualType is int32_t). To be safe // we make a copy to get a temporary ActualType object and use it. ActualType tmp = static_cast<ActualType>(value); Add(data, static_cast<const Value*>(&tmp)); @@ -392,13 +392,18 @@ class PROTOBUF_EXPORT RepeatedFieldAccessor { // Implement (Mutable)RepeatedFieldRef::iterator template <typename T> -class RepeatedFieldRefIterator - : public std::iterator<std::forward_iterator_tag, T> { +class RepeatedFieldRefIterator { typedef typename RefTypeTraits<T>::AccessorValueType AccessorValueType; typedef typename RefTypeTraits<T>::IteratorValueType IteratorValueType; typedef typename RefTypeTraits<T>::IteratorPointerType IteratorPointerType; public: + using iterator_category = std::forward_iterator_tag; + using value_type = T; + using pointer = T*; + using reference = T&; + using difference_type = std::ptrdiff_t; + // Constructor for non-message fields. RepeatedFieldRefIterator(const void* data, const RepeatedFieldAccessor* accessor, bool begin) @@ -480,8 +485,8 @@ struct PrimitiveTraits { static const FieldDescriptor::CppType cpp_type = \ FieldDescriptor::CPPTYPE_##TYPE; \ }; -DEFINE_PRIMITIVE(INT32, int32) -DEFINE_PRIMITIVE(UINT32, uint32) +DEFINE_PRIMITIVE(INT32, int32_t) +DEFINE_PRIMITIVE(UINT32, uint32_t) DEFINE_PRIMITIVE(INT64, int64) DEFINE_PRIMITIVE(UINT64, uint64) DEFINE_PRIMITIVE(FLOAT, float) @@ -507,10 +512,10 @@ struct RefTypeTraits< T, typename std::enable_if<is_proto_enum<T>::value>::type> { typedef RepeatedFieldRefIterator<T> iterator; typedef RepeatedFieldAccessor AccessorType; - // We use int32 for repeated enums in RepeatedFieldAccessor. - typedef int32 AccessorValueType; + // We use int32_t for repeated enums in RepeatedFieldAccessor. + typedef int32_t AccessorValueType; typedef T IteratorValueType; - typedef int32* IteratorPointerType; + typedef int32_t* IteratorPointerType; static constexpr FieldDescriptor::CppType cpp_type = FieldDescriptor::CPPTYPE_ENUM; static const Descriptor* GetMessageFieldDescriptor() { return NULL; } diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc b/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc index 737c4b7bbd..13bbf92603 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc @@ -58,10 +58,10 @@ void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) { Arena* arena = GetArena(); new_size = std::max(internal::kRepeatedFieldLowerClampLimit, std::max(total_size_ * 2, new_size)); - GOOGLE_CHECK_LE( - static_cast<int64>(new_size), - static_cast<int64>((std::numeric_limits<size_t>::max() - kRepHeaderSize) / - sizeof(old_rep->elements[0]))) + GOOGLE_CHECK_LE(static_cast<int64_t>(new_size), + static_cast<int64_t>( + (std::numeric_limits<size_t>::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 == NULL) { @@ -135,10 +135,10 @@ MessageLite* RepeatedPtrFieldBase::AddWeak(const MessageLite* prototype) { template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<bool>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int32>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<uint32>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int64>; -template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<uint64>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int32_t>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<uint32_t>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int64_t>; +template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<uint64_t>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<float>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<double>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedPtrField<TProtoStringType>; diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h index cb9205a63a..e0c565e1e2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h @@ -144,15 +144,15 @@ inline typename std::enable_if<(kSize == 0), void>::type memswap(char*, char*) { q + sizeof(reg_type)); \ } -PROTO_MEMSWAP_DEF_SIZE(uint8, 2) -PROTO_MEMSWAP_DEF_SIZE(uint16, 4) -PROTO_MEMSWAP_DEF_SIZE(uint32, 8) +PROTO_MEMSWAP_DEF_SIZE(uint8_t, 2) +PROTO_MEMSWAP_DEF_SIZE(uint16_t, 4) +PROTO_MEMSWAP_DEF_SIZE(uint32_t, 8) #ifdef __SIZEOF_INT128__ -PROTO_MEMSWAP_DEF_SIZE(uint64, 16) +PROTO_MEMSWAP_DEF_SIZE(uint64_t, 16) PROTO_MEMSWAP_DEF_SIZE(__uint128_t, (1u << 31)) #else -PROTO_MEMSWAP_DEF_SIZE(uint64, (1u << 31)) +PROTO_MEMSWAP_DEF_SIZE(uint64_t, (1u << 31)) #endif #undef PROTO_MEMSWAP_DEF_SIZE @@ -218,13 +218,13 @@ class RepeatedField { // Calling this routine inside a loop can cause quadratic behavior. void ExtractSubrange(int start, int num, Element* elements); - void Clear(); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear(); void MergeFrom(const RepeatedField& other); - void CopyFrom(const RepeatedField& other); + PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedField& other); // Replaces the contents with RepeatedField(begin, end). template <typename Iter> - void Assign(Iter begin, Iter end); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end); // Reserve space to expand the field to at least the given size. If the // array is grown, it will always be at least doubled in size. @@ -984,13 +984,13 @@ class RepeatedPtrField : private internal::RepeatedPtrFieldBase { // Calling this routine inside a loop can cause quadratic behavior. void DeleteSubrange(int start, int num); - void Clear(); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear(); void MergeFrom(const RepeatedPtrField& other); - void CopyFrom(const RepeatedPtrField& other); + PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other); // Replaces the contents with RepeatedPtrField(begin, end). template <typename Iter> - void Assign(Iter begin, Iter end); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end); // Reserve space to expand the field to at least the given size. This only // resizes the pointer array; it doesn't allocate any objects. If the @@ -1102,18 +1102,18 @@ class RepeatedPtrField : private internal::RepeatedPtrFieldBase { // It is also useful in legacy code that uses temporary ownership to avoid // copies. Example: // RepeatedPtrField<T> temp_field; - // temp_field.AddAllocated(new T); + // temp_field.UnsafeArenaAddAllocated(new T); // ... // Do something with temp_field - // temp_field.ExtractSubrange(0, temp_field.size(), nullptr); + // temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr); // If you put temp_field on the arena this fails, because the ownership // transfers to the arena at the "AddAllocated" call and is not released // anymore causing a double delete. UnsafeArenaAddAllocated prevents this. void UnsafeArenaAddAllocated(Element* value); - // Remove the last element and return it. Works only when operating on an - // arena. The returned pointer is to the original object in the arena, hence - // has the arena's lifetime. - // Requires: current_size_ > 0 + // Remove the last element and return it. Unlike ReleaseLast, the returned + // pointer is always to the original object. This may be in an arena, and + // therefore have the arena's lifetime. + // Requires: current_size_ > 0 Element* UnsafeArenaReleaseLast(); // Extract elements with indices in the range "[start .. start+num-1]". @@ -1133,10 +1133,10 @@ class RepeatedPtrField : private internal::RepeatedPtrFieldBase { // UnsafeArenaExtractSubrange(). void ExtractSubrange(int start, int num, Element** elements); - // Identical to ExtractSubrange() described above, except that when this - // repeated field is on an arena, no object copies are performed. Instead, the - // raw object pointers are returned. Thus, if on an arena, the returned - // objects must not be freed, because they will not be heap-allocated objects. + // Identical to ExtractSubrange() described above, except that no object + // copies are ever performed. Instead, the raw object pointers are returned. + // Thus, if on an arena, the returned objects must not be freed, because they + // will not be heap-allocated objects. void UnsafeArenaExtractSubrange(int start, int num, Element** elements); // When elements are removed by calls to RemoveLast() or Clear(), they @@ -1263,6 +1263,9 @@ inline RepeatedField<Element>& RepeatedField<Element>::operator=( template <typename Element> inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept : RepeatedField() { +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + CopyFrom(other); +#else // PROTOBUF_FORCE_COPY_IN_MOVE // We don't just call Swap(&other) here because it would perform 3 copies if // other is on an arena. This field can't be on an arena because arena // construction always uses the Arena* accepting constructor. @@ -1271,6 +1274,7 @@ inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept } else { InternalSwap(&other); } +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE } template <typename Element> @@ -1279,7 +1283,11 @@ inline RepeatedField<Element>& RepeatedField<Element>::operator=( // We don't just call Swap(&other) here because it would perform 3 copies if // the two fields are on different arenas. if (this != &other) { - if (this->GetArena() != other.GetArena()) { + if (GetArena() != other.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + || GetArena() == nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { CopyFrom(other); } else { InternalSwap(&other); @@ -1375,7 +1383,7 @@ inline void RepeatedField<Element>::Set(int index, const Element& value) { template <typename Element> inline void RepeatedField<Element>::Add(const Element& value) { - uint32 size = current_size_; + uint32_t size = current_size_; if (static_cast<int>(size) == total_size_) { // value could reference an element of the array. Reserving new space will // invalidate the reference. So we must make a copy first. @@ -1390,7 +1398,7 @@ inline void RepeatedField<Element>::Add(const Element& value) { template <typename Element> inline Element* RepeatedField<Element>::Add() { - uint32 size = current_size_; + uint32_t size = current_size_; if (static_cast<int>(size) == total_size_) Reserve(total_size_ + 1); auto ptr = &elements()[size]; current_size_ = size + 1; @@ -1637,7 +1645,7 @@ void RepeatedField<Element>::Reserve(int new_size) { // this, since Element is supposed to be POD, but a previous version of this // code allocated storage with "new Element[size]" and some code uses // RepeatedField with non-POD types, relying on constructor invocation. If - // Element has a trivial constructor (e.g., int32), gcc (tested with -O2) + // Element has a trivial constructor (e.g., int32_t), gcc (tested with -O2) // completely removes this loop because the loop body is empty, so this has no // effect unless its side-effects are required for correctness. // Note that we do this before MoveArray() below because Element's copy @@ -1991,9 +1999,6 @@ void RepeatedPtrFieldBase::AddAllocatedSlowWithCopy( // Pass value_arena and my_arena to avoid duplicate virtual call (value) or // load (mine). typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena) { -#ifdef PROTOBUF_INTERNAL_USE_MUST_USE_RESULT - GOOGLE_DCHECK(value_arena == nullptr || value_arena == my_arena); -#endif // PROTOBUF_INTERNAL_USE_MUST_USE_RESULT // Ensure that either the value is in the same arena, or if not, we do the // appropriate thing: Own() it (if it's on heap and we're in an arena) or copy // it to our arena/heap (otherwise). @@ -2185,6 +2190,9 @@ template <typename Element> inline RepeatedPtrField<Element>::RepeatedPtrField( RepeatedPtrField&& other) noexcept : RepeatedPtrField() { +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + CopyFrom(other); +#else // PROTOBUF_FORCE_COPY_IN_MOVE // We don't just call Swap(&other) here because it would perform 3 copies if // other is on an arena. This field can't be on an arena because arena // construction always uses the Arena* accepting constructor. @@ -2193,6 +2201,7 @@ inline RepeatedPtrField<Element>::RepeatedPtrField( } else { InternalSwap(&other); } +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE } template <typename Element> @@ -2201,7 +2210,11 @@ inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( // We don't just call Swap(&other) here because it would perform 3 copies if // the two fields are on different arenas. if (this != &other) { - if (this->GetArena() != other.GetArena()) { + if (GetArena() != other.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + || GetArena() == nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { CopyFrom(other); } else { InternalSwap(&other); @@ -2298,11 +2311,9 @@ inline void RepeatedPtrField<Element>::ExtractSubrangeInternal( if (num == 0) return; -#ifdef PROTOBUF_MUST_USE_EXTRACT_RESULT GOOGLE_DCHECK_NE(elements, nullptr) << "Releasing elements without transferring ownership is an unsafe " "operation. Use UnsafeArenaExtractSubrange."; -#endif if (elements == nullptr) { CloseGap(start, num); return; @@ -2753,9 +2764,14 @@ RepeatedPtrField<Element>::pointer_end() const { namespace internal { // A back inserter for RepeatedField objects. template <typename T> -class RepeatedFieldBackInsertIterator - : public std::iterator<std::output_iterator_tag, T> { +class RepeatedFieldBackInsertIterator { public: + using iterator_category = std::output_iterator_tag; + using value_type = T; + using pointer = void; + using reference = void; + using difference_type = std::ptrdiff_t; + explicit RepeatedFieldBackInsertIterator( RepeatedField<T>* const mutable_field) : field_(mutable_field) {} @@ -2775,9 +2791,14 @@ class RepeatedFieldBackInsertIterator // A back inserter for RepeatedPtrField objects. template <typename T> -class RepeatedPtrFieldBackInsertIterator - : public std::iterator<std::output_iterator_tag, T> { +class RepeatedPtrFieldBackInsertIterator { public: + using iterator_category = std::output_iterator_tag; + using value_type = T; + using pointer = void; + using reference = void; + using difference_type = std::ptrdiff_t; + RepeatedPtrFieldBackInsertIterator(RepeatedPtrField<T>* const mutable_field) : field_(mutable_field) {} RepeatedPtrFieldBackInsertIterator<T>& operator=(const T& value) { @@ -2806,9 +2827,14 @@ class RepeatedPtrFieldBackInsertIterator // A back inserter for RepeatedPtrFields that inserts by transferring ownership // of a pointer. template <typename T> -class AllocatedRepeatedPtrFieldBackInsertIterator - : public std::iterator<std::output_iterator_tag, T> { +class AllocatedRepeatedPtrFieldBackInsertIterator { public: + using iterator_category = std::output_iterator_tag; + using value_type = T; + using pointer = void; + using reference = void; + using difference_type = std::ptrdiff_t; + explicit AllocatedRepeatedPtrFieldBackInsertIterator( RepeatedPtrField<T>* const mutable_field) : field_(mutable_field) {} @@ -2830,9 +2856,14 @@ class AllocatedRepeatedPtrFieldBackInsertIterator // Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one // uses the UnsafeArenaAddAllocated instead. template <typename T> -class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator - : public std::iterator<std::output_iterator_tag, T> { +class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator { public: + using iterator_category = std::output_iterator_tag; + using value_type = T; + using pointer = void; + using reference = void; + using difference_type = std::ptrdiff_t; + explicit UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator( RepeatedPtrField<T>* const mutable_field) : field_(mutable_field) {} @@ -2899,9 +2930,9 @@ AllocatedRepeatedPtrFieldBackInserter( // This is slightly faster if that matters. It is also useful in legacy code // that uses temporary ownership to avoid copies. Example: // RepeatedPtrField<T> temp_field; -// temp_field.AddAllocated(new T); +// temp_field.UnsafeArenaAddAllocated(new T); // ... // Do something with temp_field -// temp_field.ExtractSubrange(0, temp_field.size(), nullptr); +// temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr); // If you put temp_field on the arena this fails, because the ownership // transfers to the arena at the "AddAllocated" call and is not released anymore // causing a double delete. Using UnsafeArenaAddAllocated prevents this. @@ -2915,10 +2946,10 @@ UnsafeArenaAllocatedRepeatedPtrFieldBackInserter( // Extern declarations of common instantiations to reduce library bloat. extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<bool>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int32>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint32>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int64>; -extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint64>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int32_t>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint32_t>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int64_t>; +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint64_t>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<float>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<double>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE diff --git a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc index 1181ba87a5..7748dc365b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc @@ -36,18 +36,19 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceContext, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceContext, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::SourceContext, file_name_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceContext, file_name_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::SourceContext)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::SourceContext)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fsource_5fcontext_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -148,28 +149,29 @@ const char* SourceContext::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceContext.file_name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -212,13 +214,7 @@ size_t SourceContext::ByteSizeLong() const { this->_internal_file_name()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceContext::_class_data_ = { @@ -227,8 +223,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceContext::_class_data_ = }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SourceContext::GetClassData() const { return &_class_data_; } -void SourceContext::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void SourceContext::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<SourceContext *>(to)->MergeFrom( static_cast<const SourceContext &>(from)); } @@ -259,11 +255,13 @@ bool SourceContext::IsInitialized() const { void SourceContext::InternalSwap(SourceContext* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &file_name_, GetArenaForAllocation(), - &other->file_name_, other->GetArenaForAllocation() + &file_name_, lhs_arena, + &other->file_name_, rhs_arena ); } @@ -276,8 +274,8 @@ void SourceContext::InternalSwap(SourceContext* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::SourceContext >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::SourceContext >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::SourceContext >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::SourceContext >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h index d90cb42cd1..b51f1a215e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -59,7 +59,7 @@ struct SourceContextDefaultTypeInternal; PROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT SourceContext final : } inline SourceContext& operator=(SourceContext&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -142,7 +146,7 @@ class PROTOBUF_EXPORT SourceContext final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const SourceContext& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc b/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc index 0baf5b842a..5954609883 100644 --- a/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc @@ -70,52 +70,56 @@ static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptor static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fstruct_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, key_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, key_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, value_), 0, 1, ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Struct, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Struct, fields_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct, fields_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Value, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Value, _internal_metadata_), ~0u, // no _extensions_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Value, _oneof_case_[0]), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Value, _oneof_case_[0]), ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, ::PROTOBUF_NAMESPACE_ID::internal::kInvalidFieldOffsetTag, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Value, kind_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Value, kind_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ListValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ListValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::ListValue, values_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::ListValue, values_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, 7, sizeof(PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse)}, - { 9, -1, sizeof(PROTOBUF_NAMESPACE_ID::Struct)}, - { 15, -1, sizeof(PROTOBUF_NAMESPACE_ID::Value)}, - { 27, -1, sizeof(PROTOBUF_NAMESPACE_ID::ListValue)}, + { 0, 8, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse)}, + { 10, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Struct)}, + { 17, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Value)}, + { 30, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::ListValue)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Struct_FieldsEntry_DoNotUse_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Struct_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Value_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Struct_FieldsEntry_DoNotUse_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Struct_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Value_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fstruct_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -255,28 +259,29 @@ const char* Struct::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -288,7 +293,7 @@ failure: // map<string, .google.protobuf.Value> fields = 1; if (!this->_internal_fields().empty()) { - typedef ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >::const_pointer + typedef ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >::const_pointer ConstPtr; typedef ConstPtr SortItem; typedef ::PROTOBUF_NAMESPACE_ID::internal::CompareByDerefFirst<SortItem> Less; @@ -306,9 +311,9 @@ failure: this->_internal_fields().size() > 1) { ::std::unique_ptr<SortItem[]> items( new SortItem[this->_internal_fields().size()]); - typedef ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >::size_type size_type; + typedef ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >::size_type size_type; size_type n = 0; - for (::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >::const_iterator + for (::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >::const_iterator it = this->_internal_fields().begin(); it != this->_internal_fields().end(); ++it, ++n) { items[static_cast<ptrdiff_t>(n)] = SortItem(&*it); @@ -319,7 +324,7 @@ failure: Utf8Check::Check(&(*items[static_cast<ptrdiff_t>(i)])); } } else { - for (::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >::const_iterator + for (::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >::const_iterator it = this->_internal_fields().begin(); it != this->_internal_fields().end(); ++it) { target = Struct_FieldsEntry_DoNotUse::Funcs::InternalSerialize(1, it->first, it->second, target, stream); @@ -347,19 +352,13 @@ size_t Struct::ByteSizeLong() const { // map<string, .google.protobuf.Value> fields = 1; total_size += 1 * ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_fields_size()); - for (::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >::const_iterator + for (::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >::const_iterator it = this->_internal_fields().begin(); it != this->_internal_fields().end(); ++it) { total_size += Struct_FieldsEntry_DoNotUse::Funcs::ByteSizeLong(it->first, it->second); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Struct::_class_data_ = { @@ -368,8 +367,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Struct::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Struct::GetClassData() const { return &_class_data_; } -void Struct::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Struct::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Struct *>(to)->MergeFrom( static_cast<const Struct &>(from)); } @@ -412,24 +411,24 @@ void Struct::InternalSwap(Struct* other) { class Value::_Internal { public: - static const PROTOBUF_NAMESPACE_ID::Struct& struct_value(const Value* msg); - static const PROTOBUF_NAMESPACE_ID::ListValue& list_value(const Value* msg); + static const ::PROTOBUF_NAMESPACE_ID::Struct& struct_value(const Value* msg); + static const ::PROTOBUF_NAMESPACE_ID::ListValue& list_value(const Value* msg); }; -const PROTOBUF_NAMESPACE_ID::Struct& +const ::PROTOBUF_NAMESPACE_ID::Struct& Value::_Internal::struct_value(const Value* msg) { return *msg->kind_.struct_value_; } -const PROTOBUF_NAMESPACE_ID::ListValue& +const ::PROTOBUF_NAMESPACE_ID::ListValue& Value::_Internal::list_value(const Value* msg) { return *msg->kind_.list_value_; } -void Value::set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value) { +void Value::set_allocated_struct_value(::PROTOBUF_NAMESPACE_ID::Struct* struct_value) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); clear_kind(); if (struct_value) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::Struct>::GetOwningArena(struct_value); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::Struct>::GetOwningArena(struct_value); if (message_arena != submessage_arena) { struct_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, struct_value, submessage_arena); @@ -439,12 +438,12 @@ void Value::set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_val } // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) } -void Value::set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value) { +void Value::set_allocated_list_value(::PROTOBUF_NAMESPACE_ID::ListValue* list_value) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); clear_kind(); if (list_value) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::ListValue>::GetOwningArena(list_value); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::ListValue>::GetOwningArena(list_value); if (message_arena != submessage_arena) { list_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, list_value, submessage_arena); @@ -485,11 +484,11 @@ Value::Value(const Value& from) break; } case kStructValue: { - _internal_mutable_struct_value()->PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value()); + _internal_mutable_struct_value()->::PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value()); break; } case kListValue: { - _internal_mutable_list_value()->PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value()); + _internal_mutable_list_value()->::PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value()); break; } case KIND_NOT_SET: { @@ -587,15 +586,17 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_null_value(static_cast<PROTOBUF_NAMESPACE_ID::NullValue>(val)); - } else goto handle_unusual; + _internal_set_null_value(static_cast<::PROTOBUF_NAMESPACE_ID::NullValue>(val)); + } else + goto handle_unusual; continue; // double number_value = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) { _internal_set_number_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr)); ptr += sizeof(double); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string string_value = 3; case 3: @@ -604,49 +605,53 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Value.string_value")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bool bool_value = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { _internal_set_bool_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Struct struct_value = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_struct_value(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.ListValue list_value = 6; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { ptr = ctx->ParseMessage(_internal_mutable_list_value(), ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -759,13 +764,7 @@ size_t Value::ByteSizeLong() const { break; } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Value::_class_data_ = { @@ -774,8 +773,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Value::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Value::GetClassData() const { return &_class_data_; } -void Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Value *>(to)->MergeFrom( static_cast<const Value &>(from)); } @@ -805,11 +804,11 @@ void Value::MergeFrom(const Value& from) { break; } case kStructValue: { - _internal_mutable_struct_value()->PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value()); + _internal_mutable_struct_value()->::PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value()); break; } case kListValue: { - _internal_mutable_list_value()->PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value()); + _internal_mutable_list_value()->::PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value()); break; } case KIND_NOT_SET: { @@ -916,28 +915,29 @@ const char* ListValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -978,13 +978,7 @@ size_t ListValue::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ListValue::_class_data_ = { @@ -993,8 +987,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ListValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ListValue::GetClassData() const { return &_class_data_; } -void ListValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void ListValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<ListValue *>(to)->MergeFrom( static_cast<const ListValue &>(from)); } @@ -1036,17 +1030,17 @@ void ListValue::InternalSwap(ListValue* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Struct >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Struct >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Struct >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Value >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Value* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Value >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Value >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::ListValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ListValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::ListValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::ListValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::ListValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::ListValue >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.pb.h b/contrib/libs/protobuf/src/google/protobuf/struct.pb.h index 3db06d3258..53e6120f40 100644 --- a/contrib/libs/protobuf/src/google/protobuf/struct.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/struct.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -72,10 +72,10 @@ struct ValueDefaultTypeInternal; PROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::ListValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ListValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Struct>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Value>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::ListValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::ListValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Struct>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Value>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -106,12 +106,12 @@ inline bool NullValue_Parse( // =================================================================== class Struct_FieldsEntry_DoNotUse : public ::PROTOBUF_NAMESPACE_ID::internal::MapEntry<Struct_FieldsEntry_DoNotUse, - TProtoStringType, PROTOBUF_NAMESPACE_ID::Value, + TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> { public: typedef ::PROTOBUF_NAMESPACE_ID::internal::MapEntry<Struct_FieldsEntry_DoNotUse, - TProtoStringType, PROTOBUF_NAMESPACE_ID::Value, + TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> SuperType; Struct_FieldsEntry_DoNotUse(); @@ -149,7 +149,11 @@ class PROTOBUF_EXPORT Struct final : } inline Struct& operator=(Struct&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -207,7 +211,7 @@ class PROTOBUF_EXPORT Struct final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Struct& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -255,14 +259,14 @@ class PROTOBUF_EXPORT Struct final : public: void clear_fields(); private: - const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >& + const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >& _internal_fields() const; - ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >* + ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >* _internal_mutable_fields(); public: - const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >& + const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >& fields() const; - ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >* + ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >* mutable_fields(); // @@protoc_insertion_point(class_scope:google.protobuf.Struct) @@ -274,7 +278,7 @@ class PROTOBUF_EXPORT Struct final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::MapField< Struct_FieldsEntry_DoNotUse, - TProtoStringType, PROTOBUF_NAMESPACE_ID::Value, + TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_STRING, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_MESSAGE> fields_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; @@ -301,7 +305,11 @@ class PROTOBUF_EXPORT Value final : } inline Value& operator=(Value&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -369,7 +377,7 @@ class PROTOBUF_EXPORT Value final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Value& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -420,11 +428,11 @@ class PROTOBUF_EXPORT Value final : bool _internal_has_null_value() const; public: void clear_null_value(); - PROTOBUF_NAMESPACE_ID::NullValue null_value() const; - void set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value); + ::PROTOBUF_NAMESPACE_ID::NullValue null_value() const; + void set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value); private: - PROTOBUF_NAMESPACE_ID::NullValue _internal_null_value() const; - void _internal_set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value); + ::PROTOBUF_NAMESPACE_ID::NullValue _internal_null_value() const; + void _internal_set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value); public: // double number_value = 2; @@ -477,17 +485,17 @@ class PROTOBUF_EXPORT Value final : bool _internal_has_struct_value() const; public: void clear_struct_value(); - const PROTOBUF_NAMESPACE_ID::Struct& struct_value() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::Struct* release_struct_value(); - PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value(); - void set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value); + const ::PROTOBUF_NAMESPACE_ID::Struct& struct_value() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::Struct* release_struct_value(); + ::PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value(); + void set_allocated_struct_value(::PROTOBUF_NAMESPACE_ID::Struct* struct_value); private: - const PROTOBUF_NAMESPACE_ID::Struct& _internal_struct_value() const; - PROTOBUF_NAMESPACE_ID::Struct* _internal_mutable_struct_value(); + const ::PROTOBUF_NAMESPACE_ID::Struct& _internal_struct_value() const; + ::PROTOBUF_NAMESPACE_ID::Struct* _internal_mutable_struct_value(); public: void unsafe_arena_set_allocated_struct_value( - PROTOBUF_NAMESPACE_ID::Struct* struct_value); - PROTOBUF_NAMESPACE_ID::Struct* unsafe_arena_release_struct_value(); + ::PROTOBUF_NAMESPACE_ID::Struct* struct_value); + ::PROTOBUF_NAMESPACE_ID::Struct* unsafe_arena_release_struct_value(); // .google.protobuf.ListValue list_value = 6; bool has_list_value() const; @@ -495,17 +503,17 @@ class PROTOBUF_EXPORT Value final : bool _internal_has_list_value() const; public: void clear_list_value(); - const PROTOBUF_NAMESPACE_ID::ListValue& list_value() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ListValue* release_list_value(); - PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value(); - void set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value); + const ::PROTOBUF_NAMESPACE_ID::ListValue& list_value() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ListValue* release_list_value(); + ::PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value(); + void set_allocated_list_value(::PROTOBUF_NAMESPACE_ID::ListValue* list_value); private: - const PROTOBUF_NAMESPACE_ID::ListValue& _internal_list_value() const; - PROTOBUF_NAMESPACE_ID::ListValue* _internal_mutable_list_value(); + const ::PROTOBUF_NAMESPACE_ID::ListValue& _internal_list_value() const; + ::PROTOBUF_NAMESPACE_ID::ListValue* _internal_mutable_list_value(); public: void unsafe_arena_set_allocated_list_value( - PROTOBUF_NAMESPACE_ID::ListValue* list_value); - PROTOBUF_NAMESPACE_ID::ListValue* unsafe_arena_release_list_value(); + ::PROTOBUF_NAMESPACE_ID::ListValue* list_value); + ::PROTOBUF_NAMESPACE_ID::ListValue* unsafe_arena_release_list_value(); void clear_kind(); KindCase kind_case() const; @@ -532,8 +540,8 @@ class PROTOBUF_EXPORT Value final : double number_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_value_; bool bool_value_; - PROTOBUF_NAMESPACE_ID::Struct* struct_value_; - PROTOBUF_NAMESPACE_ID::ListValue* list_value_; + ::PROTOBUF_NAMESPACE_ID::Struct* struct_value_; + ::PROTOBUF_NAMESPACE_ID::ListValue* list_value_; } kind_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1]; @@ -561,7 +569,11 @@ class PROTOBUF_EXPORT ListValue final : } inline ListValue& operator=(ListValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -619,7 +631,7 @@ class PROTOBUF_EXPORT ListValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const ListValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -665,16 +677,16 @@ class PROTOBUF_EXPORT ListValue final : int _internal_values_size() const; public: void clear_values(); - PROTOBUF_NAMESPACE_ID::Value* mutable_values(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >* + ::PROTOBUF_NAMESPACE_ID::Value* mutable_values(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >* mutable_values(); private: - const PROTOBUF_NAMESPACE_ID::Value& _internal_values(int index) const; - PROTOBUF_NAMESPACE_ID::Value* _internal_add_values(); + const ::PROTOBUF_NAMESPACE_ID::Value& _internal_values(int index) const; + ::PROTOBUF_NAMESPACE_ID::Value* _internal_add_values(); public: - const PROTOBUF_NAMESPACE_ID::Value& values(int index) const; - PROTOBUF_NAMESPACE_ID::Value* add_values(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >& + const ::PROTOBUF_NAMESPACE_ID::Value& values(int index) const; + ::PROTOBUF_NAMESPACE_ID::Value* add_values(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >& values() const; // @@protoc_insertion_point(class_scope:google.protobuf.ListValue) @@ -684,7 +696,7 @@ class PROTOBUF_EXPORT ListValue final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value > values_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value > values_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; }; @@ -711,20 +723,20 @@ inline int Struct::fields_size() const { inline void Struct::clear_fields() { fields_.Clear(); } -inline const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >& +inline const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >& Struct::_internal_fields() const { return fields_.GetMap(); } -inline const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >& +inline const ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >& Struct::fields() const { // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) return _internal_fields(); } -inline ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >* +inline ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >* Struct::_internal_mutable_fields() { return fields_.MutableMap(); } -inline ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, PROTOBUF_NAMESPACE_ID::Value >* +inline ::PROTOBUF_NAMESPACE_ID::Map< TProtoStringType, ::PROTOBUF_NAMESPACE_ID::Value >* Struct::mutable_fields() { // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) return _internal_mutable_fields(); @@ -750,24 +762,24 @@ inline void Value::clear_null_value() { clear_has_kind(); } } -inline PROTOBUF_NAMESPACE_ID::NullValue Value::_internal_null_value() const { +inline ::PROTOBUF_NAMESPACE_ID::NullValue Value::_internal_null_value() const { if (_internal_has_null_value()) { - return static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(kind_.null_value_); + return static_cast< ::PROTOBUF_NAMESPACE_ID::NullValue >(kind_.null_value_); } - return static_cast< PROTOBUF_NAMESPACE_ID::NullValue >(0); + return static_cast< ::PROTOBUF_NAMESPACE_ID::NullValue >(0); } -inline PROTOBUF_NAMESPACE_ID::NullValue Value::null_value() const { +inline ::PROTOBUF_NAMESPACE_ID::NullValue Value::null_value() const { // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) return _internal_null_value(); } -inline void Value::_internal_set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { +inline void Value::_internal_set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value) { if (!_internal_has_null_value()) { clear_kind(); set_has_null_value(); } kind_.null_value_ = value; } -inline void Value::set_null_value(PROTOBUF_NAMESPACE_ID::NullValue value) { +inline void Value::set_null_value(::PROTOBUF_NAMESPACE_ID::NullValue value) { _internal_set_null_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) } @@ -948,11 +960,11 @@ inline void Value::clear_struct_value() { clear_has_kind(); } } -inline PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() { +inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value) if (_internal_has_struct_value()) { clear_has_kind(); - PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_; + ::PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } @@ -962,27 +974,27 @@ inline PROTOBUF_NAMESPACE_ID::Struct* Value::release_struct_value() { return nullptr; } } -inline const PROTOBUF_NAMESPACE_ID::Struct& Value::_internal_struct_value() const { +inline const ::PROTOBUF_NAMESPACE_ID::Struct& Value::_internal_struct_value() const { return _internal_has_struct_value() ? *kind_.struct_value_ - : reinterpret_cast< PROTOBUF_NAMESPACE_ID::Struct&>(PROTOBUF_NAMESPACE_ID::_Struct_default_instance_); + : reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::Struct&>(::PROTOBUF_NAMESPACE_ID::_Struct_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::Struct& Value::struct_value() const { +inline const ::PROTOBUF_NAMESPACE_ID::Struct& Value::struct_value() const { // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) return _internal_struct_value(); } -inline PROTOBUF_NAMESPACE_ID::Struct* Value::unsafe_arena_release_struct_value() { +inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::unsafe_arena_release_struct_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.struct_value) if (_internal_has_struct_value()) { clear_has_kind(); - PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_; + ::PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_; kind_.struct_value_ = nullptr; return temp; } else { return nullptr; } } -inline void Value::unsafe_arena_set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value) { +inline void Value::unsafe_arena_set_allocated_struct_value(::PROTOBUF_NAMESPACE_ID::Struct* struct_value) { clear_kind(); if (struct_value) { set_has_struct_value(); @@ -990,16 +1002,16 @@ inline void Value::unsafe_arena_set_allocated_struct_value(PROTOBUF_NAMESPACE_ID } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.struct_value) } -inline PROTOBUF_NAMESPACE_ID::Struct* Value::_internal_mutable_struct_value() { +inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::_internal_mutable_struct_value() { if (!_internal_has_struct_value()) { clear_kind(); set_has_struct_value(); - kind_.struct_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct >(GetArenaForAllocation()); + kind_.struct_value_ = CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Struct >(GetArenaForAllocation()); } return kind_.struct_value_; } -inline PROTOBUF_NAMESPACE_ID::Struct* Value::mutable_struct_value() { - PROTOBUF_NAMESPACE_ID::Struct* _msg = _internal_mutable_struct_value(); +inline ::PROTOBUF_NAMESPACE_ID::Struct* Value::mutable_struct_value() { + ::PROTOBUF_NAMESPACE_ID::Struct* _msg = _internal_mutable_struct_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) return _msg; } @@ -1022,11 +1034,11 @@ inline void Value::clear_list_value() { clear_has_kind(); } } -inline PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() { +inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value) if (_internal_has_list_value()) { clear_has_kind(); - PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_; + ::PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } @@ -1036,27 +1048,27 @@ inline PROTOBUF_NAMESPACE_ID::ListValue* Value::release_list_value() { return nullptr; } } -inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::_internal_list_value() const { +inline const ::PROTOBUF_NAMESPACE_ID::ListValue& Value::_internal_list_value() const { return _internal_has_list_value() ? *kind_.list_value_ - : reinterpret_cast< PROTOBUF_NAMESPACE_ID::ListValue&>(PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_); + : reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::ListValue&>(::PROTOBUF_NAMESPACE_ID::_ListValue_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::ListValue& Value::list_value() const { +inline const ::PROTOBUF_NAMESPACE_ID::ListValue& Value::list_value() const { // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) return _internal_list_value(); } -inline PROTOBUF_NAMESPACE_ID::ListValue* Value::unsafe_arena_release_list_value() { +inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::unsafe_arena_release_list_value() { // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.list_value) if (_internal_has_list_value()) { clear_has_kind(); - PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_; + ::PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_; kind_.list_value_ = nullptr; return temp; } else { return nullptr; } } -inline void Value::unsafe_arena_set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value) { +inline void Value::unsafe_arena_set_allocated_list_value(::PROTOBUF_NAMESPACE_ID::ListValue* list_value) { clear_kind(); if (list_value) { set_has_list_value(); @@ -1064,16 +1076,16 @@ inline void Value::unsafe_arena_set_allocated_list_value(PROTOBUF_NAMESPACE_ID:: } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.list_value) } -inline PROTOBUF_NAMESPACE_ID::ListValue* Value::_internal_mutable_list_value() { +inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::_internal_mutable_list_value() { if (!_internal_has_list_value()) { clear_kind(); set_has_list_value(); - kind_.list_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ListValue >(GetArenaForAllocation()); + kind_.list_value_ = CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::ListValue >(GetArenaForAllocation()); } return kind_.list_value_; } -inline PROTOBUF_NAMESPACE_ID::ListValue* Value::mutable_list_value() { - PROTOBUF_NAMESPACE_ID::ListValue* _msg = _internal_mutable_list_value(); +inline ::PROTOBUF_NAMESPACE_ID::ListValue* Value::mutable_list_value() { + ::PROTOBUF_NAMESPACE_ID::ListValue* _msg = _internal_mutable_list_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) return _msg; } @@ -1101,31 +1113,31 @@ inline int ListValue::values_size() const { inline void ListValue::clear_values() { values_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Value* ListValue::mutable_values(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Value* ListValue::mutable_values(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values) return values_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >* ListValue::mutable_values() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) return &values_; } -inline const PROTOBUF_NAMESPACE_ID::Value& ListValue::_internal_values(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Value& ListValue::_internal_values(int index) const { return values_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Value& ListValue::values(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Value& ListValue::values(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) return _internal_values(index); } -inline PROTOBUF_NAMESPACE_ID::Value* ListValue::_internal_add_values() { +inline ::PROTOBUF_NAMESPACE_ID::Value* ListValue::_internal_add_values() { return values_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Value* ListValue::add_values() { - PROTOBUF_NAMESPACE_ID::Value* _add = _internal_add_values(); +inline ::PROTOBUF_NAMESPACE_ID::Value* ListValue::add_values() { + ::PROTOBUF_NAMESPACE_ID::Value* _add = _internal_add_values(); // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Value >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Value >& ListValue::values() const { // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values) return values_; @@ -1147,10 +1159,10 @@ PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::NullValue> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::NullValue> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::NullValue>() { - return PROTOBUF_NAMESPACE_ID::NullValue_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::NullValue>() { + return ::PROTOBUF_NAMESPACE_ID::NullValue_descriptor(); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/common.h b/contrib/libs/protobuf/src/google/protobuf/stubs/common.h index e4fae2d68e..d9bb76d731 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/common.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/common.h @@ -84,7 +84,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3017003 +#define GOOGLE_PROTOBUF_VERSION 3018001 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" @@ -92,15 +92,15 @@ namespace internal { // The minimum header version which works with the current version of // the library. This constant should only be used by protoc's C++ code // generator. -static const int kMinHeaderVersionForLibrary = 3017000; +static const int kMinHeaderVersionForLibrary = 3018000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3017000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3018000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 3017000; +static const int kMinHeaderVersionForProtoc = 3018000; // Verifies that the headers and libraries are compatible. Use the macro // below to call this. @@ -178,7 +178,7 @@ class FatalException : public std::exception { : filename_(filename), line_(line), message_(message) {} virtual ~FatalException() throw(); - virtual const char* what() const throw(); + virtual const char* what() const throw() override; const char* filename() const { return filename_; } int line() const { return line_; } diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h b/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h index 79c9f67848..5c025b1496 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h @@ -52,10 +52,12 @@ __attribute__((acquire_capability(__VA_ARGS__))) #define GOOGLE_PROTOBUF_RELEASE(...) \ __attribute__((release_capability(__VA_ARGS__))) +#define GOOGLE_PROTOBUF_SCOPED_CAPABILITY __attribute__((scoped_lockable)) #define GOOGLE_PROTOBUF_CAPABILITY(x) __attribute__((capability(x))) #else #define GOOGLE_PROTOBUF_ACQUIRE(...) #define GOOGLE_PROTOBUF_RELEASE(...) +#define GOOGLE_PROTOBUF_SCOPED_CAPABILITY #define GOOGLE_PROTOBUF_CAPABILITY(x) #endif @@ -140,10 +142,12 @@ class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex { using Mutex = WrappedMutex; // MutexLock(mu) acquires mu when constructed and releases it when destroyed. -class PROTOBUF_EXPORT MutexLock { +class GOOGLE_PROTOBUF_SCOPED_CAPABILITY PROTOBUF_EXPORT MutexLock { public: - explicit MutexLock(Mutex *mu) : mu_(mu) { this->mu_->Lock(); } - ~MutexLock() { this->mu_->Unlock(); } + explicit MutexLock(Mutex *mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) { + this->mu_->Lock(); + } + ~MutexLock() GOOGLE_PROTOBUF_RELEASE() { this->mu_->Unlock(); } private: Mutex *const mu_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock); diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/stl_util.h b/contrib/libs/protobuf/src/google/protobuf/stubs/stl_util.h index 9a9ff97202..7b44c9593f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/stl_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/stl_util.h @@ -35,6 +35,8 @@ #include <google/protobuf/stubs/common.h> +#include <algorithm> + namespace google { namespace protobuf { @@ -48,6 +50,18 @@ inline void STLStringResizeUninitialized(TProtoStringType* s, size_t new_size) { s->ReserveAndResize(new_size); } +// As above, but we make sure to follow amortized growth in which we always +// increase the capacity by at least a constant factor >1. +inline void STLStringResizeUninitializedAmortized(TProtoStringType* s, + size_t new_size) { + const size_t cap = s->capacity(); + if (new_size > cap) { + // Make sure to always grow by at least a factor of 2x. + s->reserve(std::max(new_size, 2 * cap)); + } + STLStringResizeUninitialized(s, new_size); +} + // Return a mutable char* pointing to a string's internal buffer, // which may not be null-terminated. Writing through this pointer will // modify the string. diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/stringpiece.h b/contrib/libs/protobuf/src/google/protobuf/stubs/stringpiece.h index dde25c97ed..44a296bd8d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/stringpiece.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/stringpiece.h @@ -216,7 +216,7 @@ class PROTOBUF_EXPORT StringPiece { : ptr_(str.data()), length_(str.size()) { } - + #if defined(__cpp_lib_string_view) StringPiece( // NOLINT(runtime/explicit) std::string_view str) @@ -224,7 +224,6 @@ class PROTOBUF_EXPORT StringPiece { length_ = CheckSize(str.size()); } #endif - StringPiece(const char* offset, size_type len) : ptr_(offset), length_(CheckSize(len)) {} diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc index 9cb53a08a8..7a09e582cb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc @@ -1287,7 +1287,7 @@ static int memcasecmp(const char *s1, const char *s2, size_t len) { const unsigned char *us1 = reinterpret_cast<const unsigned char *>(s1); const unsigned char *us2 = reinterpret_cast<const unsigned char *>(s2); - for ( int i = 0; i < len; i++ ) { + for (size_t i = 0; i < len; i++) { const int diff = static_cast<int>(static_cast<unsigned char>(ascii_tolower(us1[i]))) - static_cast<int>(static_cast<unsigned char>(ascii_tolower(us2[i]))); @@ -2101,7 +2101,7 @@ int Base64EscapeInternal(const unsigned char *src, int szsrc, char *limit_dest = dest + szdest; const unsigned char *limit_src = src + szsrc; - // Three bytes of data encodes to four characters of cyphertext. + // Three bytes of data encodes to four characters of ciphertext. // So we can pump through three-byte chunks atomically. while (cur_src < limit_src - 3) { // keep going as long as we have >= 32 bits uint32 in = BigEndian::Load32(cur_src) >> 8; @@ -2128,7 +2128,7 @@ int Base64EscapeInternal(const unsigned char *src, int szsrc, break; case 1: { // One byte left: this encodes to two characters, and (optionally) - // two pad characters to round out the four-character cypherblock. + // two pad characters to round out the four-character cipherblock. if ((szdest -= 2) < 0) return 0; uint32 in = cur_src[0]; cur_dest[0] = base64[in >> 2]; @@ -2145,7 +2145,7 @@ int Base64EscapeInternal(const unsigned char *src, int szsrc, } case 2: { // Two bytes left: this encodes to three characters, and (optionally) - // one pad character to round out the four-character cypherblock. + // one pad character to round out the four-character cipherblock. if ((szdest -= 3) < 0) return 0; uint32 in = BigEndian::Load16(cur_src); cur_dest[0] = base64[in >> 10]; diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.cc b/contrib/libs/protobuf/src/google/protobuf/text_format.cc index 74d01b885e..d92e99dc0d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.cc @@ -129,8 +129,8 @@ void Message::PrintDebugString() const { printf("%s", DebugString().c_str()); } // =========================================================================== // Implementation of the parse information tree class. void TextFormat::ParseInfoTree::RecordLocation( - const FieldDescriptor* field, TextFormat::ParseLocation location) { - locations_[field].push_back(location); + const FieldDescriptor* field, TextFormat::ParseLocationRange range) { + locations_[field].push_back(range); } TextFormat::ParseInfoTree* TextFormat::ParseInfoTree::CreateNested( @@ -155,17 +155,18 @@ void CheckFieldIndex(const FieldDescriptor* field, int index) { } } -TextFormat::ParseLocation TextFormat::ParseInfoTree::GetLocation( +TextFormat::ParseLocationRange TextFormat::ParseInfoTree::GetLocationRange( const FieldDescriptor* field, int index) const { CheckFieldIndex(field, index); if (index == -1) { index = 0; } - const std::vector<TextFormat::ParseLocation>* locations = + const std::vector<TextFormat::ParseLocationRange>* locations = FindOrNull(locations_, field); - if (locations == nullptr || index >= static_cast<int64>(locations->size())) { - return TextFormat::ParseLocation(); + if (locations == nullptr || + index >= static_cast<int64_t>(locations->size())) { + return TextFormat::ParseLocationRange(); } return (*locations)[index]; @@ -179,7 +180,7 @@ TextFormat::ParseInfoTree* TextFormat::ParseInfoTree::GetTreeForNested( } auto it = nested_.find(field); - if (it == nested_.end() || index >= static_cast<int64>(it->second.size())) { + if (it == nested_.end() || index >= static_cast<int64_t>(it->second.size())) { return nullptr; } @@ -458,7 +459,7 @@ class TextFormat::Parser::ParserImpl { } else { DO(ConsumeIdentifier(&field_name)); - int32 field_number; + int32_t field_number; if (allow_field_number_ && safe_strto32(field_name, &field_number)) { if (descriptor->IsExtensionNumber(field_number)) { field = finder_ @@ -615,8 +616,12 @@ class TextFormat::Parser::ParserImpl { // If a parse info tree exists, add the location for the parsed // field. if (parse_info_tree_ != nullptr) { + int end_line = tokenizer_.previous().line; + int end_column = tokenizer_.previous().end_column; + RecordLocation(parse_info_tree_, field, - ParseLocation(start_line, start_column)); + ParseLocationRange(ParseLocation(start_line, start_column), + ParseLocation(end_line, end_column))); } return true; @@ -721,28 +726,28 @@ class TextFormat::Parser::ParserImpl { switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: { - int64 value; + int64_t value; DO(ConsumeSignedInteger(&value, kint32max)); - SET_FIELD(Int32, static_cast<int32>(value)); + SET_FIELD(Int32, static_cast<int32_t>(value)); break; } case FieldDescriptor::CPPTYPE_UINT32: { - uint64 value; + uint64_t value; DO(ConsumeUnsignedInteger(&value, kuint32max)); - SET_FIELD(UInt32, static_cast<uint32>(value)); + SET_FIELD(UInt32, static_cast<uint32_t>(value)); break; } case FieldDescriptor::CPPTYPE_INT64: { - int64 value; + int64_t value; DO(ConsumeSignedInteger(&value, kint64max)); SET_FIELD(Int64, value); break; } case FieldDescriptor::CPPTYPE_UINT64: { - uint64 value; + uint64_t value; DO(ConsumeUnsignedInteger(&value, kuint64max)); SET_FIELD(UInt64, value); break; @@ -771,7 +776,7 @@ class TextFormat::Parser::ParserImpl { case FieldDescriptor::CPPTYPE_BOOL: { if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) { - uint64 value; + uint64_t value; DO(ConsumeUnsignedInteger(&value, 1)); SET_FIELD(Bool, value); } else { @@ -792,7 +797,7 @@ class TextFormat::Parser::ParserImpl { case FieldDescriptor::CPPTYPE_ENUM: { TProtoStringType value; - int64 int_value = kint64max; + int64_t int_value = kint64max; const EnumDescriptor* enum_type = field->enum_type(); const EnumValueDescriptor* enum_value = nullptr; @@ -1001,9 +1006,9 @@ class TextFormat::Parser::ParserImpl { return true; } - // Consumes a uint64 and saves its value in the value parameter. + // Consumes a uint64_t and saves its value in the value parameter. // Returns false if the token is not of type INTEGER. - bool ConsumeUnsignedInteger(uint64* value, uint64 max_value) { + bool ConsumeUnsignedInteger(uint64_t* value, uint64_t max_value) { if (!LookingAtType(io::Tokenizer::TYPE_INTEGER)) { ReportError("Expected integer, got: " + tokenizer_.current().text); return false; @@ -1019,12 +1024,12 @@ class TextFormat::Parser::ParserImpl { return true; } - // Consumes an int64 and saves its value in the value parameter. + // Consumes an int64_t and saves its value in the value parameter. // Note that since the tokenizer does not support negative numbers, // we actually may consume an additional token (for the minus sign) in this // method. Returns false if the token is not an integer // (signed or otherwise). - bool ConsumeSignedInteger(int64* value, uint64 max_value) { + bool ConsumeSignedInteger(int64_t* value, uint64_t max_value) { bool negative = false; if (TryConsume("-")) { @@ -1034,18 +1039,18 @@ class TextFormat::Parser::ParserImpl { ++max_value; } - uint64 unsigned_value; + uint64_t unsigned_value; DO(ConsumeUnsignedInteger(&unsigned_value, max_value)); if (negative) { - if ((static_cast<uint64>(kint64max) + 1) == unsigned_value) { + if ((static_cast<uint64_t>(kint64max) + 1) == unsigned_value) { *value = kint64min; } else { - *value = -static_cast<int64>(unsigned_value); + *value = -static_cast<int64_t>(unsigned_value); } } else { - *value = static_cast<int64>(unsigned_value); + *value = static_cast<int64_t>(unsigned_value); } return true; @@ -1053,7 +1058,7 @@ class TextFormat::Parser::ParserImpl { // Consumes a double and saves its value in the value parameter. // Accepts decimal numbers only, rejects hex or oct numbers. - bool ConsumeUnsignedDecimalAsDouble(double* value, uint64 max_value) { + bool ConsumeUnsignedDecimalAsDouble(double* value, uint64_t max_value) { if (!LookingAtType(io::Tokenizer::TYPE_INTEGER)) { ReportError("Expected integer, got: " + tokenizer_.current().text); return false; @@ -1065,7 +1070,7 @@ class TextFormat::Parser::ParserImpl { return false; } - uint64 uint64_value; + uint64_t uint64_value; if (io::Tokenizer::ParseInteger(text, max_value, &uint64_value)) { *value = static_cast<double>(uint64_value); } else { @@ -1357,7 +1362,7 @@ class TextFormat::Printer::TextGenerator if (failed_) return; } - while (static_cast<int64>(size) > buffer_size_) { + while (static_cast<int64_t>(size) > buffer_size_) { // Data exceeds space in the buffer. Copy what we can and request a // new buffer. if (buffer_size_ > 0) { @@ -1514,8 +1519,9 @@ bool CheckParseInputSize(StringPiece input, if (input.size() > INT_MAX) { error_collector->AddError( -1, 0, - StrCat("Input size too large: ", static_cast<int64>(input.size()), - " bytes", " > ", INT_MAX, " bytes.")); + StrCat( + "Input size too large: ", static_cast<int64_t>(input.size()), + " bytes", " > ", INT_MAX, " bytes.")); return false; } return true; @@ -1666,10 +1672,10 @@ TextFormat::FieldValuePrinter::~FieldValuePrinter() {} TProtoStringType TextFormat::FieldValuePrinter::PrintBool(bool val) const { FORWARD_IMPL(PrintBool, val); } -TProtoStringType TextFormat::FieldValuePrinter::PrintInt32(int32 val) const { +TProtoStringType TextFormat::FieldValuePrinter::PrintInt32(int32_t val) const { FORWARD_IMPL(PrintInt32, val); } -TProtoStringType TextFormat::FieldValuePrinter::PrintUInt32(uint32 val) const { +TProtoStringType TextFormat::FieldValuePrinter::PrintUInt32(uint32_t val) const { FORWARD_IMPL(PrintUInt32, val); } TProtoStringType TextFormat::FieldValuePrinter::PrintInt64(int64 val) const { @@ -1693,7 +1699,7 @@ TProtoStringType TextFormat::FieldValuePrinter::PrintBytes( return PrintString(val); } TProtoStringType TextFormat::FieldValuePrinter::PrintEnum( - int32 val, const TProtoStringType& name) const { + int32_t val, const TProtoStringType& name) const { FORWARD_IMPL(PrintEnum, val, name); } TProtoStringType TextFormat::FieldValuePrinter::PrintFieldName( @@ -1726,11 +1732,11 @@ void TextFormat::FastFieldValuePrinter::PrintBool( } } void TextFormat::FastFieldValuePrinter::PrintInt32( - int32 val, BaseTextGenerator* generator) const { + int32_t val, BaseTextGenerator* generator) const { generator->PrintString(StrCat(val)); } void TextFormat::FastFieldValuePrinter::PrintUInt32( - uint32 val, BaseTextGenerator* generator) const { + uint32_t val, BaseTextGenerator* generator) const { generator->PrintString(StrCat(val)); } void TextFormat::FastFieldValuePrinter::PrintInt64( @@ -1750,7 +1756,7 @@ void TextFormat::FastFieldValuePrinter::PrintDouble( generator->PrintString(!std::isnan(val) ? SimpleDtoa(val) : "nan"); } void TextFormat::FastFieldValuePrinter::PrintEnum( - int32 val, const TProtoStringType& name, BaseTextGenerator* generator) const { + int32_t val, const TProtoStringType& name, BaseTextGenerator* generator) const { generator->PrintString(name); } @@ -1825,11 +1831,11 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter { TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintBool(val)); } - void PrintInt32(int32 val, + void PrintInt32(int32_t val, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintInt32(val)); } - void PrintUInt32(uint32 val, + void PrintUInt32(uint32_t val, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintUInt32(val)); } @@ -1857,7 +1863,7 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter { TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintBytes(val)); } - void PrintEnum(int32 val, const TProtoStringType& name, + void PrintEnum(int32_t val, const TProtoStringType& name, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintEnum(val, name)); } @@ -2160,23 +2166,23 @@ class MapEntryMessageComparator { return first < second; } case FieldDescriptor::CPPTYPE_INT32: { - int32 first = reflection->GetInt32(*a, field_); - int32 second = reflection->GetInt32(*b, field_); + int32_t first = reflection->GetInt32(*a, field_); + int32_t second = reflection->GetInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_INT64: { - int64 first = reflection->GetInt64(*a, field_); - int64 second = reflection->GetInt64(*b, field_); + int64_t first = reflection->GetInt64(*a, field_); + int64_t second = reflection->GetInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT32: { - uint32 first = reflection->GetUInt32(*a, field_); - uint32 second = reflection->GetUInt32(*b, field_); + uint32_t first = reflection->GetUInt32(*a, field_); + uint32_t second = reflection->GetUInt32(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_UINT64: { - uint64 first = reflection->GetUInt64(*a, field_); - uint64 second = reflection->GetUInt64(*b, field_); + uint64_t first = reflection->GetUInt64(*a, field_); + uint64_t second = reflection->GetUInt64(*b, field_); return first < second; } case FieldDescriptor::CPPTYPE_STRING: { @@ -2590,7 +2596,7 @@ void TextFormat::Printer::PrintUnknownFields( // budget when we attempt to parse the data. UnknownFieldSet parsing is // recursive because of groups. io::CodedInputStream input_stream( - reinterpret_cast<const uint8*>(value.data()), value.size()); + reinterpret_cast<const uint8_t*>(value.data()), value.size()); input_stream.SetRecursionLimit(recursion_budget); UnknownFieldSet embedded_unknown_fields; if (!value.empty() && recursion_budget > 0 && diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.h b/contrib/libs/protobuf/src/google/protobuf/text_format.h index 0b70f0640a..fd252be870 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.h @@ -126,8 +126,8 @@ class PROTOBUF_EXPORT TextFormat { FastFieldValuePrinter(); virtual ~FastFieldValuePrinter(); virtual void PrintBool(bool val, BaseTextGenerator* generator) const; - virtual void PrintInt32(int32 val, BaseTextGenerator* generator) const; - virtual void PrintUInt32(uint32 val, BaseTextGenerator* generator) const; + virtual void PrintInt32(int32_t val, BaseTextGenerator* generator) const; + virtual void PrintUInt32(uint32_t val, BaseTextGenerator* generator) const; virtual void PrintInt64(int64 val, BaseTextGenerator* generator) const; virtual void PrintUInt64(uint64 val, BaseTextGenerator* generator) const; virtual void PrintFloat(float val, BaseTextGenerator* generator) const; @@ -136,7 +136,7 @@ class PROTOBUF_EXPORT TextFormat { BaseTextGenerator* generator) const; virtual void PrintBytes(const TProtoStringType& val, BaseTextGenerator* generator) const; - virtual void PrintEnum(int32 val, const TProtoStringType& name, + virtual void PrintEnum(int32_t val, const TProtoStringType& name, BaseTextGenerator* generator) const; virtual void PrintFieldName(const Message& message, int field_index, int field_count, const Reflection* reflection, @@ -171,15 +171,15 @@ class PROTOBUF_EXPORT TextFormat { FieldValuePrinter(); virtual ~FieldValuePrinter(); virtual TProtoStringType PrintBool(bool val) const; - virtual TProtoStringType PrintInt32(int32 val) const; - virtual TProtoStringType PrintUInt32(uint32 val) const; + virtual TProtoStringType PrintInt32(int32_t val) const; + virtual TProtoStringType PrintUInt32(uint32_t val) const; virtual TProtoStringType PrintInt64(int64 val) const; virtual TProtoStringType PrintUInt64(uint64 val) const; virtual TProtoStringType PrintFloat(float val) const; virtual TProtoStringType PrintDouble(double val) const; virtual TProtoStringType PrintString(const TProtoStringType& val) const; virtual TProtoStringType PrintBytes(const TProtoStringType& val) const; - virtual TProtoStringType PrintEnum(int32 val, const TProtoStringType& name) const; + virtual TProtoStringType PrintEnum(int32_t val, const TProtoStringType& name) const; virtual TProtoStringType PrintFieldName(const Message& message, const Reflection* reflection, const FieldDescriptor* field) const; @@ -341,7 +341,7 @@ class PROTOBUF_EXPORT TextFormat { // property of TextFormat::Printer. That is, from the printed message, we // cannot fully recover the original string field any more. void SetTruncateStringFieldLongerThan( - const int64 truncate_string_field_longer_than) { + const int64_t truncate_string_field_longer_than) { truncate_string_field_longer_than_ = truncate_string_field_longer_than; } @@ -431,7 +431,7 @@ class PROTOBUF_EXPORT TextFormat { bool hide_unknown_fields_; bool print_message_fields_in_index_order_; bool expand_any_; - int64 truncate_string_field_longer_than_; + int64_t truncate_string_field_longer_than_; std::unique_ptr<const FastFieldValuePrinter> default_field_value_printer_; typedef std::map<const FieldDescriptor*, @@ -488,6 +488,16 @@ class PROTOBUF_EXPORT TextFormat { : line(line_param), column(column_param) {} }; + // A range of locations in the parsed text, including `start` and excluding + // `end`. + struct ParseLocationRange { + ParseLocation start; + ParseLocation end; + ParseLocationRange() : start(), end() {} + ParseLocationRange(ParseLocation start_param, ParseLocation end_param) + : start(start_param), end(end_param) {} + }; + // Data structure which is populated with the locations of each field // value parsed from the text. class PROTOBUF_EXPORT ParseInfoTree { @@ -496,10 +506,18 @@ class PROTOBUF_EXPORT TextFormat { ParseInfoTree(const ParseInfoTree&) = delete; ParseInfoTree& operator=(const ParseInfoTree&) = delete; - // Returns the parse location for index-th value of the field in the parsed - // text. If none exists, returns a location with line = -1. Index should be - // -1 for not-repeated fields. - ParseLocation GetLocation(const FieldDescriptor* field, int index) const; + // Returns the parse location range for index-th value of the field in + // the parsed text. If none exists, returns a location with start and end + // line -1. Index should be -1 for not-repeated fields. + ParseLocationRange GetLocationRange(const FieldDescriptor* field, + int index) const; + + // Returns the starting parse location for index-th value of the field in + // the parsed text. If none exists, returns a location with line = -1. Index + // should be -1 for not-repeated fields. + ParseLocation GetLocation(const FieldDescriptor* field, int index) const { + return GetLocationRange(field, index).start; + } // Returns the parse info tree for the given field, which must be a message // type. The nested information tree is owned by the root tree and will be @@ -511,14 +529,14 @@ class PROTOBUF_EXPORT TextFormat { // Allow the text format parser to record information into the tree. friend class TextFormat; - // Records the starting location of a single value for a field. - void RecordLocation(const FieldDescriptor* field, ParseLocation location); + // Records the starting and ending locations of a single value for a field. + void RecordLocation(const FieldDescriptor* field, ParseLocationRange range); // Create and records a nested tree for a nested message field. ParseInfoTree* CreateNested(const FieldDescriptor* field); // Defines the map from the index-th field descriptor to its parse location. - typedef std::map<const FieldDescriptor*, std::vector<ParseLocation> > + typedef std::map<const FieldDescriptor*, std::vector<ParseLocationRange>> LocationMap; // Defines the map from the index-th field descriptor to the nested parse @@ -635,7 +653,7 @@ class PROTOBUF_EXPORT TextFormat { // helpers for ParserImpl to call methods of ParseInfoTree. static inline void RecordLocation(ParseInfoTree* info_tree, const FieldDescriptor* field, - ParseLocation location); + ParseLocationRange location); static inline ParseInfoTree* CreateNested(ParseInfoTree* info_tree, const FieldDescriptor* field); @@ -644,7 +662,7 @@ class PROTOBUF_EXPORT TextFormat { inline void TextFormat::RecordLocation(ParseInfoTree* info_tree, const FieldDescriptor* field, - ParseLocation location) { + ParseLocationRange location) { info_tree->RecordLocation(field, location); } diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc index c74a97372f..a7ab3b9b23 100644 --- a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc @@ -37,19 +37,20 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Timestamp, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Timestamp, seconds_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Timestamp, nanos_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, seconds_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, nanos_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Timestamp)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Timestamp)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Timestamp_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2ftimestamp_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -150,35 +151,37 @@ const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // int32 nanos = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -218,25 +221,15 @@ size_t Timestamp::ByteSizeLong() const { // int64 seconds = 1; if (this->_internal_seconds() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_seconds()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_seconds()); } // int32 nanos = 2; if (this->_internal_nanos() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_nanos()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_nanos()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Timestamp::_class_data_ = { @@ -245,8 +238,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Timestamp::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Timestamp::GetClassData() const { return &_class_data_; } -void Timestamp::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Timestamp::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Timestamp *>(to)->MergeFrom( static_cast<const Timestamp &>(from)); } @@ -298,8 +291,8 @@ void Timestamp::InternalSwap(Timestamp* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Timestamp >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Timestamp >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Timestamp >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Timestamp >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h index 8ea03e2c45..f5c7f9882d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -59,7 +59,7 @@ struct TimestampDefaultTypeInternal; PROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Timestamp>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Timestamp* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Timestamp>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -84,7 +84,11 @@ class PROTOBUF_EXPORT Timestamp final : } inline Timestamp& operator=(Timestamp&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -142,7 +146,7 @@ class PROTOBUF_EXPORT Timestamp final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Timestamp& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.cc b/contrib/libs/protobuf/src/google/protobuf/type.pb.cc index 1de2532e3b..7e8e795bd8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/type.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/type.pb.cc @@ -109,71 +109,76 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, fields_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, oneofs_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, source_context_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Type, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, fields_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, oneofs_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, source_context_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, syntax_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, kind_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, cardinality_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, number_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, type_url_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, oneof_index_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, packed_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, json_name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Field, default_value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, kind_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, cardinality_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, number_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, type_url_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, oneof_index_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, packed_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, json_name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Field, default_value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Enum, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Enum, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Enum, enumvalue_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Enum, options_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Enum, source_context_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Enum, syntax_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, enumvalue_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, options_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, source_context_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Enum, syntax_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValue, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValue, number_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::EnumValue, options_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, number_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::EnumValue, options_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Option, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Option, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Option, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Option, value_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::Type)}, - { 11, -1, sizeof(PROTOBUF_NAMESPACE_ID::Field)}, - { 26, -1, sizeof(PROTOBUF_NAMESPACE_ID::Enum)}, - { 36, -1, sizeof(PROTOBUF_NAMESPACE_ID::EnumValue)}, - { 44, -1, sizeof(PROTOBUF_NAMESPACE_ID::Option)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Type)}, + { 12, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Field)}, + { 28, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Enum)}, + { 39, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::EnumValue)}, + { 48, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Option)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Type_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Field_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Enum_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_EnumValue_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Option_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Type_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Field_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Enum_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_EnumValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Option_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2ftype_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -335,10 +340,10 @@ bool Syntax_IsValid(int value) { class Type::_Internal { public: - static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Type* msg); + static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Type* msg); }; -const PROTOBUF_NAMESPACE_ID::SourceContext& +const ::PROTOBUF_NAMESPACE_ID::SourceContext& Type::_Internal::source_context(const Type* msg) { return *msg->source_context_; } @@ -372,7 +377,7 @@ Type::Type(const Type& from) GetArenaForAllocation()); } if (from._internal_has_source_context()) { - source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); + source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; } @@ -442,7 +447,8 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Type.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Field fields = 2; case 2: @@ -454,7 +460,8 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated string oneofs = 3; case 3: @@ -468,7 +475,8 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 4; case 4: @@ -480,43 +488,46 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.SourceContext source_context = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Syntax syntax = 6; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_syntax(static_cast<PROTOBUF_NAMESPACE_ID::Syntax>(val)); - } else goto handle_unusual; + _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -635,13 +646,7 @@ size_t Type::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Type::_class_data_ = { @@ -650,8 +655,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Type::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Type::GetClassData() const { return &_class_data_; } -void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Type *>(to)->MergeFrom( static_cast<const Type &>(from)); } @@ -670,7 +675,7 @@ void Type::MergeFrom(const Type& from) { _internal_set_name(from._internal_name()); } if (from._internal_has_source_context()) { - _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); + _internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } if (from._internal_syntax() != 0) { _internal_set_syntax(from._internal_syntax()); @@ -691,14 +696,16 @@ bool Type::IsInitialized() const { void Type::InternalSwap(Type* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); fields_.InternalSwap(&other->fields_); oneofs_.InternalSwap(&other->oneofs_); options_.InternalSwap(&other->options_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(Type, syntax_) @@ -824,23 +831,26 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_kind(static_cast<PROTOBUF_NAMESPACE_ID::Field_Kind>(val)); - } else goto handle_unusual; + _internal_set_kind(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Kind>(val)); + } else + goto handle_unusual; continue; // .google.protobuf.Field.Cardinality cardinality = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_cardinality(static_cast<PROTOBUF_NAMESPACE_ID::Field_Cardinality>(val)); - } else goto handle_unusual; + _internal_set_cardinality(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Cardinality>(val)); + } else + goto handle_unusual; continue; // int32 number = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string name = 4; case 4: @@ -849,7 +859,8 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string type_url = 6; case 6: @@ -858,21 +869,24 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.type_url")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // int32 oneof_index = 7; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // bool packed = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 9; case 9: @@ -884,7 +898,8 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string json_name = 10; case 10: @@ -893,7 +908,8 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.json_name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // string default_value = 11; case 11: @@ -902,28 +918,29 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.default_value")); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1078,16 +1095,12 @@ size_t Field::ByteSizeLong() const { // int32 number = 3; if (this->_internal_number() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_number()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number()); } // int32 oneof_index = 7; if (this->_internal_oneof_index() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_oneof_index()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_oneof_index()); } // bool packed = 8; @@ -1095,13 +1108,7 @@ size_t Field::ByteSizeLong() const { total_size += 1 + 1; } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Field::_class_data_ = { @@ -1110,8 +1117,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Field::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Field::GetClassData() const { return &_class_data_; } -void Field::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Field::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Field *>(to)->MergeFrom( static_cast<const Field &>(from)); } @@ -1167,27 +1174,29 @@ bool Field::IsInitialized() const { void Field::InternalSwap(Field* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); options_.InternalSwap(&other->options_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &type_url_, GetArenaForAllocation(), - &other->type_url_, other->GetArenaForAllocation() + &type_url_, lhs_arena, + &other->type_url_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &json_name_, GetArenaForAllocation(), - &other->json_name_, other->GetArenaForAllocation() + &json_name_, lhs_arena, + &other->json_name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &default_value_, GetArenaForAllocation(), - &other->default_value_, other->GetArenaForAllocation() + &default_value_, lhs_arena, + &other->default_value_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(Field, packed_) @@ -1207,10 +1216,10 @@ void Field::InternalSwap(Field* other) { class Enum::_Internal { public: - static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Enum* msg); + static const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Enum* msg); }; -const PROTOBUF_NAMESPACE_ID::SourceContext& +const ::PROTOBUF_NAMESPACE_ID::SourceContext& Enum::_Internal::source_context(const Enum* msg) { return *msg->source_context_; } @@ -1242,7 +1251,7 @@ Enum::Enum(const Enum& from) GetArenaForAllocation()); } if (from._internal_has_source_context()) { - source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); + source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_); } else { source_context_ = nullptr; } @@ -1311,7 +1320,8 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Enum.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.EnumValue enumvalue = 2; case 2: @@ -1323,7 +1333,8 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 3; case 3: @@ -1335,43 +1346,46 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.SourceContext source_context = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Syntax syntax = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - _internal_set_syntax(static_cast<PROTOBUF_NAMESPACE_ID::Syntax>(val)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1472,13 +1486,7 @@ size_t Enum::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_syntax()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Enum::_class_data_ = { @@ -1487,8 +1495,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Enum::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Enum::GetClassData() const { return &_class_data_; } -void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Enum *>(to)->MergeFrom( static_cast<const Enum &>(from)); } @@ -1506,7 +1514,7 @@ void Enum::MergeFrom(const Enum& from) { _internal_set_name(from._internal_name()); } if (from._internal_has_source_context()) { - _internal_mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); + _internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context()); } if (from._internal_syntax() != 0) { _internal_set_syntax(from._internal_syntax()); @@ -1527,13 +1535,15 @@ bool Enum::IsInitialized() const { void Enum::InternalSwap(Enum* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); enumvalue_.InternalSwap(&other->enumvalue_); options_.InternalSwap(&other->options_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(Enum, syntax_) @@ -1630,14 +1640,16 @@ const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.EnumValue.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // int32 number = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.Option options = 3; case 3: @@ -1649,28 +1661,29 @@ const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1736,18 +1749,10 @@ size_t EnumValue::ByteSizeLong() const { // int32 number = 2; if (this->_internal_number() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_number()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValue::_class_data_ = { @@ -1756,8 +1761,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumValue::GetClassData() const { return &_class_data_; } -void EnumValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void EnumValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<EnumValue *>(to)->MergeFrom( static_cast<const EnumValue &>(from)); } @@ -1792,12 +1797,14 @@ bool EnumValue::IsInitialized() const { void EnumValue::InternalSwap(EnumValue* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); options_.InternalSwap(&other->options_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); swap(number_, other->number_); } @@ -1812,10 +1819,10 @@ void EnumValue::InternalSwap(EnumValue* other) { class Option::_Internal { public: - static const PROTOBUF_NAMESPACE_ID::Any& value(const Option* msg); + static const ::PROTOBUF_NAMESPACE_ID::Any& value(const Option* msg); }; -const PROTOBUF_NAMESPACE_ID::Any& +const ::PROTOBUF_NAMESPACE_ID::Any& Option::_Internal::value(const Option* msg) { return *msg->value_; } @@ -1843,7 +1850,7 @@ Option::Option(const Option& from) GetArenaForAllocation()); } if (from._internal_has_value()) { - value_ = new PROTOBUF_NAMESPACE_ID::Any(*from.value_); + value_ = new ::PROTOBUF_NAMESPACE_ID::Any(*from.value_); } else { value_ = nullptr; } @@ -1905,35 +1912,37 @@ const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Option.name")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // .google.protobuf.Any value = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { ptr = ctx->ParseMessage(_internal_mutable_value(), ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1991,13 +2000,7 @@ size_t Option::ByteSizeLong() const { *value_); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Option::_class_data_ = { @@ -2006,8 +2009,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Option::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Option::GetClassData() const { return &_class_data_; } -void Option::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Option::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Option *>(to)->MergeFrom( static_cast<const Option &>(from)); } @@ -2023,7 +2026,7 @@ void Option::MergeFrom(const Option& from) { _internal_set_name(from._internal_name()); } if (from._internal_has_value()) { - _internal_mutable_value()->PROTOBUF_NAMESPACE_ID::Any::MergeFrom(from._internal_value()); + _internal_mutable_value()->::PROTOBUF_NAMESPACE_ID::Any::MergeFrom(from._internal_value()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -2041,11 +2044,13 @@ bool Option::IsInitialized() const { void Option::InternalSwap(Option* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); swap(value_, other->value_); } @@ -2059,20 +2064,20 @@ void Option::InternalSwap(Option* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Type* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Type >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Type >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Type* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Type >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Type >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Field* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Field >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Field >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Field* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Field >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Field >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Enum* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Enum >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Enum >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Enum* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Enum >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Enum >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::EnumValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::EnumValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::EnumValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::EnumValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::EnumValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::EnumValue >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Option* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Option >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Option >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Option* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Option >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Option >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.h b/contrib/libs/protobuf/src/google/protobuf/type.pb.h index a99c06d180..d9ec25e0fa 100644 --- a/contrib/libs/protobuf/src/google/protobuf/type.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/type.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -74,11 +74,11 @@ struct TypeDefaultTypeInternal; PROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Enum* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Enum>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::EnumValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Field* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Field>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Option* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Option>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Type* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Type>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Enum* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Enum>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::EnumValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::EnumValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Field* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Field>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Option* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Option>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Type* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Type>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -197,7 +197,11 @@ class PROTOBUF_EXPORT Type final : } inline Type& operator=(Type&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -255,7 +259,7 @@ class PROTOBUF_EXPORT Type final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Type& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -306,16 +310,16 @@ class PROTOBUF_EXPORT Type final : int _internal_fields_size() const; public: void clear_fields(); - PROTOBUF_NAMESPACE_ID::Field* mutable_fields(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >* + ::PROTOBUF_NAMESPACE_ID::Field* mutable_fields(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Field >* mutable_fields(); private: - const PROTOBUF_NAMESPACE_ID::Field& _internal_fields(int index) const; - PROTOBUF_NAMESPACE_ID::Field* _internal_add_fields(); + const ::PROTOBUF_NAMESPACE_ID::Field& _internal_fields(int index) const; + ::PROTOBUF_NAMESPACE_ID::Field* _internal_add_fields(); public: - const PROTOBUF_NAMESPACE_ID::Field& fields(int index) const; - PROTOBUF_NAMESPACE_ID::Field* add_fields(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >& + const ::PROTOBUF_NAMESPACE_ID::Field& fields(int index) const; + ::PROTOBUF_NAMESPACE_ID::Field* add_fields(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Field >& fields() const; // repeated string oneofs = 3; @@ -348,16 +352,16 @@ class PROTOBUF_EXPORT Type final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 1; @@ -380,25 +384,25 @@ class PROTOBUF_EXPORT Type final : bool _internal_has_source_context() const; public: void clear_source_context(); - const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); - PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); - void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); + void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); private: - const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; - PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + ::PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); public: void unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context); - PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + ::PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 6; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Type) @@ -408,11 +412,11 @@ class PROTOBUF_EXPORT Type final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field > fields_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Field > fields_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<TProtoStringType> oneofs_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; int syntax_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; @@ -438,7 +442,11 @@ class PROTOBUF_EXPORT Field final : } inline Field& operator=(Field&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -496,7 +504,7 @@ class PROTOBUF_EXPORT Field final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Field& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -649,16 +657,16 @@ class PROTOBUF_EXPORT Field final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 4; @@ -719,20 +727,20 @@ class PROTOBUF_EXPORT Field final : // .google.protobuf.Field.Kind kind = 1; void clear_kind(); - PROTOBUF_NAMESPACE_ID::Field_Kind kind() const; - void set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value); + ::PROTOBUF_NAMESPACE_ID::Field_Kind kind() const; + void set_kind(::PROTOBUF_NAMESPACE_ID::Field_Kind value); private: - PROTOBUF_NAMESPACE_ID::Field_Kind _internal_kind() const; - void _internal_set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value); + ::PROTOBUF_NAMESPACE_ID::Field_Kind _internal_kind() const; + void _internal_set_kind(::PROTOBUF_NAMESPACE_ID::Field_Kind value); public: // .google.protobuf.Field.Cardinality cardinality = 2; void clear_cardinality(); - PROTOBUF_NAMESPACE_ID::Field_Cardinality cardinality() const; - void set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value); + ::PROTOBUF_NAMESPACE_ID::Field_Cardinality cardinality() const; + void set_cardinality(::PROTOBUF_NAMESPACE_ID::Field_Cardinality value); private: - PROTOBUF_NAMESPACE_ID::Field_Cardinality _internal_cardinality() const; - void _internal_set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value); + ::PROTOBUF_NAMESPACE_ID::Field_Cardinality _internal_cardinality() const; + void _internal_set_cardinality(::PROTOBUF_NAMESPACE_ID::Field_Cardinality value); public: // int32 number = 3; @@ -769,7 +777,7 @@ class PROTOBUF_EXPORT Field final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_url_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr json_name_; @@ -803,7 +811,11 @@ class PROTOBUF_EXPORT Enum final : } inline Enum& operator=(Enum&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -861,7 +873,7 @@ class PROTOBUF_EXPORT Enum final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Enum& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -911,16 +923,16 @@ class PROTOBUF_EXPORT Enum final : int _internal_enumvalue_size() const; public: void clear_enumvalue(); - PROTOBUF_NAMESPACE_ID::EnumValue* mutable_enumvalue(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >* + ::PROTOBUF_NAMESPACE_ID::EnumValue* mutable_enumvalue(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValue >* mutable_enumvalue(); private: - const PROTOBUF_NAMESPACE_ID::EnumValue& _internal_enumvalue(int index) const; - PROTOBUF_NAMESPACE_ID::EnumValue* _internal_add_enumvalue(); + const ::PROTOBUF_NAMESPACE_ID::EnumValue& _internal_enumvalue(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumValue* _internal_add_enumvalue(); public: - const PROTOBUF_NAMESPACE_ID::EnumValue& enumvalue(int index) const; - PROTOBUF_NAMESPACE_ID::EnumValue* add_enumvalue(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >& + const ::PROTOBUF_NAMESPACE_ID::EnumValue& enumvalue(int index) const; + ::PROTOBUF_NAMESPACE_ID::EnumValue* add_enumvalue(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValue >& enumvalue() const; // repeated .google.protobuf.Option options = 3; @@ -929,16 +941,16 @@ class PROTOBUF_EXPORT Enum final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 1; @@ -961,25 +973,25 @@ class PROTOBUF_EXPORT Enum final : bool _internal_has_source_context() const; public: void clear_source_context(); - const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); - PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); - void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context(); + void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); private: - const PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; - PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); + const ::PROTOBUF_NAMESPACE_ID::SourceContext& _internal_source_context() const; + ::PROTOBUF_NAMESPACE_ID::SourceContext* _internal_mutable_source_context(); public: void unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context); - PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context); + ::PROTOBUF_NAMESPACE_ID::SourceContext* unsafe_arena_release_source_context(); // .google.protobuf.Syntax syntax = 5; void clear_syntax(); - PROTOBUF_NAMESPACE_ID::Syntax syntax() const; - void set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax syntax() const; + void set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); private: - PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; - void _internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value); + ::PROTOBUF_NAMESPACE_ID::Syntax _internal_syntax() const; + void _internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Enum) @@ -989,10 +1001,10 @@ class PROTOBUF_EXPORT Enum final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue > enumvalue_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValue > enumvalue_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context_; int syntax_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; @@ -1018,7 +1030,11 @@ class PROTOBUF_EXPORT EnumValue final : } inline EnumValue& operator=(EnumValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1076,7 +1092,7 @@ class PROTOBUF_EXPORT EnumValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const EnumValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1124,16 +1140,16 @@ class PROTOBUF_EXPORT EnumValue final : int _internal_options_size() const; public: void clear_options(); - PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* + ::PROTOBUF_NAMESPACE_ID::Option* mutable_options(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* mutable_options(); private: - const PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); + const ::PROTOBUF_NAMESPACE_ID::Option& _internal_options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* _internal_add_options(); public: - const PROTOBUF_NAMESPACE_ID::Option& options(int index) const; - PROTOBUF_NAMESPACE_ID::Option* add_options(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& + const ::PROTOBUF_NAMESPACE_ID::Option& options(int index) const; + ::PROTOBUF_NAMESPACE_ID::Option* add_options(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& options() const; // string name = 1; @@ -1166,7 +1182,7 @@ class PROTOBUF_EXPORT EnumValue final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::int32 number_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; @@ -1193,7 +1209,11 @@ class PROTOBUF_EXPORT Option final : } inline Option& operator=(Option&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1251,7 +1271,7 @@ class PROTOBUF_EXPORT Option final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Option& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1312,17 +1332,17 @@ class PROTOBUF_EXPORT Option final : bool _internal_has_value() const; public: void clear_value(); - const PROTOBUF_NAMESPACE_ID::Any& value() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::Any* release_value(); - PROTOBUF_NAMESPACE_ID::Any* mutable_value(); - void set_allocated_value(PROTOBUF_NAMESPACE_ID::Any* value); + const ::PROTOBUF_NAMESPACE_ID::Any& value() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::Any* release_value(); + ::PROTOBUF_NAMESPACE_ID::Any* mutable_value(); + void set_allocated_value(::PROTOBUF_NAMESPACE_ID::Any* value); private: - const PROTOBUF_NAMESPACE_ID::Any& _internal_value() const; - PROTOBUF_NAMESPACE_ID::Any* _internal_mutable_value(); + const ::PROTOBUF_NAMESPACE_ID::Any& _internal_value() const; + ::PROTOBUF_NAMESPACE_ID::Any* _internal_mutable_value(); public: void unsafe_arena_set_allocated_value( - PROTOBUF_NAMESPACE_ID::Any* value); - PROTOBUF_NAMESPACE_ID::Any* unsafe_arena_release_value(); + ::PROTOBUF_NAMESPACE_ID::Any* value); + ::PROTOBUF_NAMESPACE_ID::Any* unsafe_arena_release_value(); // @@protoc_insertion_point(class_scope:google.protobuf.Option) private: @@ -1332,7 +1352,7 @@ class PROTOBUF_EXPORT Option final : typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - PROTOBUF_NAMESPACE_ID::Any* value_; + ::PROTOBUF_NAMESPACE_ID::Any* value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; @@ -1403,31 +1423,31 @@ inline int Type::fields_size() const { inline void Type::clear_fields() { fields_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Field* Type::mutable_fields(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Field* Type::mutable_fields(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields) return fields_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Field >* Type::mutable_fields() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields) return &fields_; } -inline const PROTOBUF_NAMESPACE_ID::Field& Type::_internal_fields(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Field& Type::_internal_fields(int index) const { return fields_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Field& Type::fields(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Field& Type::fields(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Type.fields) return _internal_fields(index); } -inline PROTOBUF_NAMESPACE_ID::Field* Type::_internal_add_fields() { +inline ::PROTOBUF_NAMESPACE_ID::Field* Type::_internal_add_fields() { return fields_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Field* Type::add_fields() { - PROTOBUF_NAMESPACE_ID::Field* _add = _internal_add_fields(); +inline ::PROTOBUF_NAMESPACE_ID::Field* Type::add_fields() { + ::PROTOBUF_NAMESPACE_ID::Field* _add = _internal_add_fields(); // @@protoc_insertion_point(field_add:google.protobuf.Type.fields) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Field >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Field >& Type::fields() const { // @@protoc_insertion_point(field_list:google.protobuf.Type.fields) return fields_; @@ -1518,31 +1538,31 @@ inline int Type::options_size() const { inline void Type::clear_options() { options_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Option* Type::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Type::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Type.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Type::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Type::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Type::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Type::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Type::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Type.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Type::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Type::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Type::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Type::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Type.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Type::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Type.options) return options_; @@ -1555,17 +1575,17 @@ inline bool Type::_internal_has_source_context() const { inline bool Type::has_source_context() const { return _internal_has_source_context(); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Type::_internal_source_context() const { - const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::SourceContext&>( - PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Type::_internal_source_context() const { + const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::SourceContext&>( + ::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Type::source_context() const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Type::source_context() const { // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) return _internal_source_context(); } inline void Type::unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); } @@ -1577,9 +1597,9 @@ inline void Type::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context) } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Type::release_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -1592,27 +1612,27 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::release_source_context() { #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::unsafe_arena_release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Type::unsafe_arena_release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context) - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::_internal_mutable_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Type::_internal_mutable_source_context() { if (source_context_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); source_context_ = p; } return source_context_; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::mutable_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Type::mutable_source_context() { + ::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) return _msg; } -inline void Type::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { +inline void Type::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); @@ -1638,18 +1658,18 @@ inline void Type::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceCont inline void Type::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Type::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Type::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Type::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Type::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Type.syntax) return _internal_syntax(); } -inline void Type::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Type::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Type::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Type::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Type.syntax) } @@ -1662,18 +1682,18 @@ inline void Type::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { inline void Field::clear_kind() { kind_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Field_Kind Field::_internal_kind() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Field_Kind >(kind_); +inline ::PROTOBUF_NAMESPACE_ID::Field_Kind Field::_internal_kind() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Field_Kind >(kind_); } -inline PROTOBUF_NAMESPACE_ID::Field_Kind Field::kind() const { +inline ::PROTOBUF_NAMESPACE_ID::Field_Kind Field::kind() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) return _internal_kind(); } -inline void Field::_internal_set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { +inline void Field::_internal_set_kind(::PROTOBUF_NAMESPACE_ID::Field_Kind value) { kind_ = value; } -inline void Field::set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { +inline void Field::set_kind(::PROTOBUF_NAMESPACE_ID::Field_Kind value) { _internal_set_kind(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) } @@ -1682,18 +1702,18 @@ inline void Field::set_kind(PROTOBUF_NAMESPACE_ID::Field_Kind value) { inline void Field::clear_cardinality() { cardinality_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Field_Cardinality Field::_internal_cardinality() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Field_Cardinality >(cardinality_); +inline ::PROTOBUF_NAMESPACE_ID::Field_Cardinality Field::_internal_cardinality() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Field_Cardinality >(cardinality_); } -inline PROTOBUF_NAMESPACE_ID::Field_Cardinality Field::cardinality() const { +inline ::PROTOBUF_NAMESPACE_ID::Field_Cardinality Field::cardinality() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) return _internal_cardinality(); } -inline void Field::_internal_set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { +inline void Field::_internal_set_cardinality(::PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { cardinality_ = value; } -inline void Field::set_cardinality(PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { +inline void Field::set_cardinality(::PROTOBUF_NAMESPACE_ID::Field_Cardinality value) { _internal_set_cardinality(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) } @@ -1860,31 +1880,31 @@ inline int Field::options_size() const { inline void Field::clear_options() { options_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Option* Field::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Field::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Field.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Field::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Field::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Field::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Field::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Field::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Field.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Field::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Field::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Field::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Field::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Field.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Field::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Field.options) return options_; @@ -2042,31 +2062,31 @@ inline int Enum::enumvalue_size() const { inline void Enum::clear_enumvalue() { enumvalue_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::EnumValue* Enum::mutable_enumvalue(int index) { +inline ::PROTOBUF_NAMESPACE_ID::EnumValue* Enum::mutable_enumvalue(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue) return enumvalue_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValue >* Enum::mutable_enumvalue() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue) return &enumvalue_; } -inline const PROTOBUF_NAMESPACE_ID::EnumValue& Enum::_internal_enumvalue(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumValue& Enum::_internal_enumvalue(int index) const { return enumvalue_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::EnumValue& Enum::enumvalue(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::EnumValue& Enum::enumvalue(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue) return _internal_enumvalue(index); } -inline PROTOBUF_NAMESPACE_ID::EnumValue* Enum::_internal_add_enumvalue() { +inline ::PROTOBUF_NAMESPACE_ID::EnumValue* Enum::_internal_add_enumvalue() { return enumvalue_.Add(); } -inline PROTOBUF_NAMESPACE_ID::EnumValue* Enum::add_enumvalue() { - PROTOBUF_NAMESPACE_ID::EnumValue* _add = _internal_add_enumvalue(); +inline ::PROTOBUF_NAMESPACE_ID::EnumValue* Enum::add_enumvalue() { + ::PROTOBUF_NAMESPACE_ID::EnumValue* _add = _internal_add_enumvalue(); // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::EnumValue >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumValue >& Enum::enumvalue() const { // @@protoc_insertion_point(field_list:google.protobuf.Enum.enumvalue) return enumvalue_; @@ -2082,31 +2102,31 @@ inline int Enum::options_size() const { inline void Enum::clear_options() { options_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Option* Enum::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* Enum::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* Enum::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& Enum::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Enum::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& Enum::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& Enum::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* Enum::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* Enum::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* Enum::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* Enum::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.Enum.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& Enum::options() const { // @@protoc_insertion_point(field_list:google.protobuf.Enum.options) return options_; @@ -2119,17 +2139,17 @@ inline bool Enum::_internal_has_source_context() const { inline bool Enum::has_source_context() const { return _internal_has_source_context(); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Enum::_internal_source_context() const { - const PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::SourceContext&>( - PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Enum::_internal_source_context() const { + const ::PROTOBUF_NAMESPACE_ID::SourceContext* p = source_context_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::SourceContext&>( + ::PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::SourceContext& Enum::source_context() const { +inline const ::PROTOBUF_NAMESPACE_ID::SourceContext& Enum::source_context() const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) return _internal_source_context(); } inline void Enum::unsafe_arena_set_allocated_source_context( - PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { + ::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); } @@ -2141,9 +2161,9 @@ inline void Enum::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context) } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Enum::release_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -2156,27 +2176,27 @@ inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::release_source_context() { #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::unsafe_arena_release_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Enum::unsafe_arena_release_source_context() { // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context) - PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; + ::PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_; source_context_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::_internal_mutable_source_context() { +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Enum::_internal_mutable_source_context() { if (source_context_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation()); source_context_ = p; } return source_context_; } -inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::mutable_source_context() { - PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); +inline ::PROTOBUF_NAMESPACE_ID::SourceContext* Enum::mutable_source_context() { + ::PROTOBUF_NAMESPACE_ID::SourceContext* _msg = _internal_mutable_source_context(); // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) return _msg; } -inline void Enum::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { +inline void Enum::set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_); @@ -2202,18 +2222,18 @@ inline void Enum::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceCont inline void Enum::clear_syntax() { syntax_ = 0; } -inline PROTOBUF_NAMESPACE_ID::Syntax Enum::_internal_syntax() const { - return static_cast< PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); +inline ::PROTOBUF_NAMESPACE_ID::Syntax Enum::_internal_syntax() const { + return static_cast< ::PROTOBUF_NAMESPACE_ID::Syntax >(syntax_); } -inline PROTOBUF_NAMESPACE_ID::Syntax Enum::syntax() const { +inline ::PROTOBUF_NAMESPACE_ID::Syntax Enum::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.syntax) return _internal_syntax(); } -inline void Enum::_internal_set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Enum::_internal_set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { syntax_ = value; } -inline void Enum::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { +inline void Enum::set_syntax(::PROTOBUF_NAMESPACE_ID::Syntax value) { _internal_set_syntax(value); // @@protoc_insertion_point(field_set:google.protobuf.Enum.syntax) } @@ -2298,31 +2318,31 @@ inline int EnumValue::options_size() const { inline void EnumValue::clear_options() { options_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::Option* EnumValue::mutable_options(int index) { +inline ::PROTOBUF_NAMESPACE_ID::Option* EnumValue::mutable_options(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options) return options_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >* EnumValue::mutable_options() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options) return &options_; } -inline const PROTOBUF_NAMESPACE_ID::Option& EnumValue::_internal_options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& EnumValue::_internal_options(int index) const { return options_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::Option& EnumValue::options(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::Option& EnumValue::options(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options) return _internal_options(index); } -inline PROTOBUF_NAMESPACE_ID::Option* EnumValue::_internal_add_options() { +inline ::PROTOBUF_NAMESPACE_ID::Option* EnumValue::_internal_add_options() { return options_.Add(); } -inline PROTOBUF_NAMESPACE_ID::Option* EnumValue::add_options() { - PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); +inline ::PROTOBUF_NAMESPACE_ID::Option* EnumValue::add_options() { + ::PROTOBUF_NAMESPACE_ID::Option* _add = _internal_add_options(); // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option >& EnumValue::options() const { // @@protoc_insertion_point(field_list:google.protobuf.EnumValue.options) return options_; @@ -2385,17 +2405,17 @@ inline bool Option::_internal_has_value() const { inline bool Option::has_value() const { return _internal_has_value(); } -inline const PROTOBUF_NAMESPACE_ID::Any& Option::_internal_value() const { - const PROTOBUF_NAMESPACE_ID::Any* p = value_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::Any&>( - PROTOBUF_NAMESPACE_ID::_Any_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::Any& Option::_internal_value() const { + const ::PROTOBUF_NAMESPACE_ID::Any* p = value_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Any&>( + ::PROTOBUF_NAMESPACE_ID::_Any_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::Any& Option::value() const { +inline const ::PROTOBUF_NAMESPACE_ID::Any& Option::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Option.value) return _internal_value(); } inline void Option::unsafe_arena_set_allocated_value( - PROTOBUF_NAMESPACE_ID::Any* value) { + ::PROTOBUF_NAMESPACE_ID::Any* value) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(value_); } @@ -2407,9 +2427,9 @@ inline void Option::unsafe_arena_set_allocated_value( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value) } -inline PROTOBUF_NAMESPACE_ID::Any* Option::release_value() { +inline ::PROTOBUF_NAMESPACE_ID::Any* Option::release_value() { - PROTOBUF_NAMESPACE_ID::Any* temp = value_; + ::PROTOBUF_NAMESPACE_ID::Any* temp = value_; value_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -2422,27 +2442,27 @@ inline PROTOBUF_NAMESPACE_ID::Any* Option::release_value() { #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::Any* Option::unsafe_arena_release_value() { +inline ::PROTOBUF_NAMESPACE_ID::Any* Option::unsafe_arena_release_value() { // @@protoc_insertion_point(field_release:google.protobuf.Option.value) - PROTOBUF_NAMESPACE_ID::Any* temp = value_; + ::PROTOBUF_NAMESPACE_ID::Any* temp = value_; value_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::Any* Option::_internal_mutable_value() { +inline ::PROTOBUF_NAMESPACE_ID::Any* Option::_internal_mutable_value() { if (value_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Any>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(GetArenaForAllocation()); value_ = p; } return value_; } -inline PROTOBUF_NAMESPACE_ID::Any* Option::mutable_value() { - PROTOBUF_NAMESPACE_ID::Any* _msg = _internal_mutable_value(); +inline ::PROTOBUF_NAMESPACE_ID::Any* Option::mutable_value() { + ::PROTOBUF_NAMESPACE_ID::Any* _msg = _internal_mutable_value(); // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) return _msg; } -inline void Option::set_allocated_value(PROTOBUF_NAMESPACE_ID::Any* value) { +inline void Option::set_allocated_value(::PROTOBUF_NAMESPACE_ID::Any* value) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(value_); @@ -2482,20 +2502,20 @@ PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::Field_Kind> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::Field_Kind> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::Field_Kind>() { - return PROTOBUF_NAMESPACE_ID::Field_Kind_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::Field_Kind>() { + return ::PROTOBUF_NAMESPACE_ID::Field_Kind_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::Field_Cardinality> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::Field_Cardinality> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::Field_Cardinality>() { - return PROTOBUF_NAMESPACE_ID::Field_Cardinality_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::Field_Cardinality>() { + return ::PROTOBUF_NAMESPACE_ID::Field_Cardinality_descriptor(); } -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::Syntax> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::Syntax> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::Syntax>() { - return PROTOBUF_NAMESPACE_ID::Syntax_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::Syntax>() { + return ::PROTOBUF_NAMESPACE_ID::Syntax_descriptor(); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc index dcb4409f9e..9664de42c8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc +++ b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc @@ -132,7 +132,7 @@ size_t UnknownFieldSet::SpaceUsedLong() const { return sizeof(*this) + SpaceUsedExcludingSelf(); } -void UnknownFieldSet::AddVarint(int number, uint64 value) { +void UnknownFieldSet::AddVarint(int number, uint64_t value) { UnknownField field; field.number_ = number; field.SetType(UnknownField::TYPE_VARINT); @@ -140,7 +140,7 @@ void UnknownFieldSet::AddVarint(int number, uint64 value) { fields_.push_back(field); } -void UnknownFieldSet::AddFixed32(int number, uint32 value) { +void UnknownFieldSet::AddFixed32(int number, uint32_t value) { UnknownField field; field.number_ = number; field.SetType(UnknownField::TYPE_FIXED32); @@ -148,7 +148,7 @@ void UnknownFieldSet::AddFixed32(int number, uint32 value) { fields_.push_back(field); } -void UnknownFieldSet::AddFixed64(int number, uint64 value) { +void UnknownFieldSet::AddFixed64(int number, uint64_t value) { UnknownField field; field.number_ = number; field.SetType(UnknownField::TYPE_FIXED64); @@ -269,8 +269,8 @@ void UnknownField::DeepCopy(const UnknownField& other) { } -uint8* UnknownField::InternalSerializeLengthDelimitedNoTag( - uint8* target, io::EpsCopyOutputStream* stream) const { +uint8_t* UnknownField::InternalSerializeLengthDelimitedNoTag( + uint8_t* target, io::EpsCopyOutputStream* stream) const { GOOGLE_DCHECK_EQ(TYPE_LENGTH_DELIMITED, type()); const TProtoStringType& data = *data_.length_delimited_.string_value; target = io::CodedOutputStream::WriteVarint32ToArray(data.size(), target); @@ -285,22 +285,24 @@ class UnknownFieldParserHelper { explicit UnknownFieldParserHelper(UnknownFieldSet* unknown) : unknown_(unknown) {} - void AddVarint(uint32 num, uint64 value) { unknown_->AddVarint(num, value); } - void AddFixed64(uint32 num, uint64 value) { + void AddVarint(uint32_t num, uint64_t value) { + unknown_->AddVarint(num, value); + } + void AddFixed64(uint32_t num, uint64_t value) { unknown_->AddFixed64(num, value); } - const char* ParseLengthDelimited(uint32 num, const char* ptr, + const char* ParseLengthDelimited(uint32_t num, const char* ptr, ParseContext* ctx) { TProtoStringType* s = unknown_->AddLengthDelimited(num); int size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); return ctx->ReadString(ptr, size, s); } - const char* ParseGroup(uint32 num, const char* ptr, ParseContext* ctx) { + const char* ParseGroup(uint32_t num, const char* ptr, ParseContext* ctx) { UnknownFieldParserHelper child(unknown_->AddGroup(num)); return ctx->ParseGroup(&child, ptr, num * 8 + 3); } - void AddFixed32(uint32 num, uint32 value) { + void AddFixed32(uint32_t num, uint32_t value) { unknown_->AddFixed32(num, value); } @@ -318,7 +320,7 @@ const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr, return WireFormatParser(field_parser, ptr, ctx); } -const char* UnknownFieldParse(uint64 tag, UnknownFieldSet* unknown, +const char* UnknownFieldParse(uint64_t tag, UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx) { UnknownFieldParserHelper field_parser(unknown); return FieldParser(tag, field_parser, ptr, ctx); diff --git a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h index e2a8f807d2..bc4dc34f7f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h +++ b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.h @@ -136,9 +136,9 @@ class PROTOBUF_EXPORT UnknownFieldSet { // Adding fields --------------------------------------------------- - void AddVarint(int number, uint64 value); - void AddFixed32(int number, uint32 value); - void AddFixed64(int number, uint64 value); + void AddVarint(int number, uint64_t value); + void AddFixed32(int number, uint32_t value); + void AddFixed64(int number, uint64_t value); void AddLengthDelimited(int number, const TProtoStringType& value); TProtoStringType* AddLengthDelimited(int number); UnknownFieldSet* AddGroup(int number); @@ -209,10 +209,10 @@ class PROTOBUF_EXPORT UnknownFieldSet { namespace internal { -inline void WriteVarint(uint32 num, uint64 val, UnknownFieldSet* unknown) { +inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* unknown) { unknown->AddVarint(num, val); } -inline void WriteLengthDelimited(uint32 num, StringPiece val, +inline void WriteLengthDelimited(uint32_t num, StringPiece val, UnknownFieldSet* unknown) { unknown->AddLengthDelimited(num)->assign(val.data(), val.size()); } @@ -221,7 +221,7 @@ PROTOBUF_EXPORT const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx); PROTOBUF_EXPORT -const char* UnknownFieldParse(uint64 tag, UnknownFieldSet* unknown, +const char* UnknownFieldParse(uint64_t tag, UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx); } // namespace internal @@ -246,15 +246,15 @@ class PROTOBUF_EXPORT UnknownField { // Accessors ------------------------------------------------------- // Each method works only for UnknownFields of the corresponding type. - inline uint64 varint() const; - inline uint32 fixed32() const; - inline uint64 fixed64() const; + inline uint64_t varint() const; + inline uint32_t fixed32() const; + inline uint64_t fixed64() const; inline const TProtoStringType& length_delimited() const; inline const UnknownFieldSet& group() const; - inline void set_varint(uint64 value); - inline void set_fixed32(uint32 value); - inline void set_fixed64(uint64 value); + inline void set_varint(uint64_t value); + inline void set_fixed32(uint32_t value); + inline void set_fixed64(uint64_t value); inline void set_length_delimited(const TProtoStringType& value); inline TProtoStringType* mutable_length_delimited(); inline UnknownFieldSet* mutable_group(); @@ -269,8 +269,8 @@ class PROTOBUF_EXPORT UnknownField { } inline size_t GetLengthDelimitedSize() const; - uint8* InternalSerializeLengthDelimitedNoTag( - uint8* target, io::EpsCopyOutputStream* stream) const; + uint8_t* InternalSerializeLengthDelimitedNoTag( + uint8_t* target, io::EpsCopyOutputStream* stream) const; // If this UnknownField contains a pointer, delete it. @@ -287,12 +287,12 @@ class PROTOBUF_EXPORT UnknownField { TProtoStringType* string_value; }; - uint32 number_; - uint32 type_; + uint32_t number_; + uint32_t type_; union { - uint64 varint_; - uint32 fixed32_; - uint64 fixed64_; + uint64_t varint_; + uint32_t fixed32_; + uint64_t fixed64_; mutable union LengthDelimited length_delimited_; UnknownFieldSet* group_; } data_; @@ -342,15 +342,15 @@ inline UnknownField::Type UnknownField::type() const { return static_cast<Type>(type_); } -inline uint64 UnknownField::varint() const { +inline uint64_t UnknownField::varint() const { assert(type() == TYPE_VARINT); return data_.varint_; } -inline uint32 UnknownField::fixed32() const { +inline uint32_t UnknownField::fixed32() const { assert(type() == TYPE_FIXED32); return data_.fixed32_; } -inline uint64 UnknownField::fixed64() const { +inline uint64_t UnknownField::fixed64() const { assert(type() == TYPE_FIXED64); return data_.fixed64_; } @@ -363,15 +363,15 @@ inline const UnknownFieldSet& UnknownField::group() const { return *data_.group_; } -inline void UnknownField::set_varint(uint64 value) { +inline void UnknownField::set_varint(uint64_t value) { assert(type() == TYPE_VARINT); data_.varint_ = value; } -inline void UnknownField::set_fixed32(uint32 value) { +inline void UnknownField::set_fixed32(uint32_t value) { assert(type() == TYPE_FIXED32); data_.fixed32_ = value; } -inline void UnknownField::set_fixed64(uint64 value) { +inline void UnknownField::set_fixed64(uint64_t value) { assert(type() == TYPE_FIXED64); data_.fixed64_ = value; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc index 959d5586d2..1e69f8e4f7 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.cc @@ -52,9 +52,9 @@ TProtoStringType FieldMaskUtil::ToString(const FieldMask& mask) { void FieldMaskUtil::FromString(StringPiece str, FieldMask* out) { out->Clear(); std::vector<TProtoStringType> paths = Split(str, ","); - for (int i = 0; i < paths.size(); ++i) { - if (paths[i].empty()) continue; - out->add_paths(paths[i]); + for (const TProtoStringType& path : paths) { + if (path.empty()) continue; + out->add_paths(path); } } @@ -62,23 +62,23 @@ bool FieldMaskUtil::SnakeCaseToCamelCase(StringPiece input, TProtoStringType* output) { output->clear(); bool after_underscore = false; - for (int i = 0; i < input.size(); ++i) { - if (input[i] >= 'A' && input[i] <= 'Z') { + for (const char& input_char : input) { + if (input_char >= 'A' && input_char <= 'Z') { // The field name must not contain uppercase letters. return false; } if (after_underscore) { - if (input[i] >= 'a' && input[i] <= 'z') { - output->push_back(input[i] + 'A' - 'a'); + if (input_char >= 'a' && input_char <= 'z') { + output->push_back(input_char + 'A' - 'a'); after_underscore = false; } else { // The character after a "_" must be a lowercase letter. return false; } - } else if (input[i] == '_') { + } else if (input_char == '_') { after_underscore = true; } else { - output->push_back(input[i]); + output->push_back(input_char); } } if (after_underscore) { @@ -91,16 +91,16 @@ bool FieldMaskUtil::SnakeCaseToCamelCase(StringPiece input, bool FieldMaskUtil::CamelCaseToSnakeCase(StringPiece input, TProtoStringType* output) { output->clear(); - for (int i = 0; i < input.size(); ++i) { - if (input[i] == '_') { + for (const char c : input) { + if (c == '_') { // The field name must not contain "_"s. return false; } - if (input[i] >= 'A' && input[i] <= 'Z') { + if (c >= 'A' && c <= 'Z') { output->push_back('_'); - output->push_back(input[i] + 'a' - 'A'); + output->push_back(c + 'a' - 'A'); } else { - output->push_back(input[i]); + output->push_back(c); } } return true; @@ -125,10 +125,10 @@ bool FieldMaskUtil::ToJsonString(const FieldMask& mask, TProtoStringType* out) { bool FieldMaskUtil::FromJsonString(StringPiece str, FieldMask* out) { out->Clear(); std::vector<TProtoStringType> paths = Split(str, ","); - for (int i = 0; i < paths.size(); ++i) { - if (paths[i].empty()) continue; + for (const TProtoStringType& path : paths) { + if (path.empty()) continue; TProtoStringType snakecase_path; - if (!CamelCaseToSnakeCase(paths[i], &snakecase_path)) { + if (!CamelCaseToSnakeCase(path, &snakecase_path)) { return false; } out->add_paths(snakecase_path); @@ -143,8 +143,7 @@ bool FieldMaskUtil::GetFieldDescriptors( field_descriptors->clear(); } std::vector<TProtoStringType> parts = Split(path, "."); - for (int i = 0; i < parts.size(); ++i) { - const TProtoStringType& field_name = parts[i]; + for (const TProtoStringType& field_name : parts) { if (descriptor == nullptr) { return false; } @@ -332,14 +331,13 @@ void FieldMaskTree::AddPath(const TProtoStringType& path) { } bool new_branch = false; Node* node = &root_; - for (int i = 0; i < parts.size(); ++i) { + for (const TProtoStringType& node_name : parts) { if (!new_branch && node != &root_ && node->children.empty()) { // Path matches an existing leaf node. This means the path is already // covered by this tree (for example, adding "foo.bar.baz" to a tree // which already contains "foo.bar"). return; } - const TProtoStringType& node_name = parts[i]; Node*& child = node->children[node_name]; if (child == NULL) { new_branch = true; @@ -417,14 +415,13 @@ void FieldMaskTree::IntersectPath(const TProtoStringType& path, FieldMaskTree* o return; } const Node* node = &root_; - for (int i = 0; i < parts.size(); ++i) { + for (const TProtoStringType& node_name : parts) { if (node->children.empty()) { if (node != &root_) { out->AddPath(path); } return; } - const TProtoStringType& node_name = parts[i]; const Node* result = FindPtrOrNull(node->children, node_name); if (result == NULL) { // No intersection found. diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc index 9f5a91362f..c4734269a2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc @@ -220,8 +220,7 @@ DefaultValueObjectWriter::Node* DefaultValueObjectWriter::Node::FindChild( if (name.empty() || kind_ != OBJECT) { return nullptr; } - for (int i = 0; i < children_.size(); ++i) { - Node* child = children_[i]; + for (Node* child : children_) { if (child->name() == name) { return child; } @@ -265,8 +264,7 @@ void DefaultValueObjectWriter::Node::WriteTo(ObjectWriter* ow) { } void DefaultValueObjectWriter::Node::WriteChildren(ObjectWriter* ow) { - for (int i = 0; i < children_.size(); ++i) { - Node* child = children_[i]; + for (Node* child : children_) { child->WriteTo(ow); } } @@ -413,9 +411,6 @@ void DefaultValueObjectWriter::MaybePopulateChildrenOfAny(Node* node) { DataPiece DefaultValueObjectWriter::FindEnumDefault( const google::protobuf::Field& field, const TypeInfo* typeinfo, bool use_ints_for_enums) { - if (!field.default_value().empty()) - return DataPiece(field.default_value(), true); - const google::protobuf::Enum* enum_type = typeinfo->GetEnumByTypeUrl(field.type_url()); if (!enum_type) { @@ -423,6 +418,26 @@ DataPiece DefaultValueObjectWriter::FindEnumDefault( << "'"; return DataPiece::NullData(); } + if (!field.default_value().empty()) { + if (!use_ints_for_enums) { + return DataPiece(field.default_value(), true); + } else { + const TProtoStringType& enum_default_value_name = field.default_value(); + for (int enum_index = 0; + enum_index < enum_type->enumvalue_size(); + ++enum_index) { + auto& enum_value = enum_type->enumvalue(enum_index); + if (enum_value.name() == enum_default_value_name) + return DataPiece(enum_value.number()); + } + GOOGLE_LOG(WARNING) << "Could not find enum value '" + << enum_default_value_name + << "' with type '" + << field.type_url() + << "'"; + return DataPiece::NullData(); + } + } // We treat the first value as the default if none is specified. return enum_type->enumvalue_size() > 0 ? (use_ints_for_enums diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc index 2d13148f46..0564aee619 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc @@ -343,10 +343,6 @@ util::Status JsonStreamParser::ParseValue(TokenType type) { case UNKNOWN: return ReportUnknown("Expected a value.", ParseErrorType::EXPECTED_VALUE); default: { - if (allow_empty_null_ && IsEmptyNullAllowed(type)) { - return ParseEmptyNull(); - } - // Special case for having been cut off while parsing, wait for more data. // This handles things like 'fals' being at the end of the string, we // don't know if the next char would be e, completing it, or something @@ -354,6 +350,10 @@ util::Status JsonStreamParser::ParseValue(TokenType type) { if (!finishing_ && p_.length() < kKeywordFalse.length()) { return util::CancelledError(""); } + + if (allow_empty_null_ && IsEmptyNullAllowed(type)) { + return ParseEmptyNull(); + } return ReportFailure("Unexpected token.", ParseErrorType::UNEXPECTED_TOKEN); } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc index 2573fcdc3d..2599359ac1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc @@ -204,6 +204,28 @@ void MatchIndicesPostProcessorForSmartList(std::vector<int>* match_list1, } } +void AddSpecificIndex( + google::protobuf::util::MessageDifferencer::SpecificField* specific_field, + const Message& message, const FieldDescriptor* field, int index) { + if (field->is_map()) { + const Reflection* reflection = message.GetReflection(); + specific_field->map_entry1 = + &reflection->GetRepeatedMessage(message, field, index); + } + specific_field->index = index; +} + +void AddSpecificNewIndex( + google::protobuf::util::MessageDifferencer::SpecificField* specific_field, + const Message& message, const FieldDescriptor* field, int index) { + if (field->is_map()) { + const Reflection* reflection = message.GetReflection(); + specific_field->map_entry2 = + &reflection->GetRepeatedMessage(message, field, index); + } + specific_field->new_index = index; +} + MessageDifferencer::MapEntryKeyComparator::MapEntryKeyComparator( MessageDifferencer* message_differencer) : message_differencer_(message_differencer) {} @@ -759,7 +781,11 @@ bool MessageDifferencer::CompareWithFieldsInternal( for (int i = 0; i < count; ++i) { SpecificField specific_field; specific_field.field = field1; - specific_field.index = field1->is_repeated() ? i : -1; + if (field1->is_repeated()) { + AddSpecificIndex(&specific_field, message1, field1, i); + } else { + specific_field.index = -1; + } parent_fields->push_back(specific_field); reporter_->ReportDeleted(message1, message2, *parent_fields); @@ -799,8 +825,13 @@ bool MessageDifferencer::CompareWithFieldsInternal( for (int i = 0; i < count; ++i) { SpecificField specific_field; specific_field.field = field2; - specific_field.index = field2->is_repeated() ? i : -1; - specific_field.new_index = specific_field.index; + if (field2->is_repeated()) { + specific_field.index = i; + AddSpecificNewIndex(&specific_field, message2, field2, i); + } else { + specific_field.index = -1; + specific_field.new_index = -1; + } parent_fields->push_back(specific_field); reporter_->ReportAdded(message1, message2, *parent_fields); @@ -904,6 +935,10 @@ bool MessageDifferencer::IsMatch( reflection2->GetRepeatedMessage(*message2, repeated_field, index2); SpecificField specific_field; specific_field.field = repeated_field; + if (repeated_field->is_map()) { + specific_field.map_entry1 = &m1; + specific_field.map_entry2 = &m2; + } specific_field.index = index1; specific_field.new_index = index2; current_parent_fields.push_back(specific_field); @@ -1116,7 +1151,7 @@ bool MessageDifferencer::CompareRepeatedRep( if (!simple_list && match_list1[i] == -1) { if (smart_list) { if (reporter_ == nullptr) return false; - specific_field.index = i; + AddSpecificIndex(&specific_field, message1, repeated_field, i); parent_fields->push_back(specific_field); reporter_->ReportDeleted(message1, message2, *parent_fields); parent_fields->pop_back(); @@ -1131,7 +1166,7 @@ bool MessageDifferencer::CompareRepeatedRep( GOOGLE_CHECK_LE(0, j); if (reporter_ == nullptr) return false; specific_field.index = j; - specific_field.new_index = j; + AddSpecificNewIndex(&specific_field, message2, repeated_field, j); parent_fields->push_back(specific_field); reporter_->ReportAdded(message1, message2, *parent_fields); parent_fields->pop_back(); @@ -1140,11 +1175,12 @@ bool MessageDifferencer::CompareRepeatedRep( match_list2[j] = -2; } } - specific_field.index = i; + AddSpecificIndex(&specific_field, message1, repeated_field, i); if (simple_list) { - specific_field.new_index = i; + AddSpecificNewIndex(&specific_field, message2, repeated_field, i); } else { - specific_field.new_index = match_list1[i]; + AddSpecificNewIndex(&specific_field, message2, repeated_field, + match_list1[i]); next_unmatched_index = match_list1[i] + 1; } @@ -1184,7 +1220,7 @@ bool MessageDifferencer::CompareRepeatedRep( if (reporter_ == NULL) continue; specific_field.index = i; - specific_field.new_index = i; + AddSpecificNewIndex(&specific_field, message2, repeated_field, i); parent_fields->push_back(specific_field); reporter_->ReportAdded(message1, message2, *parent_fields); parent_fields->pop_back(); @@ -1194,7 +1230,7 @@ bool MessageDifferencer::CompareRepeatedRep( if (!simple_list && match_list1[i] != -1) continue; if (simple_list && i < count2) continue; assert(reporter_ != NULL); - specific_field.index = i; + AddSpecificIndex(&specific_field, message1, repeated_field, i); parent_fields->push_back(specific_field); reporter_->ReportDeleted(message1, message2, *parent_fields); parent_fields->pop_back(); @@ -1239,8 +1275,8 @@ bool MessageDifferencer::CompareFieldValueUsingParentFields( // Append currently compared field to the end of parent_fields. SpecificField specific_field; specific_field.field = field; - specific_field.index = index1; - specific_field.new_index = index2; + AddSpecificIndex(&specific_field, message1, field, index1); + AddSpecificNewIndex(&specific_field, message2, field, index2); parent_fields->push_back(specific_field); const bool compare_result = Compare(m1, m2, parent_fields); parent_fields->pop_back(); @@ -1377,7 +1413,7 @@ bool MessageDifferencer::UnpackAnyField::UnpackAny( any.GetDescriptor()->file()->pool()->FindMessageTypeByName( full_type_name); if (desc == NULL) { - GOOGLE_DLOG(ERROR) << "Proto type '" << full_type_name << "' not found"; + GOOGLE_LOG(INFO) << "Proto type '" << full_type_name << "' not found"; return false; } @@ -1932,7 +1968,7 @@ void MessageDifferencer::StreamReporter::PrintPath( } if (specific_field.field->is_map()) { - PrintMapKey(field_path, left_side, specific_field, i); + PrintMapKey(left_side, specific_field); continue; } } else { @@ -2038,66 +2074,21 @@ void MessageDifferencer::StreamReporter::Print(const TProtoStringType& str) { } void MessageDifferencer::StreamReporter::PrintMapKey( - const std::vector<SpecificField>& field_path, bool left_side, - const SpecificField& specific_field, size_t target_field_index) { + bool left_side, const SpecificField& specific_field) { if (message1_ == nullptr || message2_ == nullptr) { GOOGLE_LOG(WARNING) << "PrintPath cannot log map keys; " "use SetMessages to provide the messages " "being compared prior to any processing."; return; } - auto get_target_message = [=](const SpecificField& specific_field, - const Reflection* reflection, - const Message* message) { - return &( - specific_field.field->is_repeated() - ? reflection->GetRepeatedMessage( - *message, specific_field.field, - left_side ? specific_field.index : specific_field.new_index) - : reflection->GetMessage(*message, specific_field.field)); - }; - - std::unique_ptr<Message> deserialized_msg; // used for protobuf.Any case - std::unique_ptr<DynamicMessageFactory> dynamic_message_factory; - const Message* found_message = left_side ? message1_ : message2_; - for (size_t j = 0; j <= target_field_index; - j++) { // iterate until we find target field - if (specific_field.field->is_repeated()) { - int index = left_side ? specific_field.index : specific_field.new_index; - if (index < 0) { - // Filtered messages fall in this case - GOOGLE_LOG(WARNING) << "Invalid index " << index << " for map.\n"; - found_message = nullptr; - break; - } - } - if (found_message->GetTypeName() == "google.protobuf.Any") { - if (!unpack_any_field_.UnpackAny(*found_message, &deserialized_msg)) { - GOOGLE_LOG(ERROR) << "Cannot print Any message map key due to " - "unpacking error\n"; - found_message = nullptr; - break; - } - - found_message = - get_target_message(field_path[j], deserialized_msg->GetReflection(), - deserialized_msg.get()); - - } else { - found_message = get_target_message( - field_path[j], found_message->GetReflection(), found_message); - } - } + const Message* found_message = + left_side ? specific_field.map_entry1 : specific_field.map_entry2; TProtoStringType key_string = ""; if (found_message != nullptr) { // NB: the map key is always the first field const FieldDescriptor* fd = found_message->GetDescriptor()->field(0); - if (fd->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - key_string = found_message->GetReflection() - ->GetMessage(*found_message, fd) - .ShortDebugString(); - } else if (fd->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { + if (fd->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { // Not using PrintFieldValueToString for strings to avoid extra // characters key_string = found_message->GetReflection()->GetString( diff --git a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h index b68c24b7de..b94bd0cf56 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h @@ -194,6 +194,10 @@ class PROTOBUF_EXPORT MessageDifferencer { // has not moved, "new_index" will have the same value as "index". int new_index = -1; + // If "field" is a map field, point to the map entry. + const Message* map_entry1 = nullptr; + const Message* map_entry2 = nullptr; + // For unknown fields, these are the pointers to the UnknownFieldSet // containing the unknown fields. In certain cases (e.g. proto1's // MessageSet, or nested groups of unknown fields), these may differ from @@ -695,12 +699,10 @@ class PROTOBUF_EXPORT MessageDifferencer { // Just print a string void Print(const TProtoStringType& str); + private: // helper function for PrintPath that contains logic for printing maps - void PrintMapKey(const std::vector<SpecificField>& field_path, - bool left_side, const SpecificField& specific_field, - size_t target_field_index); + void PrintMapKey(bool left_side, const SpecificField& specific_field); - private: io::Printer* printer_; bool delete_printer_; bool report_modified_aggregates_; diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc index cb0b32465f..7474c68286 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc @@ -70,7 +70,7 @@ static size_t MapValueRefDataOnlyByteSize(const FieldDescriptor* field, // =================================================================== bool UnknownFieldSetFieldSkipper::SkipField(io::CodedInputStream* input, - uint32 tag) { + uint32_t tag) { return WireFormat::SkipField(input, tag, unknown_fields_); } @@ -82,7 +82,7 @@ void UnknownFieldSetFieldSkipper::SkipUnknownEnum(int field_number, int value) { unknown_fields_->AddVarint(field_number, value); } -bool WireFormat::SkipField(io::CodedInputStream* input, uint32 tag, +bool WireFormat::SkipField(io::CodedInputStream* input, uint32_t tag, UnknownFieldSet* unknown_fields) { int number = WireFormatLite::GetTagFieldNumber(tag); // Field number 0 is illegal. @@ -90,19 +90,19 @@ bool WireFormat::SkipField(io::CodedInputStream* input, uint32 tag, switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { - uint64 value; + uint64_t value; if (!input->ReadVarint64(&value)) return false; if (unknown_fields != NULL) unknown_fields->AddVarint(number, value); return true; } case WireFormatLite::WIRETYPE_FIXED64: { - uint64 value; + uint64_t value; if (!input->ReadLittleEndian64(&value)) return false; if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value); return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; if (unknown_fields == NULL) { if (!input->Skip(length)) return false; @@ -134,7 +134,7 @@ bool WireFormat::SkipField(io::CodedInputStream* input, uint32 tag, return false; } case WireFormatLite::WIRETYPE_FIXED32: { - uint32 value; + uint32_t value; if (!input->ReadLittleEndian32(&value)) return false; if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value); return true; @@ -148,7 +148,7 @@ bool WireFormat::SkipField(io::CodedInputStream* input, uint32 tag, bool WireFormat::SkipMessage(io::CodedInputStream* input, UnknownFieldSet* unknown_fields) { while (true) { - uint32 tag = input->ReadTag(); + uint32_t tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -166,11 +166,11 @@ bool WireFormat::SkipMessage(io::CodedInputStream* input, } bool WireFormat::ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, - uint32 field_number, + uint32_t field_number, bool (*is_valid)(int), UnknownFieldSet* unknown_fields, RepeatedField<int>* values) { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; io::CodedInputStream::Limit limit = input->PushLimit(length); while (input->BytesUntilLimit() > 0) { @@ -189,8 +189,8 @@ bool WireFormat::ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, return true; } -uint8* WireFormat::InternalSerializeUnknownFieldsToArray( - const UnknownFieldSet& unknown_fields, uint8* target, +uint8_t* WireFormat::InternalSerializeUnknownFieldsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target, io::EpsCopyOutputStream* stream) { for (int i = 0; i < unknown_fields.field_count(); i++) { const UnknownField& field = unknown_fields.field(i); @@ -227,8 +227,8 @@ uint8* WireFormat::InternalSerializeUnknownFieldsToArray( return target; } -uint8* WireFormat::InternalSerializeUnknownMessageSetItemsToArray( - const UnknownFieldSet& unknown_fields, uint8* target, +uint8_t* WireFormat::InternalSerializeUnknownMessageSetItemsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target, io::EpsCopyOutputStream* stream) { for (int i = 0; i < unknown_fields.field_count(); i++) { const UnknownField& field = unknown_fields.field(i); @@ -278,7 +278,7 @@ size_t WireFormat::ComputeUnknownFieldsSize( case UnknownField::TYPE_FIXED32: size += io::CodedOutputStream::VarintSize32(WireFormatLite::MakeTag( field.number(), WireFormatLite::WIRETYPE_FIXED32)); - size += sizeof(int32); + size += sizeof(int32_t); break; case UnknownField::TYPE_FIXED64: size += io::CodedOutputStream::VarintSize32(WireFormatLite::MakeTag( @@ -334,7 +334,7 @@ bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, const Reflection* message_reflection = message->GetReflection(); while (true) { - uint32 tag = input->ReadTag(); + uint32_t tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -380,15 +380,15 @@ bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, } bool WireFormat::SkipMessageSetField(io::CodedInputStream* input, - uint32 field_number, + uint32_t field_number, UnknownFieldSet* unknown_fields) { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; return input->ReadString(unknown_fields->AddLengthDelimited(field_number), length); } -bool WireFormat::ParseAndMergeMessageSetField(uint32 field_number, +bool WireFormat::ParseAndMergeMessageSetField(uint32_t field_number, const FieldDescriptor* field, Message* message, io::CodedInputStream* input) { @@ -415,7 +415,7 @@ static bool StrictUtf8Check(const FieldDescriptor* field) { } bool WireFormat::ParseAndMergeField( - uint32 tag, + uint32_t tag, const FieldDescriptor* field, // May be NULL for unknown Message* message, io::CodedInputStream* input) { const Reflection* message_reflection = message->GetReflection(); @@ -441,7 +441,7 @@ bool WireFormat::ParseAndMergeField( return SkipField(input, tag, message_reflection->MutableUnknownFields(message)); } else if (value_format == PACKED_FORMAT) { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; io::CodedInputStream::Limit limit = input->PushLimit(length); @@ -459,16 +459,16 @@ bool WireFormat::ParseAndMergeField( break; \ } - HANDLE_PACKED_TYPE(INT32, int32, Int32) + HANDLE_PACKED_TYPE(INT32, int32_t, Int32) HANDLE_PACKED_TYPE(INT64, int64, Int64) - HANDLE_PACKED_TYPE(SINT32, int32, Int32) + HANDLE_PACKED_TYPE(SINT32, int32_t, Int32) HANDLE_PACKED_TYPE(SINT64, int64, Int64) - HANDLE_PACKED_TYPE(UINT32, uint32, UInt32) + HANDLE_PACKED_TYPE(UINT32, uint32_t, UInt32) HANDLE_PACKED_TYPE(UINT64, uint64, UInt64) - HANDLE_PACKED_TYPE(FIXED32, uint32, UInt32) + HANDLE_PACKED_TYPE(FIXED32, uint32_t, UInt32) HANDLE_PACKED_TYPE(FIXED64, uint64, UInt64) - HANDLE_PACKED_TYPE(SFIXED32, int32, Int32) + HANDLE_PACKED_TYPE(SFIXED32, int32_t, Int32) HANDLE_PACKED_TYPE(SFIXED64, int64, Int64) HANDLE_PACKED_TYPE(FLOAT, float, Float) @@ -494,7 +494,7 @@ bool WireFormat::ParseAndMergeField( } else { // The enum value is not one of the known values. Add it to the // UnknownFieldSet. - int64 sign_extended_value = static_cast<int64>(value); + int64_t sign_extended_value = static_cast<int64_t>(value); message_reflection->MutableUnknownFields(message)->AddVarint( WireFormatLite::GetTagFieldNumber(tag), sign_extended_value); } @@ -532,16 +532,16 @@ bool WireFormat::ParseAndMergeField( break; \ } - HANDLE_TYPE(INT32, int32, Int32) + HANDLE_TYPE(INT32, int32_t, Int32) HANDLE_TYPE(INT64, int64, Int64) - HANDLE_TYPE(SINT32, int32, Int32) + HANDLE_TYPE(SINT32, int32_t, Int32) HANDLE_TYPE(SINT64, int64, Int64) - HANDLE_TYPE(UINT32, uint32, UInt32) + HANDLE_TYPE(UINT32, uint32_t, UInt32) HANDLE_TYPE(UINT64, uint64, UInt64) - HANDLE_TYPE(FIXED32, uint32, UInt32) + HANDLE_TYPE(FIXED32, uint32_t, UInt32) HANDLE_TYPE(FIXED64, uint64, UInt64) - HANDLE_TYPE(SFIXED32, int32, Int32) + HANDLE_TYPE(SFIXED32, int32_t, Int32) HANDLE_TYPE(SFIXED64, int64, Int64) HANDLE_TYPE(FLOAT, float, Float) @@ -641,7 +641,7 @@ bool WireFormat::ParseAndMergeMessageSetItem(io::CodedInputStream* input, return ParseAndMergeMessageSetField(type_id, field, message, input); } - bool SkipField(uint32 tag, io::CodedInputStream* input) { + bool SkipField(uint32_t tag, io::CodedInputStream* input) { return WireFormat::SkipField(input, tag, NULL); } @@ -658,14 +658,14 @@ struct WireFormat::MessageSetParser { // Parse a MessageSetItem auto metadata = reflection->MutableInternalMetadata(msg); TProtoStringType payload; - uint32 type_id = 0; + uint32_t type_id = 0; bool payload_read = false; while (!ctx->Done(&ptr)) { // We use 64 bit tags in order to allow typeid's that span the whole // range of 32 bit numbers. - uint32 tag = static_cast<uint8>(*ptr++); + uint32_t tag = static_cast<uint8_t>(*ptr++); if (tag == WireFormatLite::kMessageSetTypeIdTag) { - uint64 tmp; + uint64_t tmp; ptr = ParseBigVarint(ptr, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); type_id = tmp; @@ -701,7 +701,7 @@ struct WireFormat::MessageSetParser { continue; } else if (tag == WireFormatLite::kMessageSetMessageTag) { if (type_id == 0) { - int32 size = ReadSize(&ptr); + int32_t size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ptr = ctx->ReadString(ptr, size, &payload); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); @@ -718,7 +718,7 @@ struct WireFormat::MessageSetParser { } } ptr = WireFormat::_InternalParseAndMergeField( - msg, ptr, ctx, static_cast<uint64>(type_id) * 8 + 2, reflection, + msg, ptr, ctx, static_cast<uint64_t>(type_id) * 8 + 2, reflection, field); type_id = 0; } @@ -740,7 +740,7 @@ struct WireFormat::MessageSetParser { const char* ParseMessageSet(const char* ptr, internal::ParseContext* ctx) { while (!ctx->Done(&ptr)) { - uint32 tag; + uint32_t tag; ptr = ReadTag(ptr, &tag); if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (tag == 0 || (tag & 7) == WireFormatLite::WIRETYPE_END_GROUP) { @@ -786,7 +786,7 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, return message_set.ParseMessageSet(ptr, ctx); } while (!ctx->Done(&ptr)) { - uint32 tag; + uint32_t tag; ptr = ReadTag(ptr, &tag); if (PROTOBUF_PREDICT_FALSE(ptr == nullptr)) return nullptr; if (tag == 0 || (tag & 7) == WireFormatLite::WIRETYPE_END_GROUP) { @@ -815,7 +815,7 @@ const char* WireFormat::_InternalParse(Message* msg, const char* ptr, } const char* WireFormat::_InternalParseAndMergeField( - Message* msg, const char* ptr, internal::ParseContext* ctx, uint64 tag, + Message* msg, const char* ptr, internal::ParseContext* ctx, uint64_t tag, const Reflection* reflection, const FieldDescriptor* field) { if (field == nullptr) { // unknown field set parser takes 64bit tags, because message set type ids @@ -836,16 +836,16 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; \ } - HANDLE_PACKED_TYPE(INT32, int32, Int32) + HANDLE_PACKED_TYPE(INT32, int32_t, Int32) HANDLE_PACKED_TYPE(INT64, int64, Int64) - HANDLE_PACKED_TYPE(SINT32, int32, SInt32) + HANDLE_PACKED_TYPE(SINT32, int32_t, SInt32) HANDLE_PACKED_TYPE(SINT64, int64, SInt64) - HANDLE_PACKED_TYPE(UINT32, uint32, UInt32) + HANDLE_PACKED_TYPE(UINT32, uint32_t, UInt32) HANDLE_PACKED_TYPE(UINT64, uint64, UInt64) - HANDLE_PACKED_TYPE(FIXED32, uint32, Fixed32) + HANDLE_PACKED_TYPE(FIXED32, uint32_t, Fixed32) HANDLE_PACKED_TYPE(FIXED64, uint64, Fixed64) - HANDLE_PACKED_TYPE(SFIXED32, int32, SFixed32) + HANDLE_PACKED_TYPE(SFIXED32, int32_t, SFixed32) HANDLE_PACKED_TYPE(SFIXED64, int64, SFixed64) HANDLE_PACKED_TYPE(FLOAT, float, Float) @@ -863,7 +863,7 @@ const char* WireFormat::_InternalParseAndMergeField( ptr = internal::PackedEnumParser(rep_enum, ptr, ctx); } else { return ctx->ReadPackedVarint( - ptr, [rep_enum, field, reflection, msg](uint64 val) { + ptr, [rep_enum, field, reflection, msg](uint64_t val) { if (field->enum_type()->FindValueByNumber(val) != nullptr) { rep_enum->Add(val); } else { @@ -906,14 +906,14 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; \ } - HANDLE_TYPE(BOOL, uint64, Bool) - HANDLE_TYPE(INT32, uint32, Int32) + HANDLE_TYPE(BOOL, uint64_t, Bool) + HANDLE_TYPE(INT32, uint32_t, Int32) HANDLE_TYPE(INT64, uint64, Int64) - HANDLE_TYPE(UINT32, uint32, UInt32) + HANDLE_TYPE(UINT32, uint32_t, UInt32) HANDLE_TYPE(UINT64, uint64, UInt64) case FieldDescriptor::TYPE_SINT32: { - int32 value = ReadVarintZigZag32(&ptr); + int32_t value = ReadVarintZigZag32(&ptr); if (ptr == nullptr) return nullptr; if (field->is_repeated()) { reflection->AddInt32(msg, field, value); @@ -923,7 +923,7 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; } case FieldDescriptor::TYPE_SINT64: { - int64 value = ReadVarintZigZag64(&ptr); + int64_t value = ReadVarintZigZag64(&ptr); if (ptr == nullptr) return nullptr; if (field->is_repeated()) { reflection->AddInt64(msg, field, value); @@ -946,9 +946,9 @@ const char* WireFormat::_InternalParseAndMergeField( return ptr; \ } - HANDLE_TYPE(FIXED32, uint32, UInt32) + HANDLE_TYPE(FIXED32, uint32_t, UInt32) HANDLE_TYPE(FIXED64, uint64, UInt64) - HANDLE_TYPE(SFIXED32, int32, Int32) + HANDLE_TYPE(SFIXED32, int32_t, Int32) HANDLE_TYPE(SFIXED64, int64, Int64) HANDLE_TYPE(FLOAT, float, Float) @@ -957,7 +957,7 @@ const char* WireFormat::_InternalParseAndMergeField( #undef HANDLE_TYPE case FieldDescriptor::TYPE_ENUM: { - uint32 value; + uint32_t value; ptr = VarintParse(ptr, &value); if (ptr == nullptr) return nullptr; if (field->is_repeated()) { @@ -1030,8 +1030,8 @@ const char* WireFormat::_InternalParseAndMergeField( // =================================================================== -uint8* WireFormat::_InternalSerialize(const Message& message, uint8* target, - io::EpsCopyOutputStream* stream) { +uint8_t* WireFormat::_InternalSerialize(const Message& message, uint8_t* target, + io::EpsCopyOutputStream* stream) { const Descriptor* descriptor = message.GetDescriptor(); const Reflection* message_reflection = message.GetReflection(); @@ -1059,9 +1059,9 @@ uint8* WireFormat::_InternalSerialize(const Message& message, uint8* target, } } -uint8* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, - const MapKey& value, uint8* target, - io::EpsCopyOutputStream* stream) { +uint8_t* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, + const MapKey& value, uint8_t* target, + io::EpsCopyOutputStream* stream) { target = stream->EnsureSpace(target); switch (field->type()) { case FieldDescriptor::TYPE_DOUBLE: @@ -1096,9 +1096,9 @@ uint8* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, return target; } -static uint8* SerializeMapValueRefWithCachedSizes( - const FieldDescriptor* field, const MapValueConstRef& value, uint8* target, - io::EpsCopyOutputStream* stream) { +static uint8_t* SerializeMapValueRefWithCachedSizes( + const FieldDescriptor* field, const MapValueConstRef& value, + uint8_t* target, io::EpsCopyOutputStream* stream) { target = stream->EnsureSpace(target); switch (field->type()) { #define CASE_TYPE(FieldType, CamelFieldType, CamelCppType) \ @@ -1180,11 +1180,11 @@ class MapKeySorter { }; }; -static uint8* InternalSerializeMapEntry(const FieldDescriptor* field, - const MapKey& key, - const MapValueConstRef& value, - uint8* target, - io::EpsCopyOutputStream* stream) { +static uint8_t* InternalSerializeMapEntry(const FieldDescriptor* field, + const MapKey& key, + const MapValueConstRef& value, + uint8_t* target, + io::EpsCopyOutputStream* stream) { const FieldDescriptor* key_field = field->message_type()->field(0); const FieldDescriptor* value_field = field->message_type()->field(1); @@ -1201,9 +1201,10 @@ static uint8* InternalSerializeMapEntry(const FieldDescriptor* field, return target; } -uint8* WireFormat::InternalSerializeField(const FieldDescriptor* field, - const Message& message, uint8* target, - io::EpsCopyOutputStream* stream) { +uint8_t* WireFormat::InternalSerializeField(const FieldDescriptor* field, + const Message& message, + uint8_t* target, + io::EpsCopyOutputStream* stream) { const Reflection* message_reflection = message.GetReflection(); if (field->is_extension() && @@ -1286,11 +1287,11 @@ uint8* WireFormat::InternalSerializeField(const FieldDescriptor* field, break; \ } - HANDLE_PRIMITIVE_TYPE(INT32, int32, Int32, Int32) + HANDLE_PRIMITIVE_TYPE(INT32, int32_t, Int32, Int32) HANDLE_PRIMITIVE_TYPE(INT64, int64, Int64, Int64) - HANDLE_PRIMITIVE_TYPE(SINT32, int32, SInt32, Int32) + HANDLE_PRIMITIVE_TYPE(SINT32, int32_t, SInt32, Int32) HANDLE_PRIMITIVE_TYPE(SINT64, int64, SInt64, Int64) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32, UInt32, UInt32) + HANDLE_PRIMITIVE_TYPE(UINT32, uint32_t, UInt32, UInt32) HANDLE_PRIMITIVE_TYPE(UINT64, uint64, UInt64, UInt64) HANDLE_PRIMITIVE_TYPE(ENUM, int32, Enum, Enum) @@ -1303,9 +1304,9 @@ uint8* WireFormat::InternalSerializeField(const FieldDescriptor* field, break; \ } - HANDLE_PRIMITIVE_TYPE(FIXED32, uint32, Fixed32, UInt32) + HANDLE_PRIMITIVE_TYPE(FIXED32, uint32_t, Fixed32, UInt32) HANDLE_PRIMITIVE_TYPE(FIXED64, uint64, Fixed64, UInt64) - HANDLE_PRIMITIVE_TYPE(SFIXED32, int32, SFixed32, Int32) + HANDLE_PRIMITIVE_TYPE(SFIXED32, int32_t, SFixed32, Int32) HANDLE_PRIMITIVE_TYPE(SFIXED64, int64, SFixed64, Int64) HANDLE_PRIMITIVE_TYPE(FLOAT, float, Float, Float) @@ -1334,16 +1335,16 @@ uint8* WireFormat::InternalSerializeField(const FieldDescriptor* field, break; \ } - HANDLE_PRIMITIVE_TYPE(INT32, int32, Int32, Int32) + HANDLE_PRIMITIVE_TYPE(INT32, int32_t, Int32, Int32) HANDLE_PRIMITIVE_TYPE(INT64, int64, Int64, Int64) - HANDLE_PRIMITIVE_TYPE(SINT32, int32, SInt32, Int32) + HANDLE_PRIMITIVE_TYPE(SINT32, int32_t, SInt32, Int32) HANDLE_PRIMITIVE_TYPE(SINT64, int64, SInt64, Int64) - HANDLE_PRIMITIVE_TYPE(UINT32, uint32, UInt32, UInt32) + HANDLE_PRIMITIVE_TYPE(UINT32, uint32_t, UInt32, UInt32) HANDLE_PRIMITIVE_TYPE(UINT64, uint64, UInt64, UInt64) - HANDLE_PRIMITIVE_TYPE(FIXED32, uint32, Fixed32, UInt32) + HANDLE_PRIMITIVE_TYPE(FIXED32, uint32_t, Fixed32, UInt32) HANDLE_PRIMITIVE_TYPE(FIXED64, uint64, Fixed64, UInt64) - HANDLE_PRIMITIVE_TYPE(SFIXED32, int32, SFixed32, Int32) + HANDLE_PRIMITIVE_TYPE(SFIXED32, int32_t, SFixed32, Int32) HANDLE_PRIMITIVE_TYPE(SFIXED64, int64, SFixed64, Int64) HANDLE_PRIMITIVE_TYPE(FLOAT, float, Float, Float) @@ -1418,8 +1419,8 @@ uint8* WireFormat::InternalSerializeField(const FieldDescriptor* field, return target; } -uint8* WireFormat::InternalSerializeMessageSetItem( - const FieldDescriptor* field, const Message& message, uint8* target, +uint8_t* WireFormat::InternalSerializeMessageSetItem( + const FieldDescriptor* field, const Message& message, uint8_t* target, io::EpsCopyOutputStream* stream) { const Reflection* message_reflection = message.GetReflection(); diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.h b/contrib/libs/protobuf/src/google/protobuf/wire_format.h index d4ffbdfd7b..7ca217a11b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.h @@ -132,8 +132,8 @@ class PROTOBUF_EXPORT WireFormat { "originally expected. Perhaps it was modified by another thread " "during serialization?"; } - static uint8* _InternalSerialize(const Message& message, uint8* target, - io::EpsCopyOutputStream* stream); + static uint8_t* _InternalSerialize(const Message& message, uint8_t* target, + io::EpsCopyOutputStream* stream); // Implements Message::ByteSize() via reflection. WARNING: The result // of this method is *not* cached anywhere. However, all embedded messages @@ -148,7 +148,7 @@ class PROTOBUF_EXPORT WireFormat { // Skips a field value of the given WireType. The input should start // positioned immediately after the tag. If unknown_fields is non-NULL, // the contents of the field will be added to it. - static bool SkipField(io::CodedInputStream* input, uint32 tag, + static bool SkipField(io::CodedInputStream* input, uint32_t tag, UnknownFieldSet* unknown_fields); // Reads and ignores a message from the input. If unknown_fields is @@ -160,7 +160,7 @@ class PROTOBUF_EXPORT WireFormat { // for which is_valid(value) returns false are appended to // unknown_fields_stream. static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, - uint32 field_number, + uint32_t field_number, bool (*is_valid)(int), UnknownFieldSet* unknown_fields, RepeatedField<int>* values); @@ -176,16 +176,16 @@ class PROTOBUF_EXPORT WireFormat { // ComputeUnknownFieldsSize(unknown_fields). // // Returns a pointer past the last written byte. - static uint8* SerializeUnknownFieldsToArray( - const UnknownFieldSet& unknown_fields, uint8* target) { + static uint8_t* SerializeUnknownFieldsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target) { io::EpsCopyOutputStream stream( target, static_cast<int>(ComputeUnknownFieldsSize(unknown_fields)), io::CodedOutputStream::IsDefaultSerializationDeterministic()); return InternalSerializeUnknownFieldsToArray(unknown_fields, target, &stream); } - static uint8* InternalSerializeUnknownFieldsToArray( - const UnknownFieldSet& unknown_fields, uint8* target, + static uint8_t* InternalSerializeUnknownFieldsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target, io::EpsCopyOutputStream* stream); // Same thing except for messages that have the message_set_wire_format @@ -200,10 +200,10 @@ class PROTOBUF_EXPORT WireFormat { // ComputeUnknownMessageSetItemsSize(unknown_fields). // // Returns a pointer past the last written byte. - static uint8* SerializeUnknownMessageSetItemsToArray( - const UnknownFieldSet& unknown_fields, uint8* target); - static uint8* InternalSerializeUnknownMessageSetItemsToArray( - const UnknownFieldSet& unknown_fields, uint8* target, + static uint8_t* SerializeUnknownMessageSetItemsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target); + static uint8_t* InternalSerializeUnknownMessageSetItemsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target, io::EpsCopyOutputStream* stream); // Compute the size of the UnknownFieldSet on the wire. @@ -219,12 +219,12 @@ class PROTOBUF_EXPORT WireFormat { // // This is different from MakeTag(field->number(), field->type()) in the // case of packed repeated fields. - static uint32 MakeTag(const FieldDescriptor* field); + static uint32_t MakeTag(const FieldDescriptor* field); // Parse a single field. The input should start out positioned immediately // after the tag. static bool ParseAndMergeField( - uint32 tag, + uint32_t tag, const FieldDescriptor* field, // May be NULL for unknown Message* message, io::CodedInputStream* input); @@ -235,9 +235,9 @@ class PROTOBUF_EXPORT WireFormat { output->SetCur(InternalSerializeField(field, message, output->Cur(), output->EpsCopy())); } - static uint8* InternalSerializeField( + static uint8_t* InternalSerializeField( const FieldDescriptor* field, // Cannot be NULL - const Message& message, uint8* target, io::EpsCopyOutputStream* stream); + const Message& message, uint8_t* target, io::EpsCopyOutputStream* stream); // Compute size of a single field. If the field is a message type, this // will call ByteSize() for the embedded message, insuring that it caches @@ -255,8 +255,8 @@ class PROTOBUF_EXPORT WireFormat { output->SetCur(InternalSerializeMessageSetItem( field, message, output->Cur(), output->EpsCopy())); } - static uint8* InternalSerializeMessageSetItem( - const FieldDescriptor* field, const Message& message, uint8* target, + static uint8_t* InternalSerializeMessageSetItem( + const FieldDescriptor* field, const Message& message, uint8_t* target, io::EpsCopyOutputStream* stream); static size_t MessageSetItemByteSize(const FieldDescriptor* field, const Message& message); @@ -287,18 +287,18 @@ class PROTOBUF_EXPORT WireFormat { struct MessageSetParser; // Skip a MessageSet field. static bool SkipMessageSetField(io::CodedInputStream* input, - uint32 field_number, + uint32_t field_number, UnknownFieldSet* unknown_fields); // Parse a MessageSet field. - static bool ParseAndMergeMessageSetField(uint32 field_number, + static bool ParseAndMergeMessageSetField(uint32_t field_number, const FieldDescriptor* field, Message* message, io::CodedInputStream* input); // Parses the value from the wire that belongs to tag. static const char* _InternalParseAndMergeField(Message* msg, const char* ptr, internal::ParseContext* ctx, - uint64 tag, + uint64_t tag, const Reflection* reflection, const FieldDescriptor* field); @@ -313,7 +313,7 @@ class PROTOBUF_EXPORT UnknownFieldSetFieldSkipper : public FieldSkipper { ~UnknownFieldSetFieldSkipper() override {} // implements FieldSkipper ----------------------------------------- - bool SkipField(io::CodedInputStream* input, uint32 tag) override; + bool SkipField(io::CodedInputStream* input, uint32_t tag) override; bool SkipMessage(io::CodedInputStream* input) override; void SkipUnknownEnum(int field_number, int value) override; @@ -340,7 +340,7 @@ inline WireFormatLite::WireType WireFormat::WireTypeForFieldType( static_cast<WireFormatLite::FieldType>(implicit_cast<int>(type))); } -inline uint32 WireFormat::MakeTag(const FieldDescriptor* field) { +inline uint32_t WireFormat::MakeTag(const FieldDescriptor* field) { return WireFormatLite::MakeTag(field->number(), WireTypeForField(field)); } @@ -382,8 +382,8 @@ inline void WireFormat::VerifyUTF8StringNamedField(const char* data, int size, } -inline uint8* InternalSerializeUnknownMessageSetItemsToArray( - const UnknownFieldSet& unknown_fields, uint8* target, +inline uint8_t* InternalSerializeUnknownMessageSetItemsToArray( + const UnknownFieldSet& unknown_fields, uint8_t* target, io::EpsCopyOutputStream* stream) { return WireFormat::InternalSerializeUnknownMessageSetItemsToArray( unknown_fields, target, stream); @@ -402,9 +402,9 @@ size_t ComputeUnknownFieldsSize(const InternalMetadata& metadata, size_t size, size_t MapKeyDataOnlyByteSize(const FieldDescriptor* field, const MapKey& value); -uint8* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, - const MapKey& value, uint8* target, - io::EpsCopyOutputStream* stream); +uint8_t* SerializeMapKeyWithCachedSizes(const FieldDescriptor* field, + const MapKey& value, uint8_t* target, + io::EpsCopyOutputStream* stream); } // namespace internal } // namespace protobuf } // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc index ed82bdd48e..7661c9d27e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc @@ -120,22 +120,22 @@ const WireFormatLite::WireType WireFormatLite::WIRETYPE_VARINT, // TYPE_SINT64 }; -bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag) { +bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag) { // Field number 0 is illegal. if (WireFormatLite::GetTagFieldNumber(tag) == 0) return false; switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { - uint64 value; + uint64_t value; if (!input->ReadVarint64(&value)) return false; return true; } case WireFormatLite::WIRETYPE_FIXED64: { - uint64 value; + uint64_t value; if (!input->ReadLittleEndian64(&value)) return false; return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; if (!input->Skip(length)) return false; return true; @@ -156,7 +156,7 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag) { return false; } case WireFormatLite::WIRETYPE_FIXED32: { - uint32 value; + uint32_t value; if (!input->ReadLittleEndian32(&value)) return false; return true; } @@ -166,27 +166,27 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag) { } } -bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag, +bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32_t tag, io::CodedOutputStream* output) { // Field number 0 is illegal. if (WireFormatLite::GetTagFieldNumber(tag) == 0) return false; switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { - uint64 value; + uint64_t value; if (!input->ReadVarint64(&value)) return false; output->WriteVarint32(tag); output->WriteVarint64(value); return true; } case WireFormatLite::WIRETYPE_FIXED64: { - uint64 value; + uint64_t value; if (!input->ReadLittleEndian64(&value)) return false; output->WriteVarint32(tag); output->WriteLittleEndian64(value); return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; output->WriteVarint32(tag); output->WriteVarint32(length); @@ -213,7 +213,7 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag, return false; } case WireFormatLite::WIRETYPE_FIXED32: { - uint32 value; + uint32_t value; if (!input->ReadLittleEndian32(&value)) return false; output->WriteVarint32(tag); output->WriteLittleEndian32(value); @@ -227,7 +227,7 @@ bool WireFormatLite::SkipField(io::CodedInputStream* input, uint32 tag, bool WireFormatLite::SkipMessage(io::CodedInputStream* input) { while (true) { - uint32 tag = input->ReadTag(); + uint32_t tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -247,7 +247,7 @@ bool WireFormatLite::SkipMessage(io::CodedInputStream* input) { bool WireFormatLite::SkipMessage(io::CodedInputStream* input, io::CodedOutputStream* output) { while (true) { - uint32 tag = input->ReadTag(); + uint32_t tag = input->ReadTag(); if (tag == 0) { // End of input. This is a valid place to end, so return true. return true; @@ -265,7 +265,7 @@ bool WireFormatLite::SkipMessage(io::CodedInputStream* input, } } -bool FieldSkipper::SkipField(io::CodedInputStream* input, uint32 tag) { +bool FieldSkipper::SkipField(io::CodedInputStream* input, uint32_t tag) { return WireFormatLite::SkipField(input, tag); } @@ -278,7 +278,7 @@ void FieldSkipper::SkipUnknownEnum(int /* field_number */, int /* value */) { } bool CodedOutputStreamFieldSkipper::SkipField(io::CodedInputStream* input, - uint32 tag) { + uint32_t tag) { return WireFormatLite::SkipField(input, tag, unknown_fields_); } @@ -295,7 +295,7 @@ void CodedOutputStreamFieldSkipper::SkipUnknownEnum(int field_number, bool WireFormatLite::ReadPackedEnumPreserveUnknowns( io::CodedInputStream* input, int field_number, bool (*is_valid)(int), io::CodedOutputStream* unknown_fields_stream, RepeatedField<int>* values) { - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; io::CodedInputStream::Limit limit = input->PushLimit(length); while (input->BytesUntilLimit() > 0) { @@ -306,8 +306,8 @@ bool WireFormatLite::ReadPackedEnumPreserveUnknowns( if (is_valid == NULL || is_valid(value)) { values->Add(value); } else { - uint32 tag = WireFormatLite::MakeTag(field_number, - WireFormatLite::WIRETYPE_VARINT); + uint32_t tag = WireFormatLite::MakeTag(field_number, + WireFormatLite::WIRETYPE_VARINT); unknown_fields_stream->WriteVarint32(tag); unknown_fields_stream->WriteVarint32(value); } @@ -319,31 +319,31 @@ bool WireFormatLite::ReadPackedEnumPreserveUnknowns( #if !defined(PROTOBUF_LITTLE_ENDIAN) namespace { -void EncodeFixedSizeValue(float v, uint8* dest) { +void EncodeFixedSizeValue(float v, uint8_t* dest) { WireFormatLite::WriteFloatNoTagToArray(v, dest); } -void EncodeFixedSizeValue(double v, uint8* dest) { +void EncodeFixedSizeValue(double v, uint8_t* dest) { WireFormatLite::WriteDoubleNoTagToArray(v, dest); } -void EncodeFixedSizeValue(uint32 v, uint8* dest) { +void EncodeFixedSizeValue(uint32_t v, uint8_t* dest) { WireFormatLite::WriteFixed32NoTagToArray(v, dest); } -void EncodeFixedSizeValue(uint64 v, uint8* dest) { +void EncodeFixedSizeValue(uint64_t v, uint8_t* dest) { WireFormatLite::WriteFixed64NoTagToArray(v, dest); } -void EncodeFixedSizeValue(int32 v, uint8* dest) { +void EncodeFixedSizeValue(int32_t v, uint8_t* dest) { WireFormatLite::WriteSFixed32NoTagToArray(v, dest); } -void EncodeFixedSizeValue(int64 v, uint8* dest) { +void EncodeFixedSizeValue(int64_t v, uint8_t* dest) { WireFormatLite::WriteSFixed64NoTagToArray(v, dest); } -void EncodeFixedSizeValue(bool v, uint8* dest) { +void EncodeFixedSizeValue(bool v, uint8_t* dest) { WireFormatLite::WriteBoolNoTagToArray(v, dest); } } // anonymous namespace @@ -356,10 +356,10 @@ static void WriteArray(const CType* a, int n, io::CodedOutputStream* output) { output->WriteRaw(reinterpret_cast<const char*>(a), n * sizeof(a[0])); #else const int kAtATime = 128; - uint8 buf[sizeof(CType) * kAtATime]; + uint8_t buf[sizeof(CType) * kAtATime]; for (int i = 0; i < n; i += kAtATime) { int to_do = std::min(kAtATime, n - i); - uint8* ptr = buf; + uint8_t* ptr = buf; for (int j = 0; j < to_do; j++) { EncodeFixedSizeValue(a[i + j], ptr); ptr += sizeof(a[0]); @@ -379,24 +379,24 @@ void WireFormatLite::WriteDoubleArray(const double* a, int n, WriteArray<double>(a, n, output); } -void WireFormatLite::WriteFixed32Array(const uint32* a, int n, +void WireFormatLite::WriteFixed32Array(const uint32_t* a, int n, io::CodedOutputStream* output) { - WriteArray<uint32>(a, n, output); + WriteArray<uint32_t>(a, n, output); } -void WireFormatLite::WriteFixed64Array(const uint64* a, int n, +void WireFormatLite::WriteFixed64Array(const uint64_t* a, int n, io::CodedOutputStream* output) { - WriteArray<uint64>(a, n, output); + WriteArray<uint64_t>(a, n, output); } -void WireFormatLite::WriteSFixed32Array(const int32* a, int n, +void WireFormatLite::WriteSFixed32Array(const int32_t* a, int n, io::CodedOutputStream* output) { - WriteArray<int32>(a, n, output); + WriteArray<int32_t>(a, n, output); } -void WireFormatLite::WriteSFixed64Array(const int64* a, int n, +void WireFormatLite::WriteSFixed64Array(const int64_t* a, int n, io::CodedOutputStream* output) { - WriteArray<int64>(a, n, output); + WriteArray<int64_t>(a, n, output); } void WireFormatLite::WriteBoolArray(const bool* a, int n, @@ -404,52 +404,52 @@ void WireFormatLite::WriteBoolArray(const bool* a, int n, WriteArray<bool>(a, n, output); } -void WireFormatLite::WriteInt32(int field_number, int32 value, +void WireFormatLite::WriteInt32(int field_number, int32_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteInt32NoTag(value, output); } -void WireFormatLite::WriteInt64(int field_number, int64 value, +void WireFormatLite::WriteInt64(int field_number, int64_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteInt64NoTag(value, output); } -void WireFormatLite::WriteUInt32(int field_number, uint32 value, +void WireFormatLite::WriteUInt32(int field_number, uint32_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteUInt32NoTag(value, output); } -void WireFormatLite::WriteUInt64(int field_number, uint64 value, +void WireFormatLite::WriteUInt64(int field_number, uint64_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteUInt64NoTag(value, output); } -void WireFormatLite::WriteSInt32(int field_number, int32 value, +void WireFormatLite::WriteSInt32(int field_number, int32_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteSInt32NoTag(value, output); } -void WireFormatLite::WriteSInt64(int field_number, int64 value, +void WireFormatLite::WriteSInt64(int field_number, int64_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_VARINT, output); WriteSInt64NoTag(value, output); } -void WireFormatLite::WriteFixed32(int field_number, uint32 value, +void WireFormatLite::WriteFixed32(int field_number, uint32_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED32, output); WriteFixed32NoTag(value, output); } -void WireFormatLite::WriteFixed64(int field_number, uint64 value, +void WireFormatLite::WriteFixed64(int field_number, uint64_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED64, output); WriteFixed64NoTag(value, output); } -void WireFormatLite::WriteSFixed32(int field_number, int32 value, +void WireFormatLite::WriteSFixed32(int field_number, int32_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED32, output); WriteSFixed32NoTag(value, output); } -void WireFormatLite::WriteSFixed64(int field_number, int64 value, +void WireFormatLite::WriteSFixed64(int field_number, int64_t value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_FIXED64, output); WriteSFixed64NoTag(value, output); @@ -551,7 +551,7 @@ PROTOBUF_NDEBUG_INLINE static bool ReadBytesToString( io::CodedInputStream* input, TProtoStringType* value); inline static bool ReadBytesToString(io::CodedInputStream* input, TProtoStringType* value) { - uint32 length; + uint32_t length; return input->ReadVarint32(&length) && input->ReadString(value, length); } @@ -614,10 +614,10 @@ static size_t VarintSize(const T* data, const int n) { "Cannot SignExtended unsigned types"); static_assert(!(SignExtended && ZigZag), "Cannot SignExtended and ZigZag on the same type"); - uint32 sum = n; - uint32 msb_sum = 0; + uint32_t sum = n; + uint32_t msb_sum = 0; for (int i = 0; i < n; i++) { - uint32 x = data[i]; + uint32_t x = data[i]; if (ZigZag) { x = WireFormatLite::ZigZagEncode32(x); } else if (SignExtended) { @@ -642,16 +642,16 @@ static size_t VarintSize64(const T* data, const int n) { // is_unsigned<T> => !ZigZag static_assert(!ZigZag || !std::is_unsigned<T>::value, "Cannot ZigZag encode unsigned types"); - uint64 sum = n; + uint64_t sum = n; for (int i = 0; i < n; i++) { - uint64 x = data[i]; + uint64_t x = data[i]; if (ZigZag) { x = WireFormatLite::ZigZagEncode64(x); } // First step is a binary search, we can't branch in sse so we use the // result of the compare to adjust sum and appropriately. This code is // written to make clang recognize the vectorization. - uint64 tmp = x >= (static_cast<uint64>(1) << 35) ? -1 : 0; + uint64_t tmp = x >= (static_cast<uint64_t>(1) << 35) ? -1 : 0; sum += 5 & tmp; x >>= 35 & tmp; if (x > 0x7F) sum++; @@ -667,15 +667,15 @@ static size_t VarintSize64(const T* data, const int n) { // varint size routine for each element is faster. // Hence we enable it only for clang #if defined(__SSE__) && defined(__clang__) -size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) { +size_t WireFormatLite::Int32Size(const RepeatedField<int32_t>& value) { return VarintSize<false, true>(value.data(), value.size()); } -size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) { +size_t WireFormatLite::UInt32Size(const RepeatedField<uint32_t>& value) { return VarintSize<false, false>(value.data(), value.size()); } -size_t WireFormatLite::SInt32Size(const RepeatedField<int32>& value) { +size_t WireFormatLite::SInt32Size(const RepeatedField<int32_t>& value) { return VarintSize<true, false>(value.data(), value.size()); } @@ -686,7 +686,7 @@ size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) { #else // !(defined(__SSE4_1__) && defined(__clang__)) -size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) { +size_t WireFormatLite::Int32Size(const RepeatedField<int32_t>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -695,7 +695,7 @@ size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) { return out; } -size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) { +size_t WireFormatLite::UInt32Size(const RepeatedField<uint32_t>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -704,7 +704,7 @@ size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) { return out; } -size_t WireFormatLite::SInt32Size(const RepeatedField<int32>& value) { +size_t WireFormatLite::SInt32Size(const RepeatedField<int32_t>& value) { size_t out = 0; const int n = value.size(); for (int i = 0; i < n; i++) { @@ -733,14 +733,28 @@ size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) { size_t WireFormatLite::Int64Size(const RepeatedField<int64>& value) { return VarintSize64<false>(value.data(), value.size()); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +size_t WireFormatLite::Int64Size(const RepeatedField<int64_t>& value) { + return VarintSize64<false>(value.data(), value.size()); +} +#endif size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) { return VarintSize64<false>(value.data(), value.size()); } - +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +size_t WireFormatLite::UInt64Size(const RepeatedField<uint64_t>& value) { + return VarintSize64<false>(value.data(), value.size()); +} +#endif size_t WireFormatLite::SInt64Size(const RepeatedField<int64>& value) { return VarintSize64<true>(value.data(), value.size()); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +size_t WireFormatLite::SInt64Size(const RepeatedField<int64_t>& value) { + return VarintSize64<true>(value.data(), value.size()); +} +#endif #else @@ -753,6 +767,17 @@ size_t WireFormatLite::Int64Size(const RepeatedField<int64>& value) { return out; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +size_t WireFormatLite::Int64Size(const RepeatedField<int64_t>& value) { + size_t out = 0; + const int n = value.size(); + for (int i = 0; i < n; i++) { + out += Int64Size(value.Get(i)); + } + return out; +} +#endif + size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) { size_t out = 0; const int n = value.size(); @@ -761,6 +786,16 @@ size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) { } return out; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +size_t WireFormatLite::UInt64Size(const RepeatedField<uint64_t>& value) { + size_t out = 0; + const int n = value.size(); + for (int i = 0; i < n; i++) { + out += UInt64Size(value.Get(i)); + } + return out; +} +#endif size_t WireFormatLite::SInt64Size(const RepeatedField<int64>& value) { size_t out = 0; @@ -770,6 +805,16 @@ size_t WireFormatLite::SInt64Size(const RepeatedField<int64>& value) { } return out; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +size_t WireFormatLite::SInt64Size(const RepeatedField<int64_t>& value) { + size_t out = 0; + const int n = value.size(); + for (int i = 0; i < n; i++) { + out += SInt64Size(value.Get(i)); + } + return out; +} +#endif #endif diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h index 041dafad44..bb6019983f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h @@ -153,16 +153,16 @@ class PROTOBUF_EXPORT WireFormatLite { // Number of bits in a tag which identify the wire type. static constexpr int kTagTypeBits = 3; // Mask for those bits. - static constexpr uint32 kTagTypeMask = (1 << kTagTypeBits) - 1; + static constexpr uint32_t kTagTypeMask = (1 << kTagTypeBits) - 1; // Helper functions for encoding and decoding tags. (Inlined below and in // _inl.h) // // This is different from MakeTag(field->number(), field->type()) in the // case of packed repeated fields. - constexpr static uint32 MakeTag(int field_number, WireType type); - static WireType GetTagWireType(uint32 tag); - static int GetTagFieldNumber(uint32 tag); + constexpr static uint32_t MakeTag(int field_number, WireType type); + static WireType GetTagWireType(uint32_t tag); + static int GetTagFieldNumber(uint32_t tag); // Compute the byte size of a tag. For groups, this includes both the start // and end tags. @@ -173,12 +173,12 @@ class PROTOBUF_EXPORT WireFormatLite { // positioned immediately after the tag. Skipped values are simply // discarded, not recorded anywhere. See WireFormat::SkipField() for a // version that records to an UnknownFieldSet. - static bool SkipField(io::CodedInputStream* input, uint32 tag); + static bool SkipField(io::CodedInputStream* input, uint32_t tag); // Skips a field value with the given tag. The input should start // positioned immediately after the tag. Skipped values are recorded to a // CodedOutputStream. - static bool SkipField(io::CodedInputStream* input, uint32 tag, + static bool SkipField(io::CodedInputStream* input, uint32_t tag, io::CodedOutputStream* output); // Reads and ignores a message from the input. Skipped values are simply @@ -196,7 +196,7 @@ class PROTOBUF_EXPORT WireFormatLite { // as a switch case or a template input. WireFormatLite::MakeTag() is more // type-safe, though, so prefer it if possible. #define GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(FIELD_NUMBER, TYPE) \ - static_cast<uint32>((static_cast<uint32>(FIELD_NUMBER) << 3) | (TYPE)) + static_cast<uint32_t>((static_cast<uint32_t>(FIELD_NUMBER) << 3) | (TYPE)) // These are the tags for the old MessageSet format, which was defined as: // message MessageSet { @@ -223,10 +223,10 @@ class PROTOBUF_EXPORT WireFormatLite { // Helper functions for converting between floats/doubles and IEEE-754 // uint32s/uint64s so that they can be written. (Assumes your platform // uses IEEE-754 floats.) - static uint32 EncodeFloat(float value); - static float DecodeFloat(uint32 value); - static uint64 EncodeDouble(double value); - static double DecodeDouble(uint64 value); + static uint32_t EncodeFloat(float value); + static float DecodeFloat(uint32_t value); + static uint64_t EncodeDouble(double value); + static double DecodeDouble(uint64_t value); // Helper functions for mapping signed integers to unsigned integers in // such a way that numbers with small magnitudes will encode to smaller @@ -234,10 +234,10 @@ class PROTOBUF_EXPORT WireFormatLite { // number and varint-encode it, it will always take 10 bytes, defeating // the purpose of varint. So, for the "sint32" and "sint64" field types, // we ZigZag-encode the values. - static uint32 ZigZagEncode32(int32 n); - static int32 ZigZagDecode32(uint32 n); - static uint64 ZigZagEncode64(int64 n); - static int64 ZigZagDecode64(uint64 n); + static uint32_t ZigZagEncode32(int32_t n); + static int32_t ZigZagDecode32(uint32_t n); + static uint64_t ZigZagEncode64(int64_t n); + static int64_t ZigZagDecode64(uint64_t n); // ================================================================= // Methods for reading/writing individual field. @@ -257,13 +257,13 @@ class PROTOBUF_EXPORT WireFormatLite { // protocol compiler. template <typename CType, enum FieldType DeclaredType> PROTOBUF_NDEBUG_INLINE static bool ReadRepeatedPrimitive( - int tag_size, uint32 tag, io::CodedInputStream* input, + int tag_size, uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* value); // Identical to ReadRepeatedPrimitive, except will not inline the // implementation. template <typename CType, enum FieldType DeclaredType> - static bool ReadRepeatedPrimitiveNoInline(int tag_size, uint32 tag, + static bool ReadRepeatedPrimitiveNoInline(int tag_size, uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* value); @@ -273,8 +273,8 @@ class PROTOBUF_EXPORT WireFormatLite { // This is only implemented for the types with fixed wire size, e.g. // float, double, and the (s)fixed* types. template <typename CType, enum FieldType DeclaredType> - PROTOBUF_NDEBUG_INLINE static const uint8* ReadPrimitiveFromArray( - const uint8* buffer, CType* value); + PROTOBUF_NDEBUG_INLINE static const uint8_t* ReadPrimitiveFromArray( + const uint8_t* buffer, CType* value); // Reads a primitive packed field. // @@ -346,25 +346,45 @@ class PROTOBUF_EXPORT WireFormatLite { // Write fields, without tags. PROTOBUF_NDEBUG_INLINE static void WriteInt32NoTag( - int32 value, io::CodedOutputStream* output); + int32_t value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteInt64NoTag( int64 value, io::CodedOutputStream* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static void WriteInt64NoTag( + int64_t value, io::CodedOutputStream* output); +#endif PROTOBUF_NDEBUG_INLINE static void WriteUInt32NoTag( - uint32 value, io::CodedOutputStream* output); + uint32_t value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteUInt64NoTag( uint64 value, io::CodedOutputStream* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static void WriteUInt64NoTag( + uint64_t value, io::CodedOutputStream* output); +#endif PROTOBUF_NDEBUG_INLINE static void WriteSInt32NoTag( - int32 value, io::CodedOutputStream* output); + int32_t value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteSInt64NoTag( int64 value, io::CodedOutputStream* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static void WriteSInt64NoTag( + int64_t value, io::CodedOutputStream* output); +#endif PROTOBUF_NDEBUG_INLINE static void WriteFixed32NoTag( - uint32 value, io::CodedOutputStream* output); + uint32_t value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteFixed64NoTag( uint64 value, io::CodedOutputStream* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static void WriteFixed64NoTag( + uint64_t value, io::CodedOutputStream* output); +#endif PROTOBUF_NDEBUG_INLINE static void WriteSFixed32NoTag( - int32 value, io::CodedOutputStream* output); + int32_t value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteSFixed64NoTag( int64 value, io::CodedOutputStream* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static void WriteSFixed64NoTag( + int64_t value, io::CodedOutputStream* output); +#endif PROTOBUF_NDEBUG_INLINE static void WriteFloatNoTag( float value, io::CodedOutputStream* output); PROTOBUF_NDEBUG_INLINE static void WriteDoubleNoTag( @@ -379,37 +399,37 @@ class PROTOBUF_EXPORT WireFormatLite { io::CodedOutputStream* output); static void WriteDoubleArray(const double* a, int n, io::CodedOutputStream* output); - static void WriteFixed32Array(const uint32* a, int n, + static void WriteFixed32Array(const uint32_t* a, int n, io::CodedOutputStream* output); - static void WriteFixed64Array(const uint64* a, int n, + static void WriteFixed64Array(const uint64_t* a, int n, io::CodedOutputStream* output); - static void WriteSFixed32Array(const int32* a, int n, + static void WriteSFixed32Array(const int32_t* a, int n, io::CodedOutputStream* output); - static void WriteSFixed64Array(const int64* a, int n, + static void WriteSFixed64Array(const int64_t* a, int n, io::CodedOutputStream* output); static void WriteBoolArray(const bool* a, int n, io::CodedOutputStream* output); // Write fields, including tags. - static void WriteInt32(int field_number, int32 value, + static void WriteInt32(int field_number, int32_t value, io::CodedOutputStream* output); - static void WriteInt64(int field_number, int64 value, + static void WriteInt64(int field_number, int64_t value, io::CodedOutputStream* output); - static void WriteUInt32(int field_number, uint32 value, + static void WriteUInt32(int field_number, uint32_t value, io::CodedOutputStream* output); - static void WriteUInt64(int field_number, uint64 value, + static void WriteUInt64(int field_number, uint64_t value, io::CodedOutputStream* output); - static void WriteSInt32(int field_number, int32 value, + static void WriteSInt32(int field_number, int32_t value, io::CodedOutputStream* output); - static void WriteSInt64(int field_number, int64 value, + static void WriteSInt64(int field_number, int64_t value, io::CodedOutputStream* output); - static void WriteFixed32(int field_number, uint32 value, + static void WriteFixed32(int field_number, uint32_t value, io::CodedOutputStream* output); - static void WriteFixed64(int field_number, uint64 value, + static void WriteFixed64(int field_number, uint64_t value, io::CodedOutputStream* output); - static void WriteSFixed32(int field_number, int32 value, + static void WriteSFixed32(int field_number, int32_t value, io::CodedOutputStream* output); - static void WriteSFixed64(int field_number, int64 value, + static void WriteSFixed64(int field_number, int64_t value, io::CodedOutputStream* output); static void WriteFloat(int field_number, float value, io::CodedOutputStream* output); @@ -455,161 +475,201 @@ class PROTOBUF_EXPORT WireFormatLite { io::CodedOutputStream* output); // Like above, but use only *ToArray methods of CodedOutputStream. - PROTOBUF_NDEBUG_INLINE static uint8* WriteTagToArray(int field_number, - WireType type, - uint8* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteTagToArray(int field_number, + WireType type, + uint8_t* target); // Write fields, without tags. - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt32NoTagToArray(int32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt64NoTagToArray(int64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt32NoTagToArray(uint32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt64NoTagToArray(uint64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt32NoTagToArray(int32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt64NoTagToArray(int64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed32NoTagToArray(uint32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed64NoTagToArray(uint64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed32NoTagToArray(int32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed64NoTagToArray(int64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFloatNoTagToArray(float value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteDoubleNoTagToArray(double value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteBoolNoTagToArray(bool value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteEnumNoTagToArray(int value, - uint8* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32NoTagToArray( + int32_t value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( + int64 value, uint8_t* target); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( + int64_t value, uint8_t* target); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32NoTagToArray( + uint32_t value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( + uint64 value, uint8_t* target); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( + uint64_t value, uint8_t* target); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32NoTagToArray( + int32_t value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( + int64 value, uint8_t* target); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( + int64_t value, uint8_t* target); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32NoTagToArray( + uint32_t value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( + uint64 value, uint8_t* target); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( + uint64_t value, uint8_t* target); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32NoTagToArray( + int32_t value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( + int64 value, uint8_t* target); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( + int64_t value, uint8_t* target); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatNoTagToArray( + float value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleNoTagToArray( + double value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteBoolNoTagToArray(bool value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteEnumNoTagToArray(int value, + uint8_t* target); // Write fields, without tags. These require that value.size() > 0. template <typename T> - PROTOBUF_NDEBUG_INLINE static uint8* WritePrimitiveNoTagToArray( - const RepeatedField<T>& value, uint8* (*Writer)(T, uint8*), - uint8* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WritePrimitiveNoTagToArray( + const RepeatedField<T>& value, uint8_t* (*Writer)(T, uint8_t*), + uint8_t* target); template <typename T> - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixedNoTagToArray( - const RepeatedField<T>& value, uint8* (*Writer)(T, uint8*), - uint8* target); - - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt32NoTagToArray( - const RepeatedField<int32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt64NoTagToArray( - const RepeatedField<int64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt32NoTagToArray( - const RepeatedField<uint32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt64NoTagToArray( - const RepeatedField<uint64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt32NoTagToArray( - const RepeatedField<int32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt64NoTagToArray( - const RepeatedField<int64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed32NoTagToArray( - const RepeatedField<uint32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed64NoTagToArray( - const RepeatedField<uint64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed32NoTagToArray( - const RepeatedField<int32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed64NoTagToArray( - const RepeatedField<int64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFloatNoTagToArray( - const RepeatedField<float>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteDoubleNoTagToArray( - const RepeatedField<double>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteBoolNoTagToArray( - const RepeatedField<bool>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteEnumNoTagToArray( - const RepeatedField<int>& value, uint8* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixedNoTagToArray( + const RepeatedField<T>& value, uint8_t* (*Writer)(T, uint8_t*), + uint8_t* target); + + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32NoTagToArray( + const RepeatedField<int32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( + const RepeatedField<int64>& value, uint8_t* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64NoTagToArray( + const RepeatedField<int64_t>& value, uint8_t* output); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32NoTagToArray( + const RepeatedField<uint32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( + const RepeatedField<uint64>& value, uint8_t* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64NoTagToArray( + const RepeatedField<uint64_t>& value, uint8_t* output); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32NoTagToArray( + const RepeatedField<int32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( + const RepeatedField<int64>& value, uint8_t* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64NoTagToArray( + const RepeatedField<int64_t>& value, uint8_t* output); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32NoTagToArray( + const RepeatedField<uint32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( + const RepeatedField<uint64>& value, uint8_t* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64NoTagToArray( + const RepeatedField<uint64_t>& value, uint8_t* output); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32NoTagToArray( + const RepeatedField<int32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( + const RepeatedField<int64>& value, uint8_t* output); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64NoTagToArray( + const RepeatedField<int64_t>& value, uint8_t* output); +#endif + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatNoTagToArray( + const RepeatedField<float>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleNoTagToArray( + const RepeatedField<double>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteBoolNoTagToArray( + const RepeatedField<bool>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteEnumNoTagToArray( + const RepeatedField<int>& value, uint8_t* output); // Write fields, including tags. - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt32ToArray(int field_number, - int32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt64ToArray(int field_number, - int64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt32ToArray(int field_number, - uint32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt64ToArray(int field_number, - uint64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt32ToArray(int field_number, - int32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt64ToArray(int field_number, - int64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed32ToArray(int field_number, - uint32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed64ToArray(int field_number, - uint64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed32ToArray(int field_number, - int32 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed64ToArray(int field_number, - int64 value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFloatToArray(int field_number, - float value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteDoubleToArray(int field_number, - double value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteBoolToArray(int field_number, - bool value, - uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteEnumToArray(int field_number, - int value, - uint8* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32ToArray(int field_number, + int32_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64ToArray(int field_number, + int64_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32ToArray(int field_number, + uint32_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64ToArray(int field_number, + uint64_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32ToArray(int field_number, + int32_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64ToArray(int field_number, + int64_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32ToArray(int field_number, + uint32_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64ToArray(int field_number, + uint64_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32ToArray(int field_number, + int32_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64ToArray(int field_number, + int64_t value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatToArray(int field_number, + float value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleToArray(int field_number, + double value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteBoolToArray(int field_number, + bool value, + uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteEnumToArray(int field_number, + int value, + uint8_t* target); template <typename T> - PROTOBUF_NDEBUG_INLINE static uint8* WritePrimitiveToArray( + PROTOBUF_NDEBUG_INLINE static uint8_t* WritePrimitiveToArray( int field_number, const RepeatedField<T>& value, - uint8* (*Writer)(int, T, uint8*), uint8* target); - - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt32ToArray( - int field_number, const RepeatedField<int32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteInt64ToArray( - int field_number, const RepeatedField<int64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt32ToArray( - int field_number, const RepeatedField<uint32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteUInt64ToArray( - int field_number, const RepeatedField<uint64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt32ToArray( - int field_number, const RepeatedField<int32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSInt64ToArray( - int field_number, const RepeatedField<int64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed32ToArray( - int field_number, const RepeatedField<uint32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFixed64ToArray( - int field_number, const RepeatedField<uint64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed32ToArray( - int field_number, const RepeatedField<int32>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteSFixed64ToArray( - int field_number, const RepeatedField<int64>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteFloatToArray( - int field_number, const RepeatedField<float>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteDoubleToArray( - int field_number, const RepeatedField<double>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteBoolToArray( - int field_number, const RepeatedField<bool>& value, uint8* output); - PROTOBUF_NDEBUG_INLINE static uint8* WriteEnumToArray( - int field_number, const RepeatedField<int>& value, uint8* output); - - PROTOBUF_NDEBUG_INLINE static uint8* WriteStringToArray( - int field_number, const TProtoStringType& value, uint8* target); - PROTOBUF_NDEBUG_INLINE static uint8* WriteBytesToArray( - int field_number, const TProtoStringType& value, uint8* target); + uint8_t* (*Writer)(int, T, uint8_t*), uint8_t* target); + + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt32ToArray( + int field_number, const RepeatedField<int32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteInt64ToArray( + int field_number, const RepeatedField<int64_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt32ToArray( + int field_number, const RepeatedField<uint32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteUInt64ToArray( + int field_number, const RepeatedField<uint64_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt32ToArray( + int field_number, const RepeatedField<int32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSInt64ToArray( + int field_number, const RepeatedField<int64_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed32ToArray( + int field_number, const RepeatedField<uint32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFixed64ToArray( + int field_number, const RepeatedField<uint64_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed32ToArray( + int field_number, const RepeatedField<int32_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteSFixed64ToArray( + int field_number, const RepeatedField<int64_t>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteFloatToArray( + int field_number, const RepeatedField<float>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteDoubleToArray( + int field_number, const RepeatedField<double>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteBoolToArray( + int field_number, const RepeatedField<bool>& value, uint8_t* output); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteEnumToArray( + int field_number, const RepeatedField<int>& value, uint8_t* output); + + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteStringToArray( + int field_number, const TProtoStringType& value, uint8_t* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteBytesToArray( + int field_number, const TProtoStringType& value, uint8_t* target); // Whether to serialize deterministically (e.g., map keys are // sorted) is a property of a CodedOutputStream, and in the process @@ -617,43 +677,43 @@ class PROTOBUF_EXPORT WireFormatLite { // have a CodedOutputStream available, so they get an additional parameter // telling them whether to serialize deterministically. template <typename MessageType> - PROTOBUF_NDEBUG_INLINE static uint8* InternalWriteGroup( - int field_number, const MessageType& value, uint8* target, + PROTOBUF_NDEBUG_INLINE static uint8_t* InternalWriteGroup( + int field_number, const MessageType& value, uint8_t* target, io::EpsCopyOutputStream* stream); template <typename MessageType> - PROTOBUF_NDEBUG_INLINE static uint8* InternalWriteMessage( - int field_number, const MessageType& value, uint8* target, + PROTOBUF_NDEBUG_INLINE static uint8_t* InternalWriteMessage( + int field_number, const MessageType& value, uint8_t* target, io::EpsCopyOutputStream* stream); // Like above, but de-virtualize the call to SerializeWithCachedSizes(). The // pointer must point at an instance of MessageType, *not* a subclass (or // the subclass must not override SerializeWithCachedSizes()). template <typename MessageType> - PROTOBUF_NDEBUG_INLINE static uint8* InternalWriteGroupNoVirtualToArray( - int field_number, const MessageType& value, uint8* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* InternalWriteGroupNoVirtualToArray( + int field_number, const MessageType& value, uint8_t* target); template <typename MessageType> - PROTOBUF_NDEBUG_INLINE static uint8* InternalWriteMessageNoVirtualToArray( - int field_number, const MessageType& value, uint8* target); + PROTOBUF_NDEBUG_INLINE static uint8_t* InternalWriteMessageNoVirtualToArray( + int field_number, const MessageType& value, uint8_t* target); // For backward-compatibility, the last four methods also have versions // that are non-deterministic always. - PROTOBUF_NDEBUG_INLINE static uint8* WriteGroupToArray( - int field_number, const MessageLite& value, uint8* target) { + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteGroupToArray( + int field_number, const MessageLite& value, uint8_t* target) { io::EpsCopyOutputStream stream( target, value.GetCachedSize() + static_cast<int>(2 * io::CodedOutputStream::VarintSize32( - static_cast<uint32>(field_number) << 3)), + static_cast<uint32_t>(field_number) << 3)), io::CodedOutputStream::IsDefaultSerializationDeterministic()); return InternalWriteGroup(field_number, value, target, &stream); } - PROTOBUF_NDEBUG_INLINE static uint8* WriteMessageToArray( - int field_number, const MessageLite& value, uint8* target) { + PROTOBUF_NDEBUG_INLINE static uint8_t* WriteMessageToArray( + int field_number, const MessageLite& value, uint8_t* target) { int size = value.GetCachedSize(); io::EpsCopyOutputStream stream( target, size + static_cast<int>(io::CodedOutputStream::VarintSize32( - static_cast<uint32>(field_number) << 3) + + static_cast<uint32_t>(field_number) << 3) + io::CodedOutputStream::VarintSize32(size)), io::CodedOutputStream::IsDefaultSerializationDeterministic()); return InternalWriteMessage(field_number, value, target, &stream); @@ -663,20 +723,42 @@ class PROTOBUF_EXPORT WireFormatLite { // the tag, so you must also call TagSize(). (This is because, for repeated // fields, you should only call TagSize() once and multiply it by the element // count, but you may have to call XxSize() for each individual element.) - static inline size_t Int32Size(int32 value); + static inline size_t Int32Size(int32_t value); static inline size_t Int64Size(int64 value); - static inline size_t UInt32Size(uint32 value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static inline size_t Int64Size(int64_t value); +#endif + static inline size_t UInt32Size(uint32_t value); static inline size_t UInt64Size(uint64 value); - static inline size_t SInt32Size(int32 value); + static inline size_t SInt32Size(int32_t value); static inline size_t SInt64Size(int64 value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static inline size_t SInt64Size(int64_t value); +#endif static inline size_t EnumSize(int value); - - static size_t Int32Size(const RepeatedField<int32>& value); + static inline size_t Int32SizePlusOne(int32_t value); + static inline size_t Int64SizePlusOne(int64_t value); + static inline size_t UInt32SizePlusOne(uint32_t value); + static inline size_t UInt64SizePlusOne(uint64_t value); + static inline size_t SInt32SizePlusOne(int32_t value); + static inline size_t SInt64SizePlusOne(int64_t value); + static inline size_t EnumSizePlusOne(int value); + + static size_t Int32Size(const RepeatedField<int32_t>& value); static size_t Int64Size(const RepeatedField<int64>& value); - static size_t UInt32Size(const RepeatedField<uint32>& value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static size_t Int64Size(const RepeatedField<int64_t>& value); +#endif + static size_t UInt32Size(const RepeatedField<uint32_t>& value); static size_t UInt64Size(const RepeatedField<uint64>& value); - static size_t SInt32Size(const RepeatedField<int32>& value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static size_t UInt64Size(const RepeatedField<uint64_t>& value); +#endif + static size_t SInt32Size(const RepeatedField<int32_t>& value); static size_t SInt64Size(const RepeatedField<int64>& value); +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) + static size_t SInt64Size(const RepeatedField<int64_t>& value); +#endif static size_t EnumSize(const RepeatedField<int>& value); // These types always have the same size. @@ -714,7 +796,7 @@ class PROTOBUF_EXPORT WireFormatLite { // can be read using potentially faster paths. template <typename CType, enum FieldType DeclaredType> PROTOBUF_NDEBUG_INLINE static bool ReadRepeatedFixedSizePrimitive( - int tag_size, uint32 tag, io::CodedInputStream* input, + int tag_size, uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* value); // Like ReadRepeatedFixedSizePrimitive but for packed primitive fields. @@ -740,7 +822,7 @@ class PROTOBUF_EXPORT FieldSkipper { virtual ~FieldSkipper() {} // Skip a field whose tag has already been consumed. - virtual bool SkipField(io::CodedInputStream* input, uint32 tag); + virtual bool SkipField(io::CodedInputStream* input, uint32_t tag); // Skip an entire message or group, up to an end-group tag (which is consumed) // or end-of-stream. @@ -761,7 +843,7 @@ class PROTOBUF_EXPORT CodedOutputStreamFieldSkipper : public FieldSkipper { ~CodedOutputStreamFieldSkipper() override {} // implements FieldSkipper ----------------------------------------- - bool SkipField(io::CodedInputStream* input, uint32 tag) override; + bool SkipField(io::CodedInputStream* input, uint32_t tag) override; bool SkipMessage(io::CodedInputStream* input) override; void SkipUnknownEnum(int field_number, int value) override; @@ -776,23 +858,23 @@ inline WireFormatLite::CppType WireFormatLite::FieldTypeToCppType( return kFieldTypeToCppTypeMap[type]; } -constexpr inline uint32 WireFormatLite::MakeTag(int field_number, - WireType type) { +constexpr inline uint32_t WireFormatLite::MakeTag(int field_number, + WireType type) { return GOOGLE_PROTOBUF_WIRE_FORMAT_MAKE_TAG(field_number, type); } -inline WireFormatLite::WireType WireFormatLite::GetTagWireType(uint32 tag) { +inline WireFormatLite::WireType WireFormatLite::GetTagWireType(uint32_t tag) { return static_cast<WireType>(tag & kTagTypeMask); } -inline int WireFormatLite::GetTagFieldNumber(uint32 tag) { +inline int WireFormatLite::GetTagFieldNumber(uint32_t tag) { return static_cast<int>(tag >> kTagTypeBits); } inline size_t WireFormatLite::TagSize(int field_number, WireFormatLite::FieldType type) { size_t result = io::CodedOutputStream::VarintSize32( - static_cast<uint32>(field_number << kTagTypeBits)); + static_cast<uint32_t>(field_number << kTagTypeBits)); if (type == TYPE_GROUP) { // Groups have both a start and an end tag. return result * 2; @@ -801,19 +883,19 @@ inline size_t WireFormatLite::TagSize(int field_number, } } -inline uint32 WireFormatLite::EncodeFloat(float value) { - return bit_cast<uint32>(value); +inline uint32_t WireFormatLite::EncodeFloat(float value) { + return bit_cast<uint32_t>(value); } -inline float WireFormatLite::DecodeFloat(uint32 value) { +inline float WireFormatLite::DecodeFloat(uint32_t value) { return bit_cast<float>(value); } -inline uint64 WireFormatLite::EncodeDouble(double value) { - return bit_cast<uint64>(value); +inline uint64_t WireFormatLite::EncodeDouble(double value) { + return bit_cast<uint64_t>(value); } -inline double WireFormatLite::DecodeDouble(uint64 value) { +inline double WireFormatLite::DecodeDouble(uint64_t value) { return bit_cast<double>(value); } @@ -828,7 +910,7 @@ inline double WireFormatLite::DecodeDouble(uint64 value) { // in such a way that those with a small absolute value will have smaller // encoded values, making them appropriate for encoding using varint. // -// int32 -> uint32 +// int32_t -> uint32_t // ------------------------- // 0 -> 0 // -1 -> 1 @@ -841,26 +923,26 @@ inline double WireFormatLite::DecodeDouble(uint64 value) { // >> encode >> // << decode << -inline uint32 WireFormatLite::ZigZagEncode32(int32 n) { +inline uint32_t WireFormatLite::ZigZagEncode32(int32_t n) { // Note: the right-shift must be arithmetic // Note: left shift must be unsigned because of overflow - return (static_cast<uint32>(n) << 1) ^ static_cast<uint32>(n >> 31); + return (static_cast<uint32_t>(n) << 1) ^ static_cast<uint32_t>(n >> 31); } -inline int32 WireFormatLite::ZigZagDecode32(uint32 n) { +inline int32_t WireFormatLite::ZigZagDecode32(uint32_t n) { // Note: Using unsigned types prevent undefined behavior - return static_cast<int32>((n >> 1) ^ (~(n & 1) + 1)); + return static_cast<int32_t>((n >> 1) ^ (~(n & 1) + 1)); } -inline uint64 WireFormatLite::ZigZagEncode64(int64 n) { +inline uint64_t WireFormatLite::ZigZagEncode64(int64_t n) { // Note: the right-shift must be arithmetic // Note: left shift must be unsigned because of overflow - return (static_cast<uint64>(n) << 1) ^ static_cast<uint64>(n >> 63); + return (static_cast<uint64_t>(n) << 1) ^ static_cast<uint64_t>(n >> 63); } -inline int64 WireFormatLite::ZigZagDecode64(uint64 n) { +inline int64_t WireFormatLite::ZigZagDecode64(uint64_t n) { // Note: Using unsigned types prevent undefined behavior - return static_cast<int64>((n >> 1) ^ (~(n & 1) + 1)); + return static_cast<int64_t>((n >> 1) ^ (~(n & 1) + 1)); } // String is for UTF-8 text only, but, even so, ReadString() can simply @@ -876,8 +958,8 @@ inline bool WireFormatLite::ReadString(io::CodedInputStream* input, return ReadBytes(input, p); } -inline uint8* InternalSerializeUnknownMessageSetItemsToArray( - const TProtoStringType& unknown_fields, uint8* target, +inline uint8_t* InternalSerializeUnknownMessageSetItemsToArray( + const TProtoStringType& unknown_fields, uint8_t* target, io::EpsCopyOutputStream* stream) { return stream->WriteRaw(unknown_fields.data(), static_cast<int>(unknown_fields.size()), target); @@ -891,11 +973,11 @@ inline size_t ComputeUnknownMessageSetItemsSize( // Implementation details of ReadPrimitive. template <> -inline bool WireFormatLite::ReadPrimitive<int32, WireFormatLite::TYPE_INT32>( - io::CodedInputStream* input, int32* value) { - uint32 temp; +inline bool WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_INT32>( + io::CodedInputStream* input, int32_t* value) { + uint32_t temp; if (!input->ReadVarint32(&temp)) return false; - *value = static_cast<int32>(temp); + *value = static_cast<int32_t>(temp); return true; } template <> @@ -906,20 +988,40 @@ inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_INT64>( *value = static_cast<int64>(temp); return true; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline bool WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_INT64>( + io::CodedInputStream* input, int64_t* value) { + uint64_t temp; + if (!input->ReadVarint64(&temp)) return false; + *value = static_cast<int64_t>(temp); + return true; +} +#endif template <> -inline bool WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>( - io::CodedInputStream* input, uint32* value) { +inline bool +WireFormatLite::ReadPrimitive<uint32_t, WireFormatLite::TYPE_UINT32>( + io::CodedInputStream* input, uint32_t* value) { return input->ReadVarint32(value); } template <> -inline bool WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_UINT64>( +inline bool +WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_UINT64>( io::CodedInputStream* input, uint64* value) { return input->ReadVarint64(value); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) template <> -inline bool WireFormatLite::ReadPrimitive<int32, WireFormatLite::TYPE_SINT32>( - io::CodedInputStream* input, int32* value) { - uint32 temp; +inline bool +WireFormatLite::ReadPrimitive<uint64_t, WireFormatLite::TYPE_UINT64>( + io::CodedInputStream* input, uint64_t* value) { + return input->ReadVarint64(value); +} +#endif +template <> +inline bool WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_SINT32>( + io::CodedInputStream* input, int32_t* value) { + uint32_t temp; if (!input->ReadVarint32(&temp)) return false; *value = ZigZagDecode32(temp); return true; @@ -932,36 +1034,69 @@ inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SINT64>( *value = ZigZagDecode64(temp); return true; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline bool WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_SINT64>( + io::CodedInputStream* input, int64_t* value) { + uint64_t temp; + if (!input->ReadVarint64(&temp)) return false; + *value = ZigZagDecode64(temp); + return true; +} +#endif template <> -inline bool WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_FIXED32>( - io::CodedInputStream* input, uint32* value) { +inline bool +WireFormatLite::ReadPrimitive<uint32_t, WireFormatLite::TYPE_FIXED32>( + io::CodedInputStream* input, uint32_t* value) { return input->ReadLittleEndian32(value); } template <> -inline bool WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_FIXED64>( +inline bool +WireFormatLite::ReadPrimitive<uint64, WireFormatLite::TYPE_FIXED64>( io::CodedInputStream* input, uint64* value) { return input->ReadLittleEndian64(value); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) template <> -inline bool WireFormatLite::ReadPrimitive<int32, WireFormatLite::TYPE_SFIXED32>( - io::CodedInputStream* input, int32* value) { - uint32 temp; +inline bool +WireFormatLite::ReadPrimitive<uint64_t, WireFormatLite::TYPE_FIXED64>( + io::CodedInputStream* input, uint64_t* value) { + return input->ReadLittleEndian64(value); +} +#endif +template <> +inline bool +WireFormatLite::ReadPrimitive<int32_t, WireFormatLite::TYPE_SFIXED32>( + io::CodedInputStream* input, int32_t* value) { + uint32_t temp; if (!input->ReadLittleEndian32(&temp)) return false; - *value = static_cast<int32>(temp); + *value = static_cast<int32_t>(temp); return true; } template <> -inline bool WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SFIXED64>( +inline bool +WireFormatLite::ReadPrimitive<int64, WireFormatLite::TYPE_SFIXED64>( io::CodedInputStream* input, int64* value) { uint64 temp; if (!input->ReadLittleEndian64(&temp)) return false; *value = static_cast<int64>(temp); return true; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline bool +WireFormatLite::ReadPrimitive<int64_t, WireFormatLite::TYPE_SFIXED64>( + io::CodedInputStream* input, int64_t* value) { + uint64_t temp; + if (!input->ReadLittleEndian64(&temp)) return false; + *value = static_cast<int64_t>(temp); + return true; +} +#endif template <> inline bool WireFormatLite::ReadPrimitive<float, WireFormatLite::TYPE_FLOAT>( io::CodedInputStream* input, float* value) { - uint32 temp; + uint32_t temp; if (!input->ReadLittleEndian32(&temp)) return false; *value = DecodeFloat(temp); return true; @@ -969,7 +1104,7 @@ inline bool WireFormatLite::ReadPrimitive<float, WireFormatLite::TYPE_FLOAT>( template <> inline bool WireFormatLite::ReadPrimitive<double, WireFormatLite::TYPE_DOUBLE>( io::CodedInputStream* input, double* value) { - uint64 temp; + uint64_t temp; if (!input->ReadLittleEndian64(&temp)) return false; *value = DecodeDouble(temp); return true; @@ -977,7 +1112,7 @@ inline bool WireFormatLite::ReadPrimitive<double, WireFormatLite::TYPE_DOUBLE>( template <> inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>( io::CodedInputStream* input, bool* value) { - uint64 temp; + uint64_t temp; if (!input->ReadVarint64(&temp)) return false; *value = temp != 0; return true; @@ -985,56 +1120,75 @@ inline bool WireFormatLite::ReadPrimitive<bool, WireFormatLite::TYPE_BOOL>( template <> inline bool WireFormatLite::ReadPrimitive<int, WireFormatLite::TYPE_ENUM>( io::CodedInputStream* input, int* value) { - uint32 temp; + uint32_t temp; if (!input->ReadVarint32(&temp)) return false; *value = static_cast<int>(temp); return true; } template <> -inline const uint8* -WireFormatLite::ReadPrimitiveFromArray<uint32, WireFormatLite::TYPE_FIXED32>( - const uint8* buffer, uint32* value) { +inline const uint8_t* +WireFormatLite::ReadPrimitiveFromArray<uint32_t, WireFormatLite::TYPE_FIXED32>( + const uint8_t* buffer, uint32_t* value) { return io::CodedInputStream::ReadLittleEndian32FromArray(buffer, value); } template <> -inline const uint8* +inline const uint8_t* WireFormatLite::ReadPrimitiveFromArray<uint64, WireFormatLite::TYPE_FIXED64>( - const uint8* buffer, uint64* value) { + const uint8_t* buffer, uint64* value) { + return io::CodedInputStream::ReadLittleEndian64FromArray(buffer, value); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +template <> +inline const uint8_t* +WireFormatLite::ReadPrimitiveFromArray<uint64_t, WireFormatLite::TYPE_FIXED64>( + const uint8_t* buffer, uint64_t* value) { return io::CodedInputStream::ReadLittleEndian64FromArray(buffer, value); } +#endif template <> -inline const uint8* -WireFormatLite::ReadPrimitiveFromArray<int32, WireFormatLite::TYPE_SFIXED32>( - const uint8* buffer, int32* value) { - uint32 temp; +inline const uint8_t* +WireFormatLite::ReadPrimitiveFromArray<int32_t, WireFormatLite::TYPE_SFIXED32>( + const uint8_t* buffer, int32_t* value) { + uint32_t temp; buffer = io::CodedInputStream::ReadLittleEndian32FromArray(buffer, &temp); - *value = static_cast<int32>(temp); + *value = static_cast<int32_t>(temp); return buffer; } template <> -inline const uint8* +inline const uint8_t* WireFormatLite::ReadPrimitiveFromArray<int64, WireFormatLite::TYPE_SFIXED64>( - const uint8* buffer, int64* value) { - uint64 temp; + const uint8_t* buffer, int64* value) { + uint64_t temp; buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); - *value = static_cast<int64>(temp); + *value = static_cast<int64_t>(temp); return buffer; } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) template <> -inline const uint8* +inline const uint8_t* +WireFormatLite::ReadPrimitiveFromArray<int64_t, WireFormatLite::TYPE_SFIXED64>( + const uint8_t* buffer, int64_t* value) { + uint64_t temp; + buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); + *value = static_cast<int64_t>(temp); + return buffer; +} +#endif +template <> +inline const uint8_t* WireFormatLite::ReadPrimitiveFromArray<float, WireFormatLite::TYPE_FLOAT>( - const uint8* buffer, float* value) { - uint32 temp; + const uint8_t* buffer, float* value) { + uint32_t temp; buffer = io::CodedInputStream::ReadLittleEndian32FromArray(buffer, &temp); *value = DecodeFloat(temp); return buffer; } template <> -inline const uint8* +inline const uint8_t* WireFormatLite::ReadPrimitiveFromArray<double, WireFormatLite::TYPE_DOUBLE>( - const uint8* buffer, double* value) { - uint64 temp; + const uint8_t* buffer, double* value) { + uint64_t temp; buffer = io::CodedInputStream::ReadLittleEndian64FromArray(buffer, &temp); *value = DecodeDouble(temp); return buffer; @@ -1043,7 +1197,7 @@ WireFormatLite::ReadPrimitiveFromArray<double, WireFormatLite::TYPE_DOUBLE>( template <typename CType, enum WireFormatLite::FieldType DeclaredType> inline bool WireFormatLite::ReadRepeatedPrimitive( int, // tag_size, unused. - uint32 tag, io::CodedInputStream* input, RepeatedField<CType>* values) { + uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* values) { CType value; if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false; values->Add(value); @@ -1058,7 +1212,7 @@ inline bool WireFormatLite::ReadRepeatedPrimitive( template <typename CType, enum WireFormatLite::FieldType DeclaredType> inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( - int tag_size, uint32 tag, io::CodedInputStream* input, + int tag_size, uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* values) { GOOGLE_DCHECK_EQ(UInt32Size(tag), static_cast<size_t>(tag_size)); CType value; @@ -1078,7 +1232,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( int size; input->GetDirectBufferPointerInline(&void_pointer, &size); if (size > 0) { - const uint8* buffer = reinterpret_cast<const uint8*>(void_pointer); + const uint8_t* buffer = reinterpret_cast<const uint8_t*>(void_pointer); // The number of bytes each type occupies on the wire. const int per_value_size = tag_size + static_cast<int>(sizeof(value)); @@ -1107,17 +1261,17 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( template <> \ inline bool WireFormatLite::ReadRepeatedPrimitive< \ CPPTYPE, WireFormatLite::DECLARED_TYPE>( \ - int tag_size, uint32 tag, io::CodedInputStream* input, \ + int tag_size, uint32_t tag, io::CodedInputStream* input, \ RepeatedField<CPPTYPE>* values) { \ return ReadRepeatedFixedSizePrimitive<CPPTYPE, \ WireFormatLite::DECLARED_TYPE>( \ tag_size, tag, input, values); \ } -READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32) -READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64) -READ_REPEATED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32) -READ_REPEATED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint32_t, TYPE_FIXED32) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(uint64_t, TYPE_FIXED64) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(int32_t, TYPE_SFIXED32) +READ_REPEATED_FIXED_SIZE_PRIMITIVE(int64_t, TYPE_SFIXED64) READ_REPEATED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT) READ_REPEATED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) @@ -1125,7 +1279,7 @@ READ_REPEATED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) template <typename CType, enum WireFormatLite::FieldType DeclaredType> bool WireFormatLite::ReadRepeatedPrimitiveNoInline( - int tag_size, uint32 tag, io::CodedInputStream* input, + int tag_size, uint32_t tag, io::CodedInputStream* input, RepeatedField<CType>* value) { return ReadRepeatedPrimitive<CType, DeclaredType>(tag_size, tag, input, value); @@ -1167,13 +1321,13 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive( // -1 >= 0 Use fast path if length <= Limit. // >= 0 -1 Use slow path. // >= 0 >= 0 Use fast path if length <= min(both limits). - int64 bytes_limit = input->BytesUntilTotalBytesLimit(); + int64_t bytes_limit = input->BytesUntilTotalBytesLimit(); if (bytes_limit == -1) { bytes_limit = input->BytesUntilLimit(); } else { // parentheses around (std::min) prevents macro expansion of min(...) bytes_limit = - (std::min)(bytes_limit, static_cast<int64>(input->BytesUntilLimit())); + (std::min)(bytes_limit, static_cast<int64_t>(input->BytesUntilLimit())); } if (bytes_limit >= new_bytes) { // Fast-path that pre-allocates *values to the final size. @@ -1218,10 +1372,10 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive( input, values); \ } -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64, TYPE_FIXED64) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32, TYPE_SFIXED32) -READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64, TYPE_SFIXED64) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32_t, TYPE_FIXED32) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint64_t, TYPE_FIXED64) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int32_t, TYPE_SFIXED32) +READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(int64_t, TYPE_SFIXED64) READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(float, TYPE_FLOAT) READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE) @@ -1267,7 +1421,7 @@ inline void WireFormatLite::WriteTag(int field_number, WireType type, output->WriteTag(MakeTag(field_number, type)); } -inline void WireFormatLite::WriteInt32NoTag(int32 value, +inline void WireFormatLite::WriteInt32NoTag(int32_t value, io::CodedOutputStream* output) { output->WriteVarint32SignExtended(value); } @@ -1275,7 +1429,13 @@ inline void WireFormatLite::WriteInt64NoTag(int64 value, io::CodedOutputStream* output) { output->WriteVarint64(static_cast<uint64>(value)); } -inline void WireFormatLite::WriteUInt32NoTag(uint32 value, +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline void WireFormatLite::WriteInt64NoTag(int64_t value, + io::CodedOutputStream* output) { + output->WriteVarint64(static_cast<uint64_t>(value)); +} +#endif +inline void WireFormatLite::WriteUInt32NoTag(uint32_t value, io::CodedOutputStream* output) { output->WriteVarint32(value); } @@ -1283,7 +1443,13 @@ inline void WireFormatLite::WriteUInt64NoTag(uint64 value, io::CodedOutputStream* output) { output->WriteVarint64(value); } -inline void WireFormatLite::WriteSInt32NoTag(int32 value, +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline void WireFormatLite::WriteUInt64NoTag(uint64_t value, + io::CodedOutputStream* output) { + output->WriteVarint64(value); +} +#endif +inline void WireFormatLite::WriteSInt32NoTag(int32_t value, io::CodedOutputStream* output) { output->WriteVarint32(ZigZagEncode32(value)); } @@ -1291,7 +1457,13 @@ inline void WireFormatLite::WriteSInt64NoTag(int64 value, io::CodedOutputStream* output) { output->WriteVarint64(ZigZagEncode64(value)); } -inline void WireFormatLite::WriteFixed32NoTag(uint32 value, +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline void WireFormatLite::WriteSInt64NoTag(int64_t value, + io::CodedOutputStream* output) { + output->WriteVarint64(ZigZagEncode64(value)); +} +#endif +inline void WireFormatLite::WriteFixed32NoTag(uint32_t value, io::CodedOutputStream* output) { output->WriteLittleEndian32(value); } @@ -1299,14 +1471,26 @@ inline void WireFormatLite::WriteFixed64NoTag(uint64 value, io::CodedOutputStream* output) { output->WriteLittleEndian64(value); } -inline void WireFormatLite::WriteSFixed32NoTag(int32 value, +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline void WireFormatLite::WriteFixed64NoTag(uint64_t value, + io::CodedOutputStream* output) { + output->WriteLittleEndian64(value); +} +#endif +inline void WireFormatLite::WriteSFixed32NoTag(int32_t value, io::CodedOutputStream* output) { - output->WriteLittleEndian32(static_cast<uint32>(value)); + output->WriteLittleEndian32(static_cast<uint32_t>(value)); } inline void WireFormatLite::WriteSFixed64NoTag(int64 value, io::CodedOutputStream* output) { output->WriteLittleEndian64(static_cast<uint64>(value)); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline void WireFormatLite::WriteSFixed64NoTag(int64_t value, + io::CodedOutputStream* output) { + output->WriteLittleEndian64(static_cast<uint64_t>(value)); +} +#endif inline void WireFormatLite::WriteFloatNoTag(float value, io::CodedOutputStream* output) { output->WriteLittleEndian32(EncodeFloat(value)); @@ -1346,77 +1530,113 @@ inline void WireFormatLite::WriteMessageNoVirtual( // =================================================================== -inline uint8* WireFormatLite::WriteTagToArray(int field_number, WireType type, - uint8* target) { +inline uint8_t* WireFormatLite::WriteTagToArray(int field_number, WireType type, + uint8_t* target) { return io::CodedOutputStream::WriteTagToArray(MakeTag(field_number, type), target); } -inline uint8* WireFormatLite::WriteInt32NoTagToArray(int32 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteInt32NoTagToArray(int32_t value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint32SignExtendedToArray(value, target); } -inline uint8* WireFormatLite::WriteInt64NoTagToArray(int64 value, - uint8* target) { - return io::CodedOutputStream::WriteVarint64ToArray(static_cast<uint64>(value), - target); +inline uint8_t* WireFormatLite::WriteInt64NoTagToArray(int64 value, + uint8_t* target) { + return io::CodedOutputStream::WriteVarint64ToArray( + static_cast<uint64>(value), target); } -inline uint8* WireFormatLite::WriteUInt32NoTagToArray(uint32 value, - uint8* target) { +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteInt64NoTagToArray(int64_t value, + uint8_t* target) { + return io::CodedOutputStream::WriteVarint64ToArray( + static_cast<uint64_t>(value), target); +} +#endif +inline uint8_t* WireFormatLite::WriteUInt32NoTagToArray(uint32_t value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint32ToArray(value, target); } -inline uint8* WireFormatLite::WriteUInt64NoTagToArray(uint64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray(uint64 value, + uint8_t* target) { + return io::CodedOutputStream::WriteVarint64ToArray(value, target); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray(uint64_t value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint64ToArray(value, target); } -inline uint8* WireFormatLite::WriteSInt32NoTagToArray(int32 value, - uint8* target) { +#endif +inline uint8_t* WireFormatLite::WriteSInt32NoTagToArray(int32_t value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint32ToArray(ZigZagEncode32(value), target); } -inline uint8* WireFormatLite::WriteSInt64NoTagToArray(int64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray(int64 value, + uint8_t* target) { + return io::CodedOutputStream::WriteVarint64ToArray(ZigZagEncode64(value), + target); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray(int64_t value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint64ToArray(ZigZagEncode64(value), target); } -inline uint8* WireFormatLite::WriteFixed32NoTagToArray(uint32 value, - uint8* target) { +#endif +inline uint8_t* WireFormatLite::WriteFixed32NoTagToArray(uint32_t value, + uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian32ToArray(value, target); } -inline uint8* WireFormatLite::WriteFixed64NoTagToArray(uint64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray(uint64 value, + uint8_t* target) { + return io::CodedOutputStream::WriteLittleEndian64ToArray(value, target); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray(uint64_t value, + uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian64ToArray(value, target); } -inline uint8* WireFormatLite::WriteSFixed32NoTagToArray(int32 value, - uint8* target) { +#endif +inline uint8_t* WireFormatLite::WriteSFixed32NoTagToArray(int32_t value, + uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian32ToArray( - static_cast<uint32>(value), target); + static_cast<uint32_t>(value), target); } -inline uint8* WireFormatLite::WriteSFixed64NoTagToArray(int64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray(int64 value, + uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian64ToArray( static_cast<uint64>(value), target); } -inline uint8* WireFormatLite::WriteFloatNoTagToArray(float value, - uint8* target) { +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray(int64_t value, + uint8_t* target) { + return io::CodedOutputStream::WriteLittleEndian64ToArray( + static_cast<uint64_t>(value), target); +} +#endif +inline uint8_t* WireFormatLite::WriteFloatNoTagToArray(float value, + uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian32ToArray(EncodeFloat(value), target); } -inline uint8* WireFormatLite::WriteDoubleNoTagToArray(double value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteDoubleNoTagToArray(double value, + uint8_t* target) { return io::CodedOutputStream::WriteLittleEndian64ToArray(EncodeDouble(value), target); } -inline uint8* WireFormatLite::WriteBoolNoTagToArray(bool value, uint8* target) { +inline uint8_t* WireFormatLite::WriteBoolNoTagToArray(bool value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint32ToArray(value ? 1 : 0, target); } -inline uint8* WireFormatLite::WriteEnumNoTagToArray(int value, uint8* target) { +inline uint8_t* WireFormatLite::WriteEnumNoTagToArray(int value, + uint8_t* target) { return io::CodedOutputStream::WriteVarint32SignExtendedToArray(value, target); } template <typename T> -inline uint8* WireFormatLite::WritePrimitiveNoTagToArray( - const RepeatedField<T>& value, uint8* (*Writer)(T, uint8*), uint8* target) { +inline uint8_t* WireFormatLite::WritePrimitiveNoTagToArray( + const RepeatedField<T>& value, uint8_t* (*Writer)(T, uint8_t*), + uint8_t* target) { const int n = value.size(); GOOGLE_DCHECK_GT(n, 0); @@ -1430,8 +1650,9 @@ inline uint8* WireFormatLite::WritePrimitiveNoTagToArray( } template <typename T> -inline uint8* WireFormatLite::WriteFixedNoTagToArray( - const RepeatedField<T>& value, uint8* (*Writer)(T, uint8*), uint8* target) { +inline uint8_t* WireFormatLite::WriteFixedNoTagToArray( + const RepeatedField<T>& value, uint8_t* (*Writer)(T, uint8_t*), + uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) (void)Writer; @@ -1447,138 +1668,179 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray( #endif } -inline uint8* WireFormatLite::WriteInt32NoTagToArray( - const RepeatedField<int32>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteInt32NoTagToArray( + const RepeatedField<int32_t>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteInt32NoTagToArray, target); } -inline uint8* WireFormatLite::WriteInt64NoTagToArray( - const RepeatedField<int64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteInt64NoTagToArray( + const RepeatedField<int64>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteInt64NoTagToArray, target); } -inline uint8* WireFormatLite::WriteUInt32NoTagToArray( - const RepeatedField<uint32>& value, uint8* target) { +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteInt64NoTagToArray( + const RepeatedField<int64_t>& value, uint8_t* target) { + return WritePrimitiveNoTagToArray(value, WriteInt64NoTagToArray, target); +} +#endif +inline uint8_t* WireFormatLite::WriteUInt32NoTagToArray( + const RepeatedField<uint32_t>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteUInt32NoTagToArray, target); } -inline uint8* WireFormatLite::WriteUInt64NoTagToArray( - const RepeatedField<uint64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray( + const RepeatedField<uint64>& value, uint8_t* target) { + return WritePrimitiveNoTagToArray(value, WriteUInt64NoTagToArray, target); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteUInt64NoTagToArray( + const RepeatedField<uint64_t>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteUInt64NoTagToArray, target); } -inline uint8* WireFormatLite::WriteSInt32NoTagToArray( - const RepeatedField<int32>& value, uint8* target) { +#endif +inline uint8_t* WireFormatLite::WriteSInt32NoTagToArray( + const RepeatedField<int32_t>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteSInt32NoTagToArray, target); } -inline uint8* WireFormatLite::WriteSInt64NoTagToArray( - const RepeatedField<int64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray( + const RepeatedField<int64>& value, uint8_t* target) { + return WritePrimitiveNoTagToArray(value, WriteSInt64NoTagToArray, target); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteSInt64NoTagToArray( + const RepeatedField<int64_t>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteSInt64NoTagToArray, target); } -inline uint8* WireFormatLite::WriteFixed32NoTagToArray( - const RepeatedField<uint32>& value, uint8* target) { +#endif +inline uint8_t* WireFormatLite::WriteFixed32NoTagToArray( + const RepeatedField<uint32_t>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteFixed32NoTagToArray, target); } -inline uint8* WireFormatLite::WriteFixed64NoTagToArray( - const RepeatedField<uint64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray( + const RepeatedField<uint64>& value, uint8_t* target) { + return WriteFixedNoTagToArray(value, WriteFixed64NoTagToArray, target); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteFixed64NoTagToArray( + const RepeatedField<uint64_t>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteFixed64NoTagToArray, target); } -inline uint8* WireFormatLite::WriteSFixed32NoTagToArray( - const RepeatedField<int32>& value, uint8* target) { +#endif +inline uint8_t* WireFormatLite::WriteSFixed32NoTagToArray( + const RepeatedField<int32_t>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteSFixed32NoTagToArray, target); } -inline uint8* WireFormatLite::WriteSFixed64NoTagToArray( - const RepeatedField<int64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray( + const RepeatedField<int64>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteSFixed64NoTagToArray, target); } -inline uint8* WireFormatLite::WriteFloatNoTagToArray( - const RepeatedField<float>& value, uint8* target) { +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline uint8_t* WireFormatLite::WriteSFixed64NoTagToArray( + const RepeatedField<int64_t>& value, uint8_t* target) { + return WriteFixedNoTagToArray(value, WriteSFixed64NoTagToArray, target); +} +#endif +inline uint8_t* WireFormatLite::WriteFloatNoTagToArray( + const RepeatedField<float>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteFloatNoTagToArray, target); } -inline uint8* WireFormatLite::WriteDoubleNoTagToArray( - const RepeatedField<double>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteDoubleNoTagToArray( + const RepeatedField<double>& value, uint8_t* target) { return WriteFixedNoTagToArray(value, WriteDoubleNoTagToArray, target); } -inline uint8* WireFormatLite::WriteBoolNoTagToArray( - const RepeatedField<bool>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteBoolNoTagToArray( + const RepeatedField<bool>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteBoolNoTagToArray, target); } -inline uint8* WireFormatLite::WriteEnumNoTagToArray( - const RepeatedField<int>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteEnumNoTagToArray( + const RepeatedField<int>& value, uint8_t* target) { return WritePrimitiveNoTagToArray(value, WriteEnumNoTagToArray, target); } -inline uint8* WireFormatLite::WriteInt32ToArray(int field_number, int32 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteInt32ToArray(int field_number, + int32_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteInt32NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteInt64ToArray(int field_number, int64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteInt64ToArray(int field_number, + int64_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteInt64NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteUInt32ToArray(int field_number, uint32 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteUInt32ToArray(int field_number, + uint32_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteUInt32NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteUInt64ToArray(int field_number, uint64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteUInt64ToArray(int field_number, + uint64_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteUInt64NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteSInt32ToArray(int field_number, int32 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteSInt32ToArray(int field_number, + int32_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteSInt32NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteSInt64ToArray(int field_number, int64 value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteSInt64ToArray(int field_number, + int64_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteSInt64NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteFixed32ToArray(int field_number, - uint32 value, uint8* target) { +inline uint8_t* WireFormatLite::WriteFixed32ToArray(int field_number, + uint32_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); return WriteFixed32NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteFixed64ToArray(int field_number, - uint64 value, uint8* target) { +inline uint8_t* WireFormatLite::WriteFixed64ToArray(int field_number, + uint64_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); return WriteFixed64NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteSFixed32ToArray(int field_number, - int32 value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSFixed32ToArray(int field_number, + int32_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); return WriteSFixed32NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteSFixed64ToArray(int field_number, - int64 value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSFixed64ToArray(int field_number, + int64_t value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); return WriteSFixed64NoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteFloatToArray(int field_number, float value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteFloatToArray(int field_number, float value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED32, target); return WriteFloatNoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteDoubleToArray(int field_number, double value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteDoubleToArray(int field_number, + double value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_FIXED64, target); return WriteDoubleNoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteBoolToArray(int field_number, bool value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteBoolToArray(int field_number, bool value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteBoolNoTagToArray(value, target); } -inline uint8* WireFormatLite::WriteEnumToArray(int field_number, int value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteEnumToArray(int field_number, int value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_VARINT, target); return WriteEnumNoTagToArray(value, target); } template <typename T> -inline uint8* WireFormatLite::WritePrimitiveToArray( +inline uint8_t* WireFormatLite::WritePrimitiveToArray( int field_number, const RepeatedField<T>& value, - uint8* (*Writer)(int, T, uint8*), uint8* target) { + uint8_t* (*Writer)(int, T, uint8_t*), uint8_t* target) { const int n = value.size(); if (n == 0) { return target; @@ -1593,71 +1855,69 @@ inline uint8* WireFormatLite::WritePrimitiveToArray( return target; } -inline uint8* WireFormatLite::WriteInt32ToArray( - int field_number, const RepeatedField<int32>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteInt32ToArray( + int field_number, const RepeatedField<int32_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteInt32ToArray, target); } -inline uint8* WireFormatLite::WriteInt64ToArray( - int field_number, const RepeatedField<int64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteInt64ToArray( + int field_number, const RepeatedField<int64_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteInt64ToArray, target); } -inline uint8* WireFormatLite::WriteUInt32ToArray( - int field_number, const RepeatedField<uint32>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteUInt32ToArray( + int field_number, const RepeatedField<uint32_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteUInt32ToArray, target); } -inline uint8* WireFormatLite::WriteUInt64ToArray( - int field_number, const RepeatedField<uint64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteUInt64ToArray( + int field_number, const RepeatedField<uint64_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteUInt64ToArray, target); } -inline uint8* WireFormatLite::WriteSInt32ToArray( - int field_number, const RepeatedField<int32>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSInt32ToArray( + int field_number, const RepeatedField<int32_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSInt32ToArray, target); } -inline uint8* WireFormatLite::WriteSInt64ToArray( - int field_number, const RepeatedField<int64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSInt64ToArray( + int field_number, const RepeatedField<int64_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSInt64ToArray, target); } -inline uint8* WireFormatLite::WriteFixed32ToArray( - int field_number, const RepeatedField<uint32>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteFixed32ToArray( + int field_number, const RepeatedField<uint32_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteFixed32ToArray, target); } -inline uint8* WireFormatLite::WriteFixed64ToArray( - int field_number, const RepeatedField<uint64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteFixed64ToArray( + int field_number, const RepeatedField<uint64_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteFixed64ToArray, target); } -inline uint8* WireFormatLite::WriteSFixed32ToArray( - int field_number, const RepeatedField<int32>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSFixed32ToArray( + int field_number, const RepeatedField<int32_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSFixed32ToArray, target); } -inline uint8* WireFormatLite::WriteSFixed64ToArray( - int field_number, const RepeatedField<int64>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteSFixed64ToArray( + int field_number, const RepeatedField<int64_t>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteSFixed64ToArray, target); } -inline uint8* WireFormatLite::WriteFloatToArray( - int field_number, const RepeatedField<float>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteFloatToArray( + int field_number, const RepeatedField<float>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteFloatToArray, target); } -inline uint8* WireFormatLite::WriteDoubleToArray( - int field_number, const RepeatedField<double>& value, uint8* target) { +inline uint8_t* WireFormatLite::WriteDoubleToArray( + int field_number, const RepeatedField<double>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteDoubleToArray, target); } -inline uint8* WireFormatLite::WriteBoolToArray(int field_number, - const RepeatedField<bool>& value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteBoolToArray( + int field_number, const RepeatedField<bool>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteBoolToArray, target); } -inline uint8* WireFormatLite::WriteEnumToArray(int field_number, - const RepeatedField<int>& value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteEnumToArray( + int field_number, const RepeatedField<int>& value, uint8_t* target) { return WritePrimitiveToArray(field_number, value, WriteEnumToArray, target); } -inline uint8* WireFormatLite::WriteStringToArray(int field_number, - const TProtoStringType& value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteStringToArray(int field_number, + const TProtoStringType& value, + uint8_t* target) { // String is for UTF-8 text only // WARNING: In wire_format.cc, both strings and bytes are handled by // WriteString() to avoid code duplication. If the implementations become @@ -1665,17 +1925,17 @@ inline uint8* WireFormatLite::WriteStringToArray(int field_number, target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); return io::CodedOutputStream::WriteStringWithSizeToArray(value, target); } -inline uint8* WireFormatLite::WriteBytesToArray(int field_number, - const TProtoStringType& value, - uint8* target) { +inline uint8_t* WireFormatLite::WriteBytesToArray(int field_number, + const TProtoStringType& value, + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); return io::CodedOutputStream::WriteStringWithSizeToArray(value, target); } template <typename MessageType> -inline uint8* WireFormatLite::InternalWriteGroup( - int field_number, const MessageType& value, uint8* target, +inline uint8_t* WireFormatLite::InternalWriteGroup( + int field_number, const MessageType& value, uint8_t* target, io::EpsCopyOutputStream* stream) { target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target); target = value._InternalSerialize(target, stream); @@ -1683,33 +1943,33 @@ inline uint8* WireFormatLite::InternalWriteGroup( return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target); } template <typename MessageType> -inline uint8* WireFormatLite::InternalWriteMessage( - int field_number, const MessageType& value, uint8* target, +inline uint8_t* WireFormatLite::InternalWriteMessage( + int field_number, const MessageType& value, uint8_t* target, io::EpsCopyOutputStream* stream) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = io::CodedOutputStream::WriteVarint32ToArrayOutOfLine( - static_cast<uint32>(value.GetCachedSize()), target); + static_cast<uint32_t>(value.GetCachedSize()), target); return value._InternalSerialize(target, stream); } // See comment on ReadGroupNoVirtual to understand the need for this template // parameter name. template <typename MessageType_WorkAroundCppLookupDefect> -inline uint8* WireFormatLite::InternalWriteGroupNoVirtualToArray( +inline uint8_t* WireFormatLite::InternalWriteGroupNoVirtualToArray( int field_number, const MessageType_WorkAroundCppLookupDefect& value, - uint8* target) { + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target); target = value.MessageType_WorkAroundCppLookupDefect:: SerializeWithCachedSizesToArray(target); return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target); } template <typename MessageType_WorkAroundCppLookupDefect> -inline uint8* WireFormatLite::InternalWriteMessageNoVirtualToArray( +inline uint8_t* WireFormatLite::InternalWriteMessageNoVirtualToArray( int field_number, const MessageType_WorkAroundCppLookupDefect& value, - uint8* target) { + uint8_t* target) { target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target); target = io::CodedOutputStream::WriteVarint32ToArray( - static_cast<uint32>( + static_cast<uint32_t>( value.MessageType_WorkAroundCppLookupDefect::GetCachedSize()), target); return value @@ -1719,27 +1979,59 @@ inline uint8* WireFormatLite::InternalWriteMessageNoVirtualToArray( // =================================================================== -inline size_t WireFormatLite::Int32Size(int32 value) { +inline size_t WireFormatLite::Int32Size(int32_t value) { return io::CodedOutputStream::VarintSize32SignExtended(value); } inline size_t WireFormatLite::Int64Size(int64 value) { - return io::CodedOutputStream::VarintSize64(static_cast<uint64>(value)); + return io::CodedOutputStream::VarintSize64(static_cast<uint64_t>(value)); +} +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline size_t WireFormatLite::Int64Size(int64_t value) { + return io::CodedOutputStream::VarintSize64(static_cast<uint64_t>(value)); } -inline size_t WireFormatLite::UInt32Size(uint32 value) { +#endif +inline size_t WireFormatLite::UInt32Size(uint32_t value) { return io::CodedOutputStream::VarintSize32(value); } inline size_t WireFormatLite::UInt64Size(uint64 value) { return io::CodedOutputStream::VarintSize64(value); } -inline size_t WireFormatLite::SInt32Size(int32 value) { +inline size_t WireFormatLite::SInt32Size(int32_t value) { return io::CodedOutputStream::VarintSize32(ZigZagEncode32(value)); } inline size_t WireFormatLite::SInt64Size(int64 value) { return io::CodedOutputStream::VarintSize64(ZigZagEncode64(value)); } +#if defined(_64_) && (defined(_darwin_) || defined(_ios_)) +inline size_t WireFormatLite::SInt64Size(int64_t value) { + return io::CodedOutputStream::VarintSize64(ZigZagEncode64(value)); +} +#endif inline size_t WireFormatLite::EnumSize(int value) { return io::CodedOutputStream::VarintSize32SignExtended(value); } +inline size_t WireFormatLite::Int32SizePlusOne(int32_t value) { + return io::CodedOutputStream::VarintSize32SignExtendedPlusOne(value); +} +inline size_t WireFormatLite::Int64SizePlusOne(int64_t value) { + return io::CodedOutputStream::VarintSize64PlusOne( + static_cast<uint64_t>(value)); +} +inline size_t WireFormatLite::UInt32SizePlusOne(uint32_t value) { + return io::CodedOutputStream::VarintSize32PlusOne(value); +} +inline size_t WireFormatLite::UInt64SizePlusOne(uint64_t value) { + return io::CodedOutputStream::VarintSize64PlusOne(value); +} +inline size_t WireFormatLite::SInt32SizePlusOne(int32_t value) { + return io::CodedOutputStream::VarintSize32PlusOne(ZigZagEncode32(value)); +} +inline size_t WireFormatLite::SInt64SizePlusOne(int64_t value) { + return io::CodedOutputStream::VarintSize64PlusOne(ZigZagEncode64(value)); +} +inline size_t WireFormatLite::EnumSizePlusOne(int value) { + return io::CodedOutputStream::VarintSize32SignExtendedPlusOne(value); +} inline size_t WireFormatLite::StringSize(const TProtoStringType& value) { return LengthDelimitedSize(value.size()); @@ -1774,11 +2066,11 @@ inline size_t WireFormatLite::MessageSizeNoVirtual( inline size_t WireFormatLite::LengthDelimitedSize(size_t length) { // The static_cast here prevents an error in certain compiler configurations - // but is not technically correct--if length is too large to fit in a uint32 + // but is not technically correct--if length is too large to fit in a uint32_t // then it will be silently truncated. We will need to fix this if we ever // decide to start supporting serialized messages greater than 2 GiB in size. return length + - io::CodedOutputStream::VarintSize32(static_cast<uint32>(length)); + io::CodedOutputStream::VarintSize32(static_cast<uint32_t>(length)); } template <typename MS> @@ -1787,19 +2079,19 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { // required int32 type_id = 2; // required data message = 3; - uint32 last_type_id = 0; + uint32_t last_type_id = 0; // If we see message data before the type_id, we'll append it to this so // we can parse it later. TProtoStringType message_data; while (true) { - const uint32 tag = input->ReadTagNoLastTag(); + const uint32_t tag = input->ReadTagNoLastTag(); if (tag == 0) return false; switch (tag) { case WireFormatLite::kMessageSetTypeIdTag: { - uint32 type_id; + uint32_t type_id; if (!input->ReadVarint32(&type_id)) return false; last_type_id = type_id; @@ -1807,7 +2099,7 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { // We saw some message data before the type_id. Have to parse it // now. io::CodedInputStream sub_input( - reinterpret_cast<const uint8*>(message_data.data()), + reinterpret_cast<const uint8_t*>(message_data.data()), static_cast<int>(message_data.size())); sub_input.SetRecursionLimit(input->RecursionBudget()); if (!ms.ParseField(last_type_id, &sub_input)) { @@ -1822,13 +2114,13 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { case WireFormatLite::kMessageSetMessageTag: { if (last_type_id == 0) { // We haven't seen a type_id yet. Append this data to message_data. - uint32 length; + uint32_t length; if (!input->ReadVarint32(&length)) return false; - if (static_cast<int32>(length) < 0) return false; - uint32 size = static_cast<uint32>( + if (static_cast<int32_t>(length) < 0) return false; + uint32_t size = static_cast<uint32_t>( length + io::CodedOutputStream::VarintSize32(length)); message_data.resize(size); - auto ptr = reinterpret_cast<uint8*>(&message_data[0]); + auto ptr = reinterpret_cast<uint8_t*>(&message_data[0]); ptr = io::CodedOutputStream::WriteVarint32ToArray(length, ptr); if (!input->ReadRaw(ptr, length)) return false; } else { diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc index 128ddfc409..d1322e96ab 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc @@ -132,82 +132,91 @@ static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_s const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DoubleValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DoubleValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::DoubleValue, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DoubleValue, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FloatValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FloatValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::FloatValue, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FloatValue, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int64Value, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int64Value, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int64Value, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt64Value, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt64Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt64Value, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt64Value, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int32Value, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::Int32Value, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Int32Value, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt32Value, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt32Value, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::UInt32Value, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::UInt32Value, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BoolValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BoolValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BoolValue, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BoolValue, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::StringValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::StringValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::StringValue, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::StringValue, value_), ~0u, // no _has_bits_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BytesValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BytesValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::BytesValue, value_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::BytesValue, value_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, -1, sizeof(PROTOBUF_NAMESPACE_ID::DoubleValue)}, - { 6, -1, sizeof(PROTOBUF_NAMESPACE_ID::FloatValue)}, - { 12, -1, sizeof(PROTOBUF_NAMESPACE_ID::Int64Value)}, - { 18, -1, sizeof(PROTOBUF_NAMESPACE_ID::UInt64Value)}, - { 24, -1, sizeof(PROTOBUF_NAMESPACE_ID::Int32Value)}, - { 30, -1, sizeof(PROTOBUF_NAMESPACE_ID::UInt32Value)}, - { 36, -1, sizeof(PROTOBUF_NAMESPACE_ID::BoolValue)}, - { 42, -1, sizeof(PROTOBUF_NAMESPACE_ID::StringValue)}, - { 48, -1, sizeof(PROTOBUF_NAMESPACE_ID::BytesValue)}, + { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::DoubleValue)}, + { 7, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::FloatValue)}, + { 14, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Int64Value)}, + { 21, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UInt64Value)}, + { 28, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Int32Value)}, + { 35, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::UInt32Value)}, + { 42, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::BoolValue)}, + { 49, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::StringValue)}, + { 56, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::BytesValue)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_DoubleValue_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_FloatValue_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Int64Value_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_UInt64Value_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_Int32Value_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_UInt32Value_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_BoolValue_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_StringValue_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::_BytesValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_DoubleValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_FloatValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Int64Value_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_UInt64Value_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_Int32Value_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_UInt32Value_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_BoolValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_StringValue_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::_BytesValue_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fwrappers_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -307,28 +316,29 @@ const char* DoubleValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -365,13 +375,7 @@ size_t DoubleValue::ByteSizeLong() const { total_size += 1 + 8; } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DoubleValue::_class_data_ = { @@ -380,8 +384,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DoubleValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DoubleValue::GetClassData() const { return &_class_data_; } -void DoubleValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void DoubleValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<DoubleValue *>(to)->MergeFrom( static_cast<const DoubleValue &>(from)); } @@ -490,28 +494,29 @@ const char* FloatValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); ptr += sizeof(float); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -548,13 +553,7 @@ size_t FloatValue::ByteSizeLong() const { total_size += 1 + 4; } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FloatValue::_class_data_ = { @@ -563,8 +562,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FloatValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FloatValue::GetClassData() const { return &_class_data_; } -void FloatValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void FloatValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<FloatValue *>(to)->MergeFrom( static_cast<const FloatValue &>(from)); } @@ -673,28 +672,29 @@ const char* Int64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -728,18 +728,10 @@ size_t Int64Value::ByteSizeLong() const { // int64 value = 1; if (this->_internal_value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( - this->_internal_value()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Int64Value::_class_data_ = { @@ -748,8 +740,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Int64Value::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Int64Value::GetClassData() const { return &_class_data_; } -void Int64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Int64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Int64Value *>(to)->MergeFrom( static_cast<const Int64Value &>(from)); } @@ -858,28 +850,29 @@ const char* UInt64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -913,18 +906,10 @@ size_t UInt64Value::ByteSizeLong() const { // uint64 value = 1; if (this->_internal_value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( - this->_internal_value()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UInt64Value::_class_data_ = { @@ -933,8 +918,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UInt64Value::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UInt64Value::GetClassData() const { return &_class_data_; } -void UInt64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void UInt64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<UInt64Value *>(to)->MergeFrom( static_cast<const UInt64Value &>(from)); } @@ -1043,28 +1028,29 @@ const char* Int32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1098,18 +1084,10 @@ size_t Int32Value::ByteSizeLong() const { // int32 value = 1; if (this->_internal_value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_value()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Int32Value::_class_data_ = { @@ -1118,8 +1096,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Int32Value::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Int32Value::GetClassData() const { return &_class_data_; } -void Int32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Int32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Int32Value *>(to)->MergeFrom( static_cast<const Int32Value &>(from)); } @@ -1228,28 +1206,29 @@ const char* UInt32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1283,18 +1262,10 @@ size_t UInt32Value::ByteSizeLong() const { // uint32 value = 1; if (this->_internal_value() != 0) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( - this->_internal_value()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UInt32Value::_class_data_ = { @@ -1303,8 +1274,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UInt32Value::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UInt32Value::GetClassData() const { return &_class_data_; } -void UInt32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void UInt32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<UInt32Value *>(to)->MergeFrom( static_cast<const UInt32Value &>(from)); } @@ -1413,28 +1384,29 @@ const char* BoolValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1471,13 +1443,7 @@ size_t BoolValue::ByteSizeLong() const { total_size += 1 + 1; } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BoolValue::_class_data_ = { @@ -1486,8 +1452,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BoolValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*BoolValue::GetClassData() const { return &_class_data_; } -void BoolValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void BoolValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<BoolValue *>(to)->MergeFrom( static_cast<const BoolValue &>(from)); } @@ -1603,28 +1569,29 @@ const char* StringValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.StringValue.value")); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1667,13 +1634,7 @@ size_t StringValue::ByteSizeLong() const { this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData StringValue::_class_data_ = { @@ -1682,8 +1643,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData StringValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*StringValue::GetClassData() const { return &_class_data_; } -void StringValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void StringValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<StringValue *>(to)->MergeFrom( static_cast<const StringValue &>(from)); } @@ -1714,11 +1675,13 @@ bool StringValue::IsInitialized() const { void StringValue::InternalSwap(StringValue* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &value_, GetArenaForAllocation(), - &other->value_, other->GetArenaForAllocation() + &value_, lhs_arena, + &other->value_, rhs_arena ); } @@ -1802,28 +1765,29 @@ const char* BytesValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID: auto str = _internal_mutable_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1862,13 +1826,7 @@ size_t BytesValue::ByteSizeLong() const { this->_internal_value()); } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BytesValue::_class_data_ = { @@ -1877,8 +1835,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BytesValue::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*BytesValue::GetClassData() const { return &_class_data_; } -void BytesValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void BytesValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<BytesValue *>(to)->MergeFrom( static_cast<const BytesValue &>(from)); } @@ -1909,11 +1867,13 @@ bool BytesValue::IsInitialized() const { void BytesValue::InternalSwap(BytesValue* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &value_, GetArenaForAllocation(), - &other->value_, other->GetArenaForAllocation() + &value_, lhs_arena, + &other->value_, rhs_arena ); } @@ -1926,32 +1886,32 @@ void BytesValue::InternalSwap(BytesValue* other) { // @@protoc_insertion_point(namespace_scope) PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::DoubleValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::DoubleValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::DoubleValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::DoubleValue >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::FloatValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::FloatValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::FloatValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::FloatValue >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Int64Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Int64Value >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Int64Value >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Int64Value >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::UInt64Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::UInt64Value >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::UInt64Value >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::UInt64Value >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Int32Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::Int32Value >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Int32Value >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Int32Value >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::UInt32Value >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::UInt32Value >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::UInt32Value >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::UInt32Value >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::BoolValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::BoolValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::BoolValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::BoolValue >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::StringValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::StringValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::StringValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::StringValue >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::BytesValue >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::BytesValue >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::BytesValue >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::BytesValue >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h index 81e9349c07..e41e150ba0 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -83,15 +83,15 @@ struct UInt64ValueDefaultTypeInternal; PROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_instance_; PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::BoolValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::BytesValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::DoubleValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FloatValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Int32Value>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Int64Value>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::StringValue>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::UInt32Value>(Arena*); -template<> PROTOBUF_EXPORT PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::UInt64Value>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::BoolValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::BoolValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::BytesValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::BytesValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::DoubleValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::DoubleValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::FloatValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::FloatValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Int32Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Int32Value>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::Int64Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Int64Value>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::StringValue* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::StringValue>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::UInt32Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::UInt32Value>(Arena*); +template<> PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::UInt64Value* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::UInt64Value>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN @@ -116,7 +116,11 @@ class PROTOBUF_EXPORT DoubleValue final : } inline DoubleValue& operator=(DoubleValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -174,7 +178,7 @@ class PROTOBUF_EXPORT DoubleValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const DoubleValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -255,7 +259,11 @@ class PROTOBUF_EXPORT FloatValue final : } inline FloatValue& operator=(FloatValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -313,7 +321,7 @@ class PROTOBUF_EXPORT FloatValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const FloatValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -394,7 +402,11 @@ class PROTOBUF_EXPORT Int64Value final : } inline Int64Value& operator=(Int64Value&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -452,7 +464,7 @@ class PROTOBUF_EXPORT Int64Value final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Int64Value& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -533,7 +545,11 @@ class PROTOBUF_EXPORT UInt64Value final : } inline UInt64Value& operator=(UInt64Value&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -591,7 +607,7 @@ class PROTOBUF_EXPORT UInt64Value final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const UInt64Value& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -672,7 +688,11 @@ class PROTOBUF_EXPORT Int32Value final : } inline Int32Value& operator=(Int32Value&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -730,7 +750,7 @@ class PROTOBUF_EXPORT Int32Value final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Int32Value& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -811,7 +831,11 @@ class PROTOBUF_EXPORT UInt32Value final : } inline UInt32Value& operator=(UInt32Value&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -869,7 +893,7 @@ class PROTOBUF_EXPORT UInt32Value final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const UInt32Value& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -950,7 +974,11 @@ class PROTOBUF_EXPORT BoolValue final : } inline BoolValue& operator=(BoolValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1008,7 +1036,7 @@ class PROTOBUF_EXPORT BoolValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const BoolValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1089,7 +1117,11 @@ class PROTOBUF_EXPORT StringValue final : } inline StringValue& operator=(StringValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1147,7 +1179,7 @@ class PROTOBUF_EXPORT StringValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const StringValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -1233,7 +1265,11 @@ class PROTOBUF_EXPORT BytesValue final : } inline BytesValue& operator=(BytesValue&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -1291,7 +1327,7 @@ class PROTOBUF_EXPORT BytesValue final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const BytesValue& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h index 03f93c49f9..a65c381842 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h @@ -103,14 +103,15 @@ class PROTOC_EXPORT CodeGenerator { GeneratorContext* generator_context, TProtoStringType* error) const; - // Sync with plugin.proto. + // This must be kept in sync with plugin.proto. See that file for + // documentation on each value. enum Feature { FEATURE_PROTO3_OPTIONAL = 1, }; // Implement this to indicate what features this code generator supports. - // This should be a bitwise OR of features from the Features enum in - // plugin.proto. + // + // This must be a bitwise OR of values from the Feature enum above (or zero). virtual uint64_t GetSupportedFeatures() const { return 0; } // This is no longer used, but this class is part of the opensource protobuf diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc index 7663ea0085..c1ae224e22 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc @@ -298,36 +298,36 @@ class CommandLineInterface::ErrorPrinter // implements MultiFileErrorCollector ------------------------------ void AddError(const TProtoStringType& filename, int line, int column, - const TProtoStringType& message) { + const TProtoStringType& message) override { found_errors_ = true; AddErrorOrWarning(filename, line, column, message, "error", std::cerr); } void AddWarning(const TProtoStringType& filename, int line, int column, - const TProtoStringType& message) { + const TProtoStringType& message) override { found_warnings_ = true; AddErrorOrWarning(filename, line, column, message, "warning", std::clog); } // implements io::ErrorCollector ----------------------------------- - void AddError(int line, int column, const TProtoStringType& message) { + void AddError(int line, int column, const TProtoStringType& message) override { AddError("input", line, column, message); } - void AddWarning(int line, int column, const TProtoStringType& message) { + void AddWarning(int line, int column, const TProtoStringType& message) override { AddErrorOrWarning("input", line, column, message, "warning", std::clog); } // implements DescriptorPool::ErrorCollector------------------------- void AddError(const TProtoStringType& filename, const TProtoStringType& element_name, const Message* descriptor, ErrorLocation location, - const TProtoStringType& message) { + const TProtoStringType& message) override { AddErrorOrWarning(filename, -1, -1, message, "error", std::cerr); } void AddWarning(const TProtoStringType& filename, const TProtoStringType& element_name, const Message* descriptor, ErrorLocation location, - const TProtoStringType& message) { + const TProtoStringType& message) override { AddErrorOrWarning(filename, -1, -1, message, "warning", std::clog); } @@ -400,14 +400,14 @@ class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { void GetOutputFilenames(std::vector<TProtoStringType>* output_filenames); // implements GeneratorContext -------------------------------------- - io::ZeroCopyOutputStream* Open(const TProtoStringType& filename); - io::ZeroCopyOutputStream* OpenForAppend(const TProtoStringType& filename); + io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) override; + io::ZeroCopyOutputStream* OpenForAppend(const TProtoStringType& filename) override; io::ZeroCopyOutputStream* OpenForInsert(const TProtoStringType& filename, - const TProtoStringType& insertion_point); + const TProtoStringType& insertion_point) override; io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( const TProtoStringType& filename, const TProtoStringType& insertion_point, - const google::protobuf::GeneratedCodeInfo& info); - void ListParsedFiles(std::vector<const FileDescriptor*>* output) { + const google::protobuf::GeneratedCodeInfo& info) override; + void ListParsedFiles(std::vector<const FileDescriptor*>* output) override { *output = parsed_files_; } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.h index 3fa64a8640..793ab2d793 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.h @@ -50,17 +50,18 @@ class EnumFieldGenerator : public FieldGenerator { ~EnumFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); @@ -73,10 +74,10 @@ class EnumOneofFieldGenerator : public EnumFieldGenerator { ~EnumOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumOneofFieldGenerator); @@ -89,19 +90,20 @@ class RepeatedEnumFieldGenerator : public FieldGenerator { ~RepeatedEnumFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const {} + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override {} void GenerateMergeFromCodedStream(io::Printer* printer) const; void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.cc index 9b0fcb02da..23ab1bc0bb 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.cc @@ -57,8 +57,9 @@ TProtoStringType ExtendeeClassName(const FieldDescriptor* descriptor) { } // anonymous namespace ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, - const Options& options) - : descriptor_(descriptor), options_(options) { + const Options& options, + MessageSCCAnalyzer* scc_analyzer) + : descriptor_(descriptor), options_(options), scc_analyzer_(scc_analyzer) { // Construct type_traits_. if (descriptor_->is_repeated()) { type_traits_ = "Repeated"; @@ -179,6 +180,18 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { " ::$proto_ns$::internal::$type_traits$, $field_type$, $packed$ >\n" " $scoped_name$($constant_name$, $1$);\n", default_str); + + // Register extension verify function if needed. + if (descriptor_->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + ShouldVerify(descriptor_->message_type(), options_, scc_analyzer_) && + ShouldVerify(descriptor_->containing_type(), options_, scc_analyzer_)) { + format( + "PROTOBUF_ATTRIBUTE_INIT_PRIORITY " + "::$proto_ns$::internal::RegisterExtensionVerify< $extendee$,\n" + " $1$, $number$> $2$_$name$_register;\n", + ClassName(descriptor_->message_type(), true), + IsScoped() ? ClassName(descriptor_->extension_scope(), false) : ""); + } } } // namespace cpp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.h index 88c7dafbc3..5a32e84554 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_extension.h @@ -55,6 +55,8 @@ namespace protobuf { namespace compiler { namespace cpp { +class MessageSCCAnalyzer; + // Generates code for an extension, which may be within the scope of some // message or may be at file scope. This is much simpler than FieldGenerator // since extensions are just simple identifiers with interesting types. @@ -62,7 +64,8 @@ class ExtensionGenerator { public: // See generator.cc for the meaning of dllexport_decl. explicit ExtensionGenerator(const FieldDescriptor* descriptor, - const Options& options); + const Options& options, + MessageSCCAnalyzer* scc_analyzer); ~ExtensionGenerator(); // Header stuff. @@ -77,6 +80,7 @@ class ExtensionGenerator { const FieldDescriptor* descriptor_; TProtoStringType type_traits_; Options options_; + MessageSCCAnalyzer* scc_analyzer_; std::map<TProtoStringType, TProtoStringType> variables_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.cc index 09261aaddc..22e2a8a4a6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.cc @@ -61,37 +61,39 @@ using internal::WireFormat; namespace { -TProtoStringType GenerateAnnotation(StringPiece substitute_template_prefix, - StringPiece prepared_template, - StringPiece substitute_template_suffix, - int field_index, StringPiece lambda_args, - StringPiece access_type) { - return strings::Substitute( - StrCat(substitute_template_prefix, prepared_template, - substitute_template_suffix), - field_index, access_type, lambda_args); +void MaySetAnnotationVariable(const Options& options, + StringPiece annotation_name, + StringPiece substitute_template_prefix, + StringPiece prepared_template, + int field_index, StringPiece access_type, + std::map<TProtoStringType, TProtoStringType>* variables) { + if (options.field_listener_options.forbidden_field_listener_events.count( + TProtoStringType(annotation_name))) + return; + (*variables)[StrCat("annotate_", annotation_name)] = strings::Substitute( + StrCat(substitute_template_prefix, prepared_template, ");\n"), + field_index, access_type); } TProtoStringType GenerateTemplateForOneofString(const FieldDescriptor* descriptor, StringPiece proto_ns, StringPiece field_member) { + TProtoStringType field_name = google::protobuf::compiler::cpp::FieldName(descriptor); TProtoStringType field_pointer = descriptor->options().ctype() == google::protobuf::FieldOptions::STRING ? "$0.GetPointer()" : "$0"; if (descriptor->default_value_string().empty()) { - return strings::Substitute( - StrCat("_internal_has_", - google::protobuf::compiler::cpp::FieldName(descriptor), - "()? _listener_->ExtractFieldInfo(", field_pointer, - "): ::", proto_ns, "::FieldAccessListener::AddressInfo()"), - field_member); + return strings::Substitute(StrCat("_internal_has_", field_name, "() ? ", + field_pointer, ": nullptr"), + field_member); } if (descriptor->options().ctype() == google::protobuf::FieldOptions::STRING_PIECE) { - return StrCat("_listener_->ExtractFieldInfo(_internal_", - google::protobuf::compiler::cpp::FieldName(descriptor), "())"); + return strings::Substitute(StrCat("_internal_has_", field_name, "() ? ", + field_pointer, ": nullptr"), + field_member); } TProtoStringType default_value_pointer = @@ -99,26 +101,24 @@ TProtoStringType GenerateTemplateForOneofString(const FieldDescriptor* descripto ? "&$1.get()" : "&$1"; return strings::Substitute( - StrCat("_listener_->ExtractFieldInfo(_internal_has_", - google::protobuf::compiler::cpp::FieldName(descriptor), "()? ", - field_pointer, " : ", default_value_pointer, ")"), + StrCat("_internal_has_", field_name, "() ? ", field_pointer, " : ", + default_value_pointer), field_member, MakeDefaultName(descriptor)); } TProtoStringType GenerateTemplateForSingleString(const FieldDescriptor* descriptor, StringPiece field_member) { if (descriptor->default_value_string().empty()) { - return strings::Substitute("_listener_->ExtractFieldInfo(&$0)", field_member); + return StrCat("&", field_member); } if (descriptor->options().ctype() == google::protobuf::FieldOptions::STRING) { return strings::Substitute( - "_listener_->ExtractFieldInfo($0.IsDefault(" - "nullptr) ? &$1.get() : $0.GetPointer())", - field_member, MakeDefaultName(descriptor)); + "$0.IsDefault(nullptr) ? &$1.get() : $0.GetPointer()", field_member, + MakeDefaultName(descriptor)); } - return strings::Substitute("_listener_->ExtractFieldInfo(&$0)", field_member); + return StrCat("&", field_member); } } // namespace @@ -143,7 +143,7 @@ void AddAccessorAnnotations(const FieldDescriptor* descriptor, " ", FieldName(descriptor), "_AccessedNoStrip = true;\n"); } } - if (!options.inject_field_listener_events) { + if (!options.field_listener_options.inject_field_listener_events) { return; } if (descriptor->file()->options().optimize_for() == @@ -157,50 +157,29 @@ void AddAccessorAnnotations(const FieldDescriptor* descriptor, field_member = StrCat(oneof_member->name(), "_.", field_member); } const TProtoStringType proto_ns = (*variables)["proto_ns"]; - TProtoStringType lambda_args = "_listener_, this"; - TProtoStringType lambda_flat_args = "_listener_, this"; - const TProtoStringType substitute_template_prefix = StrCat( - " {\n" - " auto _listener_ = ::", - proto_ns, - "::FieldAccessListener::GetListener();\n" - " if (_listener_) _listener_->OnFieldAccess([$2] { return "); - const TProtoStringType substitute_template_suffix = StrCat( - "; }, " - "GetDescriptor()->field($0), " - "::", - proto_ns, - "::FieldAccessListener::FieldAccessType::$1);\n" - " }\n"); + const TProtoStringType substitute_template_prefix = " _tracker_.$1<$0>(this, "; TProtoStringType prepared_template; // Flat template is needed if the prepared one is introspecting the values // inside the returned values, for example, for repeated fields and maps. TProtoStringType prepared_flat_template; TProtoStringType prepared_add_template; - // TODO(jianzhouzh): Fix all forward declared messages and deal with the - // weak fields. + // TODO(b/190614678): Support fields with type Message or Map. if (descriptor->is_repeated() && !descriptor->is_map()) { if (descriptor->type() != FieldDescriptor::TYPE_MESSAGE && descriptor->type() != FieldDescriptor::TYPE_GROUP) { - lambda_args = "_listener_, this, index"; - prepared_template = strings::Substitute( - "_listener_->ExtractFieldInfo(&$0.Get(index))", field_member); - prepared_add_template = strings::Substitute( - "_listener_->ExtractFieldInfo(&$0.Get($0.size() - 1))", field_member); - } else { - prepared_template = - StrCat("::", proto_ns, "::FieldAccessListener::AddressInfo()"); + prepared_template = strings::Substitute("&$0.Get(index)", field_member); prepared_add_template = - StrCat("::", proto_ns, "::FieldAccessListener::AddressInfo()"); + strings::Substitute("&$0.Get($0.size() - 1)", field_member); + } else { + prepared_template = "nullptr"; + prepared_add_template = "nullptr"; } } else if (descriptor->is_map()) { - prepared_template = - StrCat("::", proto_ns, "::FieldAccessListener::AddressInfo()"); + prepared_template = "nullptr"; } else if (descriptor->type() == FieldDescriptor::TYPE_MESSAGE && !descriptor->options().lazy()) { - prepared_template = - StrCat("::", proto_ns, "::FieldAccessListener::AddressInfo()"); + prepared_template = "nullptr"; } else if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_STRING) { if (oneof_member) { prepared_template = GenerateTemplateForOneofString( @@ -210,56 +189,49 @@ void AddAccessorAnnotations(const FieldDescriptor* descriptor, GenerateTemplateForSingleString(descriptor, field_member); } } else { - prepared_template = - strings::Substitute("_listener_->ExtractFieldInfo(&$0)", field_member); + prepared_template = StrCat("&", field_member); } if (descriptor->is_repeated() && !descriptor->is_map() && descriptor->type() != FieldDescriptor::TYPE_MESSAGE && descriptor->type() != FieldDescriptor::TYPE_GROUP) { - prepared_flat_template = - strings::Substitute("_listener_->ExtractFieldInfo(&$0)", field_member); + prepared_flat_template = StrCat("&", field_member); } else { prepared_flat_template = prepared_template; } - (*variables)["annotate_get"] = GenerateAnnotation( - substitute_template_prefix, prepared_template, substitute_template_suffix, - descriptor->index(), lambda_args, "kGet"); - (*variables)["annotate_set"] = GenerateAnnotation( - substitute_template_prefix, prepared_template, substitute_template_suffix, - descriptor->index(), lambda_args, "kSet"); - (*variables)["annotate_has"] = GenerateAnnotation( - substitute_template_prefix, prepared_template, substitute_template_suffix, - descriptor->index(), lambda_args, "kHas"); - (*variables)["annotate_mutable"] = GenerateAnnotation( - substitute_template_prefix, prepared_template, substitute_template_suffix, - descriptor->index(), lambda_args, "kMutable"); - (*variables)["annotate_release"] = GenerateAnnotation( - substitute_template_prefix, prepared_template, substitute_template_suffix, - descriptor->index(), lambda_args, "kRelease"); - (*variables)["annotate_clear"] = - GenerateAnnotation(substitute_template_prefix, prepared_flat_template, - substitute_template_suffix, descriptor->index(), - lambda_flat_args, "kClear"); - (*variables)["annotate_size"] = - GenerateAnnotation(substitute_template_prefix, prepared_flat_template, - substitute_template_suffix, descriptor->index(), - lambda_flat_args, "kSize"); - (*variables)["annotate_list"] = - GenerateAnnotation(substitute_template_prefix, prepared_flat_template, - substitute_template_suffix, descriptor->index(), - lambda_flat_args, "kList"); - (*variables)["annotate_mutable_list"] = - GenerateAnnotation(substitute_template_prefix, prepared_flat_template, - substitute_template_suffix, descriptor->index(), - lambda_flat_args, "kMutableList"); - (*variables)["annotate_add"] = - GenerateAnnotation(substitute_template_prefix, prepared_add_template, - substitute_template_suffix, descriptor->index(), - lambda_flat_args, "kAdd"); - (*variables)["annotate_add_mutable"] = - GenerateAnnotation(substitute_template_prefix, prepared_add_template, - substitute_template_suffix, descriptor->index(), - lambda_flat_args, "kAddMutable"); + + MaySetAnnotationVariable(options, "get", substitute_template_prefix, + prepared_template, descriptor->index(), "OnGet", + variables); + MaySetAnnotationVariable(options, "set", substitute_template_prefix, + prepared_template, descriptor->index(), "OnSet", + variables); + MaySetAnnotationVariable(options, "has", substitute_template_prefix, + prepared_template, descriptor->index(), "OnHas", + variables); + MaySetAnnotationVariable(options, "mutable", substitute_template_prefix, + prepared_template, descriptor->index(), "OnMutable", + variables); + MaySetAnnotationVariable(options, "release", substitute_template_prefix, + prepared_template, descriptor->index(), "OnRelease", + variables); + MaySetAnnotationVariable(options, "clear", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnClear", variables); + MaySetAnnotationVariable(options, "size", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnSize", variables); + MaySetAnnotationVariable(options, "list", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnList", variables); + MaySetAnnotationVariable(options, "mutable_list", substitute_template_prefix, + prepared_flat_template, descriptor->index(), + "OnMutableList", variables); + MaySetAnnotationVariable(options, "add", substitute_template_prefix, + prepared_add_template, descriptor->index(), "OnAdd", + variables); + MaySetAnnotationVariable(options, "add_mutable", substitute_template_prefix, + prepared_add_template, descriptor->index(), + "OnAddMutable", variables); } void SetCommonFieldVariables(const FieldDescriptor* descriptor, @@ -310,6 +282,22 @@ void FieldGenerator::SetHasBitIndex(int32_t has_bit_index) { strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8), "u;"); } +void FieldGenerator::SetInlinedStringIndex(int32_t inlined_string_index) { + if (!IsStringInlined(descriptor_, options_)) { + GOOGLE_CHECK_EQ(inlined_string_index, -1); + return; + } + variables_["inlined_string_donated"] = StrCat( + "(_inlined_string_donated_[", inlined_string_index / 32, "] & 0x", + strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8), + "u) != 0;"); + variables_["donating_states_word"] = + StrCat("_inlined_string_donated_[", inlined_string_index / 32, "]"); + variables_["mask_for_undonate"] = StrCat( + "~0x", strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8), + "u"); +} + void SetCommonOneofFieldVariables( const FieldDescriptor* descriptor, std::map<TProtoStringType, TProtoStringType>* variables) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.h index b05f2d93fa..d263b10e70 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_field.h @@ -181,7 +181,10 @@ class FieldGenerator { // are placed in the message's ByteSize() method. virtual void GenerateByteSize(io::Printer* printer) const = 0; + virtual bool IsInlined() const { return false; } + void SetHasBitIndex(int32_t has_bit_index); + void SetInlinedStringIndex(int32_t inlined_string_index); protected: const FieldDescriptor* descriptor_; @@ -207,6 +210,12 @@ class FieldGeneratorMap { } } + void SetInlinedStringIndices(const std::vector<int>& inlined_string_indices) { + for (int i = 0; i < descriptor_->field_count(); ++i) { + field_generators_[i]->SetInlinedStringIndex(inlined_string_indices[i]); + } + } + private: const Descriptor* descriptor_; std::vector<std::unique_ptr<FieldGenerator>> field_generators_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.cc index c371a55233..6e3f174c5b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -131,7 +131,7 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) } for (int i = 0; i < file->extension_count(); i++) { extension_generators_.emplace_back( - new ExtensionGenerator(file->extension(i), options)); + new ExtensionGenerator(file->extension(i), options, &scc_analyzer_)); } for (int i = 0; i < file->weak_dependency_count(); ++i) { weak_deps_.insert(file->weak_dependency(i)); @@ -468,6 +468,19 @@ void FileGenerator::GenerateSourceDefaultInstance(int idx, DefaultInstanceType(generator->descriptor_, options_), DefaultInstanceName(generator->descriptor_, options_)); + for (int i = 0; i < generator->descriptor_->field_count(); i++) { + const FieldDescriptor* field = generator->descriptor_->field(i); + if (IsStringInlined(field, options_)) { + // Force the initialization of the inlined string in the default instance. + format( + "PROTOBUF_ATTRIBUTE_INIT_PRIORITY std::true_type " + "$1$::_init_inline_$2$_ = " + "($3$._instance.$2$_.Init(), std::true_type{});\n", + ClassName(generator->descriptor_), FieldName(field), + DefaultInstanceName(generator->descriptor_, options_)); + } + } + if (options_.lite_implicit_weak_fields) { format("$1$* $2$ = &$3$;\n", DefaultInstanceType(generator->descriptor_, options_), @@ -583,6 +596,13 @@ void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) { "// @@protoc_insertion_point(global_scope)\n"); } +void FileGenerator::GenerateSourceForExtension(int idx, io::Printer* printer) { + Formatter format(printer, variables_); + GenerateSourceIncludes(printer); + NamespaceOpener ns(Namespace(file_, options_), format); + extension_generators_[idx]->GenerateDefinition(printer); +} + void FileGenerator::GenerateGlobalSource(io::Printer* printer) { Formatter format(printer, variables_); GenerateSourceIncludes(printer); @@ -603,21 +623,6 @@ void FileGenerator::GenerateGlobalSource(io::Printer* printer) { for (int i = 0; i < enum_generators_.size(); i++) { enum_generators_[i]->GenerateMethods(i, printer); } - - // Define extensions. - for (int i = 0; i < extension_generators_.size(); i++) { - extension_generators_[i]->GenerateDefinition(printer); - } - - if (HasGenericServices(file_, options_)) { - // Generate services. - for (int i = 0; i < service_generators_.size(); i++) { - if (i == 0) format("\n"); - format(kThickSeparator); - format("\n"); - service_generators_[i]->GenerateImplementation(printer); - } - } } void FileGenerator::GenerateSource(io::Printer* printer) { @@ -1176,6 +1181,9 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) { GOOGLE_CHECK(!options_.opensource_runtime); IncludeFile("net/proto2/public/lazy_field.h", printer); } + if (ShouldVerify(file_, options_, &scc_analyzer_)) { + IncludeFile("net/proto2/public/wire_format_verify.h", printer); + } if (options_.opensource_runtime) { // Verify the protobuf library header version is compatible with the protoc @@ -1203,6 +1211,12 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* printer) { IncludeFile("net/proto2/io/public/coded_stream.h", printer); IncludeFile("net/proto2/public/arena.h", printer); IncludeFile("net/proto2/public/arenastring.h", printer); + if (options_.force_inline_string || options_.profile_driven_inline_string) { + IncludeFile("net/proto2/public/inlined_string_field.h", printer); + } + if (HasSimpleBaseClasses(file_, options_)) { + IncludeFile("net/proto2/public/generated_message_bases.h", printer); + } IncludeFile("net/proto2/public/generated_message_table_driven.h", printer); if (HasGeneratedMethods(file_, options_) && options_.tctable_mode != Options::kTCTableNever) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.h index 41e3907391..984bd26a31 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_file.h @@ -82,9 +82,20 @@ class FileGenerator { void GeneratePBHeader(io::Printer* printer, const TProtoStringType& info_path); void GenerateSource(io::Printer* printer); + // The following member functions are used when the lite_implicit_weak_fields + // option is set. In this mode the code is organized a bit differently to + // promote better linker stripping of unused code. In particular, we generate + // one .cc file per message, one .cc file per extension, and a main pb.cc file + // containing everything else. + int NumMessages() const { return message_generators_.size(); } - // Similar to GenerateSource but generates only one message + int NumExtensions() const { return extension_generators_.size(); } + // Generates the source file for one message. void GenerateSourceForMessage(int idx, io::Printer* printer); + // Generates the source file for one extension. + void GenerateSourceForExtension(int idx, io::Printer* printer); + // Generates a source file containing everything except messages and + // extensions. void GenerateGlobalSource(io::Printer* printer); private: diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_generator.cc index 1642299f98..7fe7511d0d 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_generator.cc @@ -35,6 +35,7 @@ #include <google/protobuf/compiler/cpp/cpp_generator.h> #include <memory> +#include <string> #include <utility> #include <vector> @@ -53,6 +54,12 @@ namespace cpp { CppGenerator::CppGenerator() {} CppGenerator::~CppGenerator() {} +namespace { +TProtoStringType NumberedCcFileName(const TProtoStringType& basename, int number) { + return StrCat(basename, ".out/", number, ".cc"); +} +} // namespace + bool CppGenerator::Generate(const FileDescriptor* file, const TProtoStringType& parameter, GeneratorContext* generator_context, @@ -107,7 +114,19 @@ bool CppGenerator::Generate(const FileDescriptor* file, } else if (options[i].first == "annotate_accessor") { file_options.annotate_accessor = true; } else if (options[i].first == "inject_field_listener_events") { - file_options.inject_field_listener_events = true; + file_options.field_listener_options.inject_field_listener_events = true; + } else if (options[i].first == "forbidden_field_listener_events") { + std::size_t pos = 0; + do { + std::size_t next_pos = options[i].second.find_first_of("+", pos); + if (next_pos == TProtoStringType::npos) { + next_pos = options[i].second.size(); + } + if (next_pos > pos) + file_options.field_listener_options.forbidden_field_listener_events + .insert(options[i].second.substr(pos, next_pos - pos)); + pos = next_pos + 1; + } while (pos < options[i].second.size()); } else if (options[i].first == "eagerly_verified_lazy") { file_options.eagerly_verified_lazy = true; } else if (options[i].first == "force_eagerly_verified_lazy") { @@ -206,24 +225,37 @@ bool CppGenerator::Generate(const FileDescriptor* file, file_generator.GenerateGlobalSource(&printer); } - int num_cc_files = file_generator.NumMessages(); + int num_cc_files = + file_generator.NumMessages() + file_generator.NumExtensions(); // If we're using implicit weak fields then we allow the user to // optionally specify how many files to generate, not counting the global // pb.cc file. If we have more files than messages, then some files will // be generated as empty placeholders. if (file_options.num_cc_files > 0) { - GOOGLE_CHECK_LE(file_generator.NumMessages(), file_options.num_cc_files) - << "There must be at least as many numbered .cc files as messages."; + GOOGLE_CHECK_LE(num_cc_files, file_options.num_cc_files) + << "There must be at least as many numbered .cc files as messages " + "and extensions."; num_cc_files = file_options.num_cc_files; } - for (int i = 0; i < num_cc_files; i++) { - std::unique_ptr<io::ZeroCopyOutputStream> output( - generator_context->Open(StrCat(basename, ".out/", i, ".cc"))); + int cc_file_number = 0; + for (int i = 0; i < file_generator.NumMessages(); i++) { + std::unique_ptr<io::ZeroCopyOutputStream> output(generator_context->Open( + NumberedCcFileName(basename, cc_file_number++))); io::Printer printer(output.get(), '$'); - if (i < file_generator.NumMessages()) { - file_generator.GenerateSourceForMessage(i, &printer); - } + file_generator.GenerateSourceForMessage(i, &printer); + } + for (int i = 0; i < file_generator.NumExtensions(); i++) { + std::unique_ptr<io::ZeroCopyOutputStream> output(generator_context->Open( + NumberedCcFileName(basename, cc_file_number++))); + io::Printer printer(output.get(), '$'); + file_generator.GenerateSourceForExtension(i, &printer); + } + // Create empty placeholder files if necessary to match the expected number + // of files. + for (; cc_file_number < num_cc_files; ++cc_file_number) { + std::unique_ptr<io::ZeroCopyOutputStream> output(generator_context->Open( + NumberedCcFileName(basename, cc_file_number))); } } else { std::unique_ptr<io::ZeroCopyOutputStream> output( diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc index 0f9660d237..736b73a3ea 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -169,30 +169,6 @@ static std::unordered_set<TProtoStringType>* MakeKeywordsMap() { static std::unordered_set<TProtoStringType>& kKeywords = *MakeKeywordsMap(); -// Encode [0..63] as 'A'-'Z', 'a'-'z', '0'-'9', '_' -char Base63Char(int value) { - GOOGLE_CHECK_GE(value, 0); - if (value < 26) return 'A' + value; - value -= 26; - if (value < 26) return 'a' + value; - value -= 26; - if (value < 10) return '0' + value; - GOOGLE_CHECK_EQ(value, 10); - return '_'; -} - -// Given a c identifier has 63 legal characters we can't implement base64 -// encoding. So we return the k least significant "digits" in base 63. -template <typename I> -TProtoStringType Base63(I n, int k) { - TProtoStringType res; - while (k-- > 0) { - res += Base63Char(static_cast<int>(n % 63)); - n /= 63; - } - return res; -} - TProtoStringType IntTypeName(const Options& options, const TProtoStringType& type) { if (options.opensource_runtime) { return "::PROTOBUF_NAMESPACE_ID::" + type; @@ -400,7 +376,7 @@ TProtoStringType Namespace(const FileDescriptor* d, const Options& options) { ret = StringReplace(ret, "::google::" "protobuf", - "PROTOBUF_NAMESPACE_ID", false); + "::PROTOBUF_NAMESPACE_ID", false); } return ret; } @@ -454,9 +430,14 @@ TProtoStringType FileDllExport(const FileDescriptor* file, const Options& option TProtoStringType SuperClassName(const Descriptor* descriptor, const Options& options) { - return "::" + ProtobufNamespace(options) + - (HasDescriptorMethods(descriptor->file(), options) ? "::Message" - : "::MessageLite"); + if (!HasDescriptorMethods(descriptor->file(), options)) { + return "::" + ProtobufNamespace(options) + "::MessageLite"; + } + auto simple_base = SimpleBaseClass(descriptor, options); + if (simple_base.empty()) { + return "::" + ProtobufNamespace(options) + "::Message"; + } + return "::" + ProtobufNamespace(options) + "::internal::" + simple_base; } TProtoStringType ResolveKeyword(const TProtoStringType& name) { @@ -796,6 +777,11 @@ TProtoStringType SafeFunctionName(const Descriptor* descriptor, return function_name; } +bool IsStringInlined(const FieldDescriptor* /* descriptor */, + const Options& /* options */) { + return false; +} + static bool HasLazyFields(const Descriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer) { for (int field_idx = 0; field_idx < descriptor->field_count(); field_idx++) { @@ -953,6 +939,18 @@ bool HasEnumDefinitions(const FileDescriptor* file) { return false; } +bool ShouldVerify(const Descriptor* /* descriptor */, + const Options& /* options */, + MessageSCCAnalyzer* /* scc_analyzer */) { + return false; +} + +bool ShouldVerify(const FileDescriptor* /* file */, + const Options& /* options */, + MessageSCCAnalyzer* /* scc_analyzer */) { + return false; +} + bool IsStringOrMessage(const FieldDescriptor* field) { switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_INT32: @@ -1099,21 +1097,12 @@ void GenerateUtf8CheckCodeForCord(const FieldDescriptor* field, "VerifyUTF8CordNamedField", format); } -namespace { - -void Flatten(const Descriptor* descriptor, - std::vector<const Descriptor*>* flatten) { - for (int i = 0; i < descriptor->nested_type_count(); i++) - Flatten(descriptor->nested_type(i), flatten); - flatten->push_back(descriptor); -} - -} // namespace - void FlattenMessagesInFile(const FileDescriptor* file, std::vector<const Descriptor*>* result) { for (int i = 0; i < file->message_type_count(); i++) { - Flatten(file->message_type(i), result); + ForEachMessage(file->message_type(i), [&](const Descriptor* descriptor) { + result->push_back(descriptor); + }); } } @@ -1154,7 +1143,7 @@ bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options, MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) { if (analysis_cache_.count(scc)) return analysis_cache_[scc]; - MessageAnalysis result{}; + MessageAnalysis result; if (UsingImplicitWeakFields(scc->GetFile(), options_)) { result.contains_weak = true; } @@ -1481,6 +1470,10 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file, return FileOptions::SPEED; } +bool EnableMessageOwnedArena(const Descriptor* /* desc */) { + return false; +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.h index 1cc9329c86..8923903452 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -315,6 +315,8 @@ inline bool IsWeak(const FieldDescriptor* field, const Options& options) { return false; } +bool IsStringInlined(const FieldDescriptor* descriptor, const Options& options); + // For a string field, returns the effective ctype. If the actual ctype is // not supported, returns the default of STRING. FieldOptions::CType EffectiveStringCType(const FieldDescriptor* field, @@ -325,6 +327,11 @@ inline bool IsCord(const FieldDescriptor* field, const Options& options) { EffectiveStringCType(field, options) == FieldOptions::CORD; } +inline bool IsString(const FieldDescriptor* field, const Options& options) { + return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && + EffectiveStringCType(field, options) == FieldOptions::STRING; +} + inline bool IsStringPiece(const FieldDescriptor* field, const Options& options) { return field->cpp_type() == FieldDescriptor::CPPTYPE_STRING && @@ -533,6 +540,19 @@ inline std::vector<const Descriptor*> FlattenMessagesInFile( return result; } +template <typename F> +void ForEachMessage(const Descriptor* descriptor, F&& func) { + for (int i = 0; i < descriptor->nested_type_count(); i++) + ForEachMessage(descriptor->nested_type(i), std::forward<F&&>(func)); + func(descriptor); +} + +template <typename F> +void ForEachMessage(const FileDescriptor* descriptor, F&& func) { + for (int i = 0; i < descriptor->message_type_count(); i++) + ForEachMessage(descriptor->message_type(i), std::forward<F&&>(func)); +} + bool HasWeakFields(const Descriptor* desc, const Options& options); bool HasWeakFields(const FileDescriptor* desc, const Options& options); @@ -545,11 +565,11 @@ inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field, } struct MessageAnalysis { - bool is_recursive; - bool contains_cord; - bool contains_extension; - bool contains_required; - bool contains_weak; // Implicit weak as well. + bool is_recursive = false; + bool contains_cord = false; + bool contains_extension = false; + bool contains_required = false; + bool contains_weak = false; // Implicit weak as well. }; // This class is used in FileGenerator, to ensure linear instead of @@ -630,6 +650,36 @@ bool UsingImplicitWeakFields(const FileDescriptor* file, bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options, MessageSCCAnalyzer* scc_analyzer); +inline bool HasSimpleBaseClass(const Descriptor* desc, const Options& options) { + if (!HasDescriptorMethods(desc->file(), options)) return false; + if (desc->extension_range_count() != 0) return false; + if (desc->field_count() == 0) return true; + // TODO(jorg): Support additional common message types with only one + // or two fields + return false; +} + +inline bool HasSimpleBaseClasses(const FileDescriptor* file, + const Options& options) { + bool v = false; + ForEachMessage(file, [&v, &options](const Descriptor* desc) { + v |= HasSimpleBaseClass(desc, options); + }); + return v; +} + +inline TProtoStringType SimpleBaseClass(const Descriptor* desc, + const Options& options) { + if (!HasDescriptorMethods(desc->file(), options)) return ""; + if (desc->extension_range_count() != 0) return ""; + if (desc->field_count() == 0) { + return "ZeroFieldsBase"; + } + // TODO(jorg): Support additional common message types with only one + // or two fields + return ""; +} + // Formatter is a functor class which acts as a closure around printer and // the variable map. It's much like printer->Print except it supports both named // variables that are substituted using a key value map and direct arguments. In @@ -884,8 +934,12 @@ inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; } PROTOC_EXPORT TProtoStringType StripProto(const TProtoStringType& filename); -inline bool EnableMessageOwnedArena(const Descriptor* /* desc */ ) { return false; } +bool EnableMessageOwnedArena(const Descriptor* desc); +bool ShouldVerify(const Descriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer); +bool ShouldVerify(const FileDescriptor* file, const Options& options, + MessageSCCAnalyzer* scc_analyzer); } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc index cb890d5156..7d1535f3b9 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -43,6 +43,7 @@ #include <utility> #include <vector> +#include <google/protobuf/stubs/common.h> #include <google/protobuf/compiler/cpp/cpp_enum.h> #include <google/protobuf/compiler/cpp/cpp_extension.h> #include <google/protobuf/compiler/cpp/cpp_field.h> @@ -52,6 +53,7 @@ #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/printer.h> +#include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/map_entry_lite.h> @@ -181,6 +183,10 @@ bool CanBeManipulatedAsRawBytes(const FieldDescriptor* field, return ret; } +bool StrContains(const TProtoStringType& haystack, const TProtoStringType& needle) { + return haystack.find(needle) != TProtoStringType::npos; +} + // Finds runs of fields for which `predicate` is true. // RunMap maps from fields that start each run to the number of fields in that // run. This is optimized for the common case that there are very few runs in @@ -295,15 +301,6 @@ bool ShouldMarkClassAsFinal(const Descriptor* descriptor, return false; } -bool ShouldMarkClearAsFinal(const Descriptor* descriptor, - const Options& options) { - static std::set<TProtoStringType> exclusions{ - }; - - const TProtoStringType name = ClassName(descriptor, true); - return exclusions.find(name) == exclusions.end() || - options.opensource_runtime; -} // Returns true to make the message serialize in order, decided by the following // factors in the order of precedence. @@ -397,6 +394,16 @@ bool IsRequired(const std::vector<const FieldDescriptor*>& v) { return v.front()->is_required(); } +bool HasSingularString(const Descriptor* desc, const Options& options) { + for (const auto* field : FieldRange(desc)) { + if (IsString(field, options) && !IsStringInlined(field, options) && + !field->is_repeated() && !field->real_containing_oneof()) { + return true; + } + } + return false; +} + // Collects neighboring fields based on a given criteria (equivalent predicate). template <typename Predicate> std::vector<std::vector<const FieldDescriptor*>> CollectFields( @@ -553,6 +560,88 @@ bool ColdChunkSkipper::OnEndChunk(int chunk, io::Printer* printer) { return true; } +void MaySetAnnotationVariable(const Options& options, + StringPiece annotation_name, + StringPiece injector_template_prefix, + StringPiece injector_template_suffix, + std::map<TProtoStringType, TProtoStringType>* variables) { + if (options.field_listener_options.forbidden_field_listener_events.count( + TProtoStringType(annotation_name))) + return; + (*variables)[StrCat("annotate_", annotation_name)] = strings::Substitute( + StrCat(injector_template_prefix, injector_template_suffix), + (*variables)["classtype"]); +} + +void GenerateExtensionAnnotations( + const Descriptor* descriptor, const Options& options, + std::map<TProtoStringType, TProtoStringType>* variables) { + const std::map<TProtoStringType, TProtoStringType> accessor_annotations_to_hooks = { + {"annotate_extension_has", "OnHasExtension"}, + {"annotate_extension_clear", "OnClearExtension"}, + {"annotate_extension_repeated_size", "OnExtensionSize"}, + {"annotate_extension_get", "OnGetExtension"}, + {"annotate_extension_mutable", "OnMutableExtension"}, + {"annotate_extension_set", "OnSetExtension"}, + {"annotate_extension_release", "OnReleaseExtension"}, + {"annotate_repeated_extension_get", "OnGetExtension"}, + {"annotate_repeated_extension_mutable", "OnMutableExtension"}, + {"annotate_repeated_extension_set", "OnSetExtension"}, + {"annotate_repeated_extension_add", "OnAddExtension"}, + {"annotate_repeated_extension_add_mutable", "OnAddMutableExtension"}, + {"annotate_repeated_extension_list", "OnListExtension"}, + {"annotate_repeated_extension_list_mutable", "OnMutableListExtension"}, + }; + for (const auto& annotation : accessor_annotations_to_hooks) { + (*variables)[annotation.first] = ""; + } + if (!options.field_listener_options.inject_field_listener_events || + descriptor->file()->options().optimize_for() == + google::protobuf::FileOptions::LITE_RUNTIME) { + return; + } + for (const auto& annotation : accessor_annotations_to_hooks) { + const TProtoStringType& annotation_name = annotation.first; + const TProtoStringType& listener_call = annotation.second; + if (!StrContains(annotation_name, "repeated") && + !StrContains(annotation_name, "size") && + !StrContains(annotation_name, "clear")) { + // Primitive fields accessors. + // "Has" is here as users calling "has" on a repeated field is a mistake. + (*variables)[annotation_name] = StrCat( + " _tracker_.", listener_call, + "(this, id.number(), _proto_TypeTraits::GetPtr(id.number(), " + "_extensions_, id.default_value_ref()));"); + } else if (StrContains(annotation_name, "repeated") && + !StrContains(annotation_name, "list") && + !StrContains(annotation_name, "size")) { + // Repeated index accessors. + TProtoStringType str_index = "index"; + if (StrContains(annotation_name, "add")) { + str_index = "_extensions_.ExtensionSize(id.number()) - 1"; + } + (*variables)[annotation_name] = + StrCat(" _tracker_.", listener_call, + "(this, id.number(), " + "_proto_TypeTraits::GetPtr(id.number(), _extensions_, ", + str_index, "));"); + } else if (StrContains(annotation_name, "list") || + StrContains(annotation_name, "size")) { + // Repeated full accessors. + (*variables)[annotation_name] = StrCat( + " _tracker_.", listener_call, + "(this, id.number(), _proto_TypeTraits::GetRepeatedPtr(id.number(), " + "_extensions_));"); + } else { + // Generic accessors such as "clear". + // TODO(b/190614678): Generalize clear from both repeated and non repeated + // calls, currently their underlying memory interfaces are very different. + // Or think of removing clear callback as no usages are needed and no + // memory exist after calling clear(). + } + } +} + } // anonymous namespace // =================================================================== @@ -567,6 +656,7 @@ MessageGenerator::MessageGenerator( options_(options), field_generators_(descriptor, options, scc_analyzer), max_has_bit_index_(0), + max_inlined_string_index_(0), num_weak_fields_(0), scc_analyzer_(scc_analyzer), variables_(vars) { @@ -583,36 +673,31 @@ MessageGenerator::MessageGenerator( variables_["annotate_deserialize"] = ""; variables_["annotate_reflection"] = ""; variables_["annotate_bytesize"] = ""; + variables_["annotate_mergefrom"] = ""; - if (options.inject_field_listener_events && + if (options.field_listener_options.inject_field_listener_events && descriptor->file()->options().optimize_for() != google::protobuf::FileOptions::LITE_RUNTIME) { - const TProtoStringType injector_template = StrCat( - " {\n" - " auto _listener_ = ::", - variables_["proto_ns"], - "::FieldAccessListener::GetListener();\n" - " if (_listener_) "); - - StrAppend(&variables_["annotate_serialize"], injector_template, - "_listener_->OnSerializationAccess(this);\n" - " }\n"); - StrAppend(&variables_["annotate_deserialize"], injector_template, - " _listener_->OnDeserializationAccess(this);\n" - " }\n"); + const TProtoStringType injector_template = " _tracker_."; + + MaySetAnnotationVariable(options, "serialize", injector_template, + "OnSerialize(this);\n", &variables_); + MaySetAnnotationVariable(options, "deserialize", injector_template, + "OnDeserialize(this);\n", &variables_); // TODO(danilak): Ideally annotate_reflection should not exist and we need // to annotate all reflective calls on our own, however, as this is a cause // for side effects, i.e. reading values dynamically, we want the users know // that dynamic access can happen. - StrAppend(&variables_["annotate_reflection"], injector_template, - "_listener_->OnReflectionAccess(default_instance()" - ".GetMetadata().descriptor);\n" - " }\n"); - StrAppend(&variables_["annotate_bytesize"], injector_template, - "_listener_->OnByteSizeAccess(this);\n" - " }\n"); + MaySetAnnotationVariable(options, "reflection", injector_template, + "OnGetMetadata();\n", &variables_); + MaySetAnnotationVariable(options, "bytesize", injector_template, + "OnByteSize(this);\n", &variables_); + MaySetAnnotationVariable(options, "mergefrom", injector_template, + "OnMergeFrom(this, &from);\n", &variables_); } + GenerateExtensionAnnotations(descriptor_, options_, &variables_); + SetUnknownFieldsVariable(descriptor_, options_, &variables_); // Compute optimized field order to be used for layout and initialization @@ -640,12 +725,22 @@ MessageGenerator::MessageGenerator( } has_bit_indices_[field->index()] = max_has_bit_index_++; } + if (IsStringInlined(field, options_)) { + if (inlined_string_indices_.empty()) { + inlined_string_indices_.resize(descriptor_->field_count(), kNoHasbit); + } + inlined_string_indices_[field->index()] = max_inlined_string_index_++; + } } if (!has_bit_indices_.empty()) { field_generators_.SetHasBitIndices(has_bit_indices_); } + if (!inlined_string_indices_.empty()) { + field_generators_.SetInlinedStringIndices(inlined_string_indices_); + } + num_required_fields_ = 0; for (int i = 0; i < descriptor->field_count(); i++) { if (descriptor->field(i)->is_required()) { @@ -656,8 +751,8 @@ MessageGenerator::MessageGenerator( table_driven_ = TableDrivenParsingEnabled(descriptor_, options_, scc_analyzer_); parse_function_generator_.reset(new ParseFunctionGenerator( - descriptor_, max_has_bit_index_, has_bit_indices_, options_, - scc_analyzer_, variables_)); + descriptor_, max_has_bit_index_, has_bit_indices_, + inlined_string_indices_, options_, scc_analyzer_, variables_)); } MessageGenerator::~MessageGenerator() = default; @@ -666,6 +761,10 @@ size_t MessageGenerator::HasBitsSize() const { return (max_has_bit_index_ + 31) / 32; } +size_t MessageGenerator::InlinedStringDonatedSize() const { + return (max_inlined_string_index_ + 31) / 32; +} + int MessageGenerator::HasBitIndex(const FieldDescriptor* field) const { return has_bit_indices_.empty() ? kNoHasbit : has_bit_indices_[field->index()]; @@ -690,8 +789,8 @@ void MessageGenerator::AddGenerators( enum_generators_.push_back(enum_generators->back().get()); } for (int i = 0; i < descriptor_->extension_count(); i++) { - extension_generators->emplace_back( - new ExtensionGenerator(descriptor_->extension(i), options_)); + extension_generators->emplace_back(new ExtensionGenerator( + descriptor_->extension(i), options_, scc_analyzer_)); extension_generators_.push_back(extension_generators->back().get()); } } @@ -777,9 +876,206 @@ void MessageGenerator::GenerateFieldAccessorDeclarations(io::Printer* printer) { } if (descriptor_->extension_range_count() > 0) { - // Generate accessors for extensions. We just call a macro located in - // extension_set.h since the accessors about 80 lines of static code. - format("$GOOGLE_PROTOBUF$_EXTENSION_ACCESSORS($classname$)\n"); + // Generate accessors for extensions. + // We use "_proto_TypeTraits" as a type name below because "TypeTraits" + // causes problems if the class has a nested message or enum type with that + // name and "_TypeTraits" is technically reserved for the C++ library since + // it starts with an underscore followed by a capital letter. + // + // For similar reason, we use "_field_type" and "_is_packed" as parameter + // names below, so that "field_type" and "is_packed" can be used as field + // names. + format(R"( +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline bool HasExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_extension_has$ + return _extensions_.Has(id.number()); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline void ClearExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { + _extensions_.ClearExtension(id.number()); +$annotate_extension_clear$ +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline int ExtensionSize( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_extension_repeated_size$ + return _extensions_.ExtensionSize(id.number()); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Singular::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_extension_get$ + return _proto_TypeTraits::Get(id.number(), _extensions_, + id.default_value()); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_extension_mutable$ + return _proto_TypeTraits::Mutable(id.number(), _field_type, + &_extensions_); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::ConstType value) { + _proto_TypeTraits::Set(id.number(), _field_type, value, &_extensions_); +$annotate_extension_set$ +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline void SetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, + &_extensions_); +$annotate_extension_set$ +} +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline void UnsafeArenaSetAllocatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Singular::MutableType value) { + _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, + value, &_extensions_); +$annotate_extension_set$ +} +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline PROTOBUF_MUST_USE_RESULT + typename _proto_TypeTraits::Singular::MutableType + ReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_extension_release$ + return _proto_TypeTraits::Release(id.number(), _field_type, + &_extensions_); +} +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Singular::MutableType +UnsafeArenaReleaseExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_extension_release$ + return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, + &_extensions_); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Repeated::ConstType GetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) const { +$annotate_repeated_extension_get$ + return _proto_TypeTraits::Get(id.number(), _extensions_, index); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + int index) { +$annotate_repeated_extension_mutable$ + return _proto_TypeTraits::Mutable(id.number(), index, &_extensions_); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline void SetExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + int index, typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Set(id.number(), index, value, &_extensions_); +$annotate_repeated_extension_set$ +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { + typename _proto_TypeTraits::Repeated::MutableType to_add = + _proto_TypeTraits::Add(id.number(), _field_type, &_extensions_); +$annotate_repeated_extension_add_mutable$ + return to_add; +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline void AddExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id, + typename _proto_TypeTraits::Repeated::ConstType value) { + _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, + &_extensions_); +$annotate_repeated_extension_add$ +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline const typename _proto_TypeTraits::Repeated::RepeatedFieldType& +GetRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) const { +$annotate_repeated_extension_list$ + return _proto_TypeTraits::GetRepeated(id.number(), _extensions_); +} + +template <typename _proto_TypeTraits, + ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, + bool _is_packed> +inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* +MutableRepeatedExtension( + const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< + $classname$, _proto_TypeTraits, _field_type, _is_packed>& id) { +$annotate_repeated_extension_list_mutable$ + return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, + _is_packed, &_extensions_); +} + +)"); // Generate MessageSet specific APIs for proto2 MessageSet. // For testing purposes we don't check for bridge.MessageSet, so // we don't use IsProto2MessageSet @@ -1145,8 +1441,10 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { } else { format("inline $classname$() : $classname$(nullptr) {}\n"); } + if (!HasSimpleBaseClass(descriptor_, options_)) { + format("~$classname$() override;\n"); + } format( - "~$classname$() override;\n" "explicit constexpr " "$classname$(::$proto_ns$::internal::ConstantInitialized);\n" "\n" @@ -1162,7 +1460,11 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "}\n" "inline $classname$& operator=($classname$&& from) noexcept {\n" " if (this == &from) return *this;\n" - " if (GetOwningArena() == from.GetOwningArena()) {\n" + " if (GetOwningArena() == from.GetOwningArena()\n" + "#ifdef PROTOBUF_FORCE_COPY_IN_MOVE\n" + " && GetOwningArena() != nullptr\n" + "#endif // !PROTOBUF_FORCE_COPY_IN_MOVE\n" + " ) {\n" " InternalSwap(&from);\n" " } else {\n" " CopyFrom(from);\n" @@ -1174,7 +1476,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { if (options_.table_driven_serialization) { format( "private:\n" - "const void* InternalGetTable() const;\n" + "const void* InternalGetTable() const override;\n" "public:\n" "\n"); } @@ -1213,7 +1515,6 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { " return default_instance().GetMetadata().descriptor;\n" "}\n" "static const ::$proto_ns$::Reflection* GetReflection() {\n" - "$annotate_reflection$" " return default_instance().GetMetadata().reflection;\n" "}\n"); } @@ -1362,22 +1663,36 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { if (HasGeneratedMethods(descriptor_->file(), options_)) { if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - // Use Message's built-in MergeFrom and CopyFrom when the passed-in - // argument is a generic Message instance, and only define the custom - // MergeFrom and CopyFrom instances when the source of the merge/copy - // is known to be the same class as the destination. - // TODO(jorg): Define MergeFrom in terms of MergeImpl, rather than the - // other way around, to save even more code size. - "using $superclass$::CopyFrom;\n" - "void CopyFrom(const $classname$& from);\n" - "" - "using $superclass$::MergeFrom;\n" - "void MergeFrom(const $classname$& from);\n" - "private:\n" - "static void MergeImpl(::$proto_ns$::Message*to, const " - "::$proto_ns$::Message&from);\n" - "public:\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + // Use Message's built-in MergeFrom and CopyFrom when the passed-in + // argument is a generic Message instance, and only define the + // custom MergeFrom and CopyFrom instances when the source of the + // merge/copy is known to be the same class as the destination. + // TODO(jorg): Define MergeFrom in terms of MergeImpl, rather than + // the other way around, to save even more code size. + "using $superclass$::CopyFrom;\n" + "void CopyFrom(const $classname$& from);\n" + "" + "using $superclass$::MergeFrom;\n" + "void MergeFrom(const $classname$& from);\n" + "private:\n" + "static void MergeImpl(::$proto_ns$::Message* to, const " + "::$proto_ns$::Message& from);\n" + "public:\n"); + } else { + format( + "using $superclass$::CopyFrom;\n" + "inline void CopyFrom(const $classname$& from) {\n" + " $superclass$::CopyImpl(this, from);\n" + "}\n" + "" + "using $superclass$::MergeFrom;\n" + "void MergeFrom(const $classname$& from) {\n" + " $superclass$::MergeImpl(this, from);\n" + "}\n" + "public:\n"); + } } else { format( "void CheckTypeAndMergeFrom(const ::$proto_ns$::MessageLite& from)" @@ -1386,36 +1701,42 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "void MergeFrom(const $classname$& from);\n"); } - format.Set("clear_final", - ShouldMarkClearAsFinal(descriptor_, options_) ? "final" : ""); - - format( - "PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear()$ clear_final$;\n" - "bool IsInitialized() const final;\n" - "\n" - "size_t ByteSizeLong() const final;\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;\n" + "bool IsInitialized() const final;\n" + "\n" + "size_t ByteSizeLong() const final;\n"); - parse_function_generator_->GenerateMethodDecls(printer); + parse_function_generator_->GenerateMethodDecls(printer); - format( - "$uint8$* _InternalSerialize(\n" - " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " - "const final;\n"); - - // DiscardUnknownFields() is implemented in message.cc using reflections. We - // need to implement this function in generated code for messages. - if (!UseUnknownFieldSet(descriptor_->file(), options_)) { - format("void DiscardUnknownFields()$ full_final$;\n"); + format( + "$uint8$* _InternalSerialize(\n" + " $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) " + "const final;\n"); + + // DiscardUnknownFields() is implemented in message.cc using reflections. + // We need to implement this function in generated code for messages. + if (!UseUnknownFieldSet(descriptor_->file(), options_)) { + format("void DiscardUnknownFields()$ full_final$;\n"); + } } } - format( - "int GetCachedSize() const final { return _cached_size_.Get(); }" - "\n\nprivate:\n" - "void SharedCtor();\n" - "void SharedDtor();\n" - "void SetCachedSize(int size) const$ full_final$;\n" - "void InternalSwap($classname$* other);\n"); + if (options_.field_listener_options.inject_field_listener_events) { + format("static constexpr int _kInternalFieldNumber = $1$;\n", + descriptor_->field_count()); + } + + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "int GetCachedSize() const final { return _cached_size_.Get(); }" + "\n\nprivate:\n" + "void SharedCtor();\n" + "void SharedDtor();\n" + "void SetCachedSize(int size) const$ full_final$;\n" + "void InternalSwap($classname$* other);\n"); + } format( // Friend AnyMetadata so that it can call this FullMessageName() method. @@ -1433,9 +1754,13 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "protected:\n" "explicit $classname$(::$proto_ns$::Arena* arena,\n" " bool is_message_owned = false);\n" - "private:\n" - "static void ArenaDtor(void* object);\n" - "inline void RegisterArenaDtor(::$proto_ns$::Arena* arena);\n"); + "private:\n"); + + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "static void ArenaDtor(void* object);\n" + "inline void RegisterArenaDtor(::$proto_ns$::Arena* arena);\n"); + } format( "public:\n" @@ -1562,6 +1887,21 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "\n"); } + if (options_.field_listener_options.inject_field_listener_events && + descriptor_->file()->options().optimize_for() != + google::protobuf::FileOptions::LITE_RUNTIME) { + format("static ::$proto_ns$::AccessListener<$1$> _tracker_;\n", + ClassName(descriptor_)); + } + + // Generate _inlined_string_donated_ for inlined string type. + // TODO(congliu): To avoid affecting the locality of `_has_bits_`, should this + // be below or above `_has_bits_`? + if (!inlined_string_indices_.empty()) { + format("::$proto_ns$::internal::HasBits<$1$> _inlined_string_donated_;\n", + InlinedStringDonatedSize()); + } + format( "template <typename T> friend class " "::$proto_ns$::Arena::InternalHelper;\n" @@ -1731,8 +2071,17 @@ void MessageGenerator::GenerateSchema(io::Printer* printer, int offset, has_offset = !has_bit_indices_.empty() || IsMapEntryMessage(descriptor_) ? offset + has_offset : -1; + int inlined_string_indices_offset; + if (inlined_string_indices_.empty()) { + inlined_string_indices_offset = -1; + } else { + GOOGLE_DCHECK_NE(has_offset, -1); + GOOGLE_DCHECK(!IsMapEntryMessage(descriptor_)); + inlined_string_indices_offset = has_offset + has_bit_indices_.size(); + } - format("{ $1$, $2$, sizeof($classtype$)},\n", offset, has_offset); + format("{ $1$, $2$, $3$, sizeof($classtype$)},\n", offset, has_offset, + inlined_string_indices_offset); } namespace { @@ -1746,7 +2095,9 @@ uint32_t CalcFieldNum(const FieldGenerator& generator, if (type == FieldDescriptor::TYPE_STRING || type == FieldDescriptor::TYPE_BYTES) { // string field - if (IsCord(field, options)) { + if (generator.IsInlined()) { + type = internal::FieldMetadata::kInlinedType; + } else if (IsCord(field, options)) { type = internal::FieldMetadata::kCordType; } else if (IsStringPiece(field, options)) { type = internal::FieldMetadata::kStringPieceType; @@ -1956,13 +2307,24 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { " MergeFromInternal(other);\n" "}\n"); if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" - " return ::$proto_ns$::internal::AssignDescriptors(\n" - " &$desc_table$_getter, &$desc_table$_once,\n" - " $file_level_metadata$[$1$]);\n" - "}\n", - index_in_file_messages_); + if (!descriptor_->options().map_entry()) { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + "$annotate_reflection$" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } else { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } } return; } @@ -2059,10 +2421,12 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { GenerateClear(printer); format("\n"); - parse_function_generator_->GenerateMethodImpls(printer); - format("\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + parse_function_generator_->GenerateMethodImpls(printer); + format("\n"); - parse_function_generator_->GenerateDataDefinitions(printer); + parse_function_generator_->GenerateDataDefinitions(printer); + } GenerateSerializeWithCachedSizesToArray(printer); format("\n"); @@ -2083,6 +2447,8 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { format("\n"); } + GenerateVerify(printer); + GenerateSwap(printer); format("\n"); @@ -2095,13 +2461,24 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { index_in_file_messages_); } if (HasDescriptorMethods(descriptor_->file(), options_)) { - format( - "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" - " return ::$proto_ns$::internal::AssignDescriptors(\n" - " &$desc_table$_getter, &$desc_table$_once,\n" - " $file_level_metadata$[$1$]);\n" - "}\n", - index_in_file_messages_); + if (!descriptor_->options().map_entry()) { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + "$annotate_reflection$" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } else { + format( + "::$proto_ns$::Metadata $classname$::GetMetadata() const {\n" + " return ::$proto_ns$::internal::AssignDescriptors(\n" + " &$desc_table$_getter, &$desc_table$_once,\n" + " $file_level_metadata$[$1$]);\n" + "}\n", + index_in_file_messages_); + } } else { format( "TProtoStringType $classname$::GetTypeName() const {\n" @@ -2110,6 +2487,14 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) { "\n"); } + if (options_.field_listener_options.inject_field_listener_events && + descriptor_->file()->options().optimize_for() != + google::protobuf::FileOptions::LITE_RUNTIME) { + format( + "::$proto_ns$::AccessListener<$classtype$> " + "$1$::_tracker_(&FullMessageName);\n", + ClassName(descriptor_)); + } } size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { @@ -2148,9 +2533,13 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { } processing_type = static_cast<unsigned>(field->type()); + const FieldGenerator& generator = field_generators_.get(field); if (field->type() == FieldDescriptor::TYPE_STRING) { switch (EffectiveStringCType(field, options_)) { case FieldOptions::STRING: + if (generator.IsInlined()) { + processing_type = internal::TYPE_STRING_INLINED; + } break; case FieldOptions::CORD: processing_type = internal::TYPE_STRING_CORD; @@ -2162,6 +2551,9 @@ size_t MessageGenerator::GenerateParseOffsets(io::Printer* printer) { } else if (field->type() == FieldDescriptor::TYPE_BYTES) { switch (EffectiveStringCType(field, options_)) { case FieldOptions::STRING: + if (generator.IsInlined()) { + processing_type = internal::TYPE_BYTES_INLINED; + } break; case FieldOptions::CORD: processing_type = internal::TYPE_BYTES_CORD; @@ -2326,7 +2718,12 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets( } else { format("~0u, // no _weak_field_map_\n"); } - const int kNumGenericOffsets = 5; // the number of fixed offsets above + if (!inlined_string_indices_.empty()) { + format("PROTOBUF_FIELD_OFFSET($classtype$, _inlined_string_donated_),\n"); + } else { + format("~0u, // no _inlined_string_donated_\n"); + } + const int kNumGenericOffsets = 6; // the number of fixed offsets above const size_t offsets = kNumGenericOffsets + descriptor_->field_count() + descriptor_->real_oneof_decl_count(); size_t entries = offsets; @@ -2345,10 +2742,18 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets( format("PROTOBUF_FIELD_OFFSET($classtype$, $1$_)", FieldName(field)); } + // Some information about a field is in the pdproto profile. The profile is + // only available at compile time. So we embed such information in the + // offset of the field, so that the information is available when reflective + // accessing the field at run time. + // + // Embed whether the field is used to the MSB of the offset. if (!IsFieldUsed(field, options_)) { format(" | 0x80000000u, // unused\n"); } else if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) { format(" | 0x1u, // eagerly verified lazy\n"); + } else if (IsStringInlined(field, options_)) { + format(" | 0x1u, // inlined\n"); } else { format(",\n"); } @@ -2374,11 +2779,21 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets( format("$1$,\n", index); } } + if (!inlined_string_indices_.empty()) { + entries += inlined_string_indices_.size(); + for (int inlined_string_indice : inlined_string_indices_) { + const TProtoStringType index = inlined_string_indice >= 0 + ? StrCat(inlined_string_indice) + : "~0u"; + format("$1$,\n", index); + } + } return std::make_pair(entries, offsets); } void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); format("void $classname$::SharedCtor() {\n"); @@ -2394,6 +2809,7 @@ void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { } void MessageGenerator::GenerateSharedDestructorCode(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); format("inline void $classname$::SharedDtor() {\n"); @@ -2424,6 +2840,7 @@ void MessageGenerator::GenerateSharedDestructorCode(io::Printer* printer) { } void MessageGenerator::GenerateArenaDestructorCode(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); // Generate the ArenaDtor() method. Track whether any fields actually produced @@ -2593,7 +3010,8 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { bool has_arena_constructor = field->is_repeated(); if (!field->real_containing_oneof() && (IsLazy(field, options_, scc_analyzer_) || - IsStringPiece(field, options_))) { + IsStringPiece(field, options_) || + (IsString(field, options_) && IsStringInlined(field, options_)))) { has_arena_constructor = true; } if (has_arena_constructor) { @@ -2620,15 +3038,29 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { format( "$classname$::$classname$(::$proto_ns$::Arena* arena,\n" " bool is_message_owned)\n" - " : $1$ {\n" - " SharedCtor();\n" - " if (!is_message_owned) {\n" - " RegisterArenaDtor(arena);\n" - " }\n" - " // @@protoc_insertion_point(arena_constructor:$full_name$)\n" - "}\n", + " : $1$ {\n", initializer_with_arena); + if (!inlined_string_indices_.empty()) { + // Donate inline string fields. + format(" if (arena != nullptr) {\n"); + for (size_t i = 0; i < InlinedStringDonatedSize(); ++i) { + format(" _inlined_string_donated_[$1$] = ~0u;\n", i); + } + format(" }\n"); + } + + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + " SharedCtor();\n" + " if (!is_message_owned) {\n" + " RegisterArenaDtor(arena);\n" + " }\n"); + } + format( + " // @@protoc_insertion_point(arena_constructor:$full_name$)\n" + "}\n"); + std::map<TProtoStringType, TProtoStringType> vars; SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); @@ -2652,6 +3084,9 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { format.Indent(); format.Indent(); + // Do not copy inlined_string_donated_, because this is not an arena + // constructor. + if (!has_bit_indices_.empty()) { format(",\n_has_bits_(from._has_bits_)"); } @@ -2726,14 +3161,22 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { GenerateSharedConstructorCode(printer); // Generate the destructor. - format( - "$classname$::~$classname$() {\n" - " // @@protoc_insertion_point(destructor:$full_name$)\n" - " if (GetArenaForAllocation() != nullptr) return;\n" - " SharedDtor();\n" - " _internal_metadata_.Delete<$unknown_fields_type$>();\n" - "}\n" - "\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + format( + "$classname$::~$classname$() {\n" + " // @@protoc_insertion_point(destructor:$full_name$)\n" + " if (GetArenaForAllocation() != nullptr) return;\n" + " SharedDtor();\n" + " _internal_metadata_.Delete<$unknown_fields_type$>();\n" + "}\n" + "\n"); + } else { + // For messages using simple base classes, having no destructor + // allows our vtable to share the same destructor as every other + // message with a simple base class. This works only as long as + // we have no fields needing destruction, of course. (No strings + // or extensions) + } // Generate the shared destructor code. GenerateSharedDestructorCode(printer); @@ -2741,11 +3184,13 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { // Generate the arena-specific destructor code. GenerateArenaDestructorCode(printer); - // Generate SetCachedSize. - format( - "void $classname$::SetCachedSize(int size) const {\n" - " _cached_size_.Set(size);\n" - "}\n"); + if (!HasSimpleBaseClass(descriptor_, options_)) { + // Generate SetCachedSize. + format( + "void $classname$::SetCachedSize(int size) const {\n" + " _cached_size_.Set(size);\n" + "}\n"); + } } void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* printer) { @@ -2759,6 +3204,7 @@ void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* printer) { } void MessageGenerator::GenerateClear(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); // The maximum number of bytes we will memset to zero without checking their @@ -2916,6 +3362,8 @@ void MessageGenerator::GenerateClear(io::Printer* printer) { format("_weak_field_map_.ClearAll();\n"); } + // We don't clear donated status. + if (!has_bit_indices_.empty()) { // Step 5: Everything else. format("_has_bits_.Clear();\n"); @@ -2975,6 +3423,7 @@ void MessageGenerator::GenerateOneofClear(io::Printer* printer) { } void MessageGenerator::GenerateSwap(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); format("void $classname$::InternalSwap($classname$* other) {\n"); @@ -2989,6 +3438,11 @@ void MessageGenerator::GenerateSwap(io::Printer* printer) { std::map<TProtoStringType, TProtoStringType> vars; SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); + if (HasSingularString(descriptor_, options_)) { + format( + "auto* lhs_arena = GetArenaForAllocation();\n" + "auto* rhs_arena = other->GetArenaForAllocation();\n"); + } format("_internal_metadata_.InternalSwap(&other->_internal_metadata_);\n"); if (!has_bit_indices_.empty()) { @@ -3056,47 +3510,64 @@ void MessageGenerator::GenerateSwap(io::Printer* printer) { void MessageGenerator::GenerateMergeFrom(io::Printer* printer) { Formatter format(printer, variables_); - if (HasDescriptorMethods(descriptor_->file(), options_)) { - // We don't override the generalized MergeFrom (aka that which - // takes in the Message base class as a parameter); instead we just - // let the base Message::MergeFrom take care of it. The base MergeFrom - // knows how to quickly confirm the types exactly match, and if so, will - // use GetClassData() to retrieve the address of MergeImpl, which calls - // the fast MergeFrom overload. Most callers avoid all this by passing - // a "from" message that is the same type as the message being merged - // into, rather than a generic Message. + if (!HasSimpleBaseClass(descriptor_, options_)) { + if (HasDescriptorMethods(descriptor_->file(), options_)) { + // We don't override the generalized MergeFrom (aka that which + // takes in the Message base class as a parameter); instead we just + // let the base Message::MergeFrom take care of it. The base MergeFrom + // knows how to quickly confirm the types exactly match, and if so, will + // use GetClassData() to retrieve the address of MergeImpl, which calls + // the fast MergeFrom overload. Most callers avoid all this by passing + // a "from" message that is the same type as the message being merged + // into, rather than a generic Message. + format( + "const ::$proto_ns$::Message::ClassData " + "$classname$::_class_data_ = {\n" + " ::$proto_ns$::Message::CopyWithSizeCheck,\n" + " $classname$::MergeImpl\n" + "};\n" + "const ::$proto_ns$::Message::ClassData*" + "$classname$::GetClassData() const { return &_class_data_; }\n" + "\n" + "void $classname$::MergeImpl(::$proto_ns$::Message* to,\n" + " const ::$proto_ns$::Message& from) {\n" + " static_cast<$classname$ *>(to)->MergeFrom(\n" + " static_cast<const $classname$ &>(from));\n" + "}\n" + "\n"); + } else { + // Generate CheckTypeAndMergeFrom(). + format( + "void $classname$::CheckTypeAndMergeFrom(\n" + " const ::$proto_ns$::MessageLite& from) {\n" + " MergeFrom(*::$proto_ns$::internal::DownCast<const $classname$*>(\n" + " &from));\n" + "}\n"); + } + } else { + // In the simple case, we just define ClassData that vectors back to the + // simple implementation of Copy and Merge. format( "const ::$proto_ns$::Message::ClassData " "$classname$::_class_data_ = {\n" - " ::$proto_ns$::Message::CopyWithSizeCheck,\n" - " $classname$::MergeImpl\n" + " $superclass$::CopyImpl,\n" + " $superclass$::MergeImpl,\n" "};\n" "const ::$proto_ns$::Message::ClassData*" "$classname$::GetClassData() const { return &_class_data_; }\n" "\n" - "void $classname$::MergeImpl(::$proto_ns$::Message*to,\n" - " const ::$proto_ns$::Message&from) {\n" - " static_cast<$classname$ *>(to)->MergeFrom(\n" - " static_cast<const $classname$ &>(from));\n" - "}\n" "\n"); - } else { - // Generate CheckTypeAndMergeFrom(). - format( - "void $classname$::CheckTypeAndMergeFrom(\n" - " const ::$proto_ns$::MessageLite& from) {\n" - " MergeFrom(*::$proto_ns$::internal::DownCast<const $classname$*>(\n" - " &from));\n" - "}\n"); } } void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; // Generate the class-specific MergeFrom, which avoids the GOOGLE_CHECK and cast. Formatter format(printer, variables_); format( "void $classname$::MergeFrom(const $classname$& from) {\n" + "$annotate_mergefrom$" "// @@protoc_insertion_point(class_specific_merge_from_start:" "$full_name$)\n" " $DCHK$_NE(&from, this);\n"); @@ -3255,6 +3726,7 @@ void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) { } void MessageGenerator::GenerateCopyFrom(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); if (HasDescriptorMethods(descriptor_->file(), options_)) { // We don't override the generalized CopyFrom (aka that which @@ -3301,6 +3773,9 @@ void MessageGenerator::GenerateCopyFrom(io::Printer* printer) { format("}\n"); } +void MessageGenerator::GenerateVerify(io::Printer* printer) { +} + void MessageGenerator::GenerateSerializeOneofFields( io::Printer* printer, const std::vector<const FieldDescriptor*>& fields) { Formatter format(printer, variables_); @@ -3376,11 +3851,12 @@ void MessageGenerator::GenerateSerializeOneExtensionRange( format("// Extension range [$start$, $end$)\n"); format( "target = _extensions_._InternalSerialize(\n" - " $start$, $end$, target, stream);\n\n"); + "internal_default_instance(), $start$, $end$, target, stream);\n\n"); } void MessageGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); if (descriptor_->options().message_set_wire_format()) { // Special-case MessageSet. @@ -3390,7 +3866,8 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray( "const {\n" "$annotate_serialize$" " target = _extensions_." - "InternalSerializeMessageSetWithCachedSizesToArray(target, stream);\n"); + "InternalSerializeMessageSetWithCachedSizesToArray(\n" // + "internal_default_instance(), target, stream);\n"); std::map<TProtoStringType, TProtoStringType> vars; SetUnknownFieldsVariable(descriptor_, options_, &vars); format.AddMap(vars); @@ -3443,6 +3920,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray( void MessageGenerator::GenerateSerializeWithCachedSizesBody( io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); // If there are multiple fields in a row from the same oneof then we // coalesce them and emit a switch statement. This is more efficient @@ -3759,6 +4237,7 @@ std::vector<uint32_t> MessageGenerator::RequiredFieldsBitMask() const { } void MessageGenerator::GenerateByteSize(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); if (descriptor_->options().message_set_wire_format()) { @@ -3987,37 +4466,37 @@ void MessageGenerator::GenerateByteSize(io::Printer* printer) { format("total_size += _weak_field_map_.ByteSizeLong();\n"); } - format("if (PROTOBUF_PREDICT_FALSE($have_unknown_fields$)) {\n"); if (UseUnknownFieldSet(descriptor_->file(), options_)) { // We go out of our way to put the computation of the uncommon path of // unknown fields in tail position. This allows for better code generation // of this function for simple protos. format( - " return ::$proto_ns$::internal::ComputeUnknownFieldsSize(\n" - " _internal_metadata_, total_size, &_cached_size_);\n"); + "return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);\n"); } else { + format("if (PROTOBUF_PREDICT_FALSE($have_unknown_fields$)) {\n"); format(" total_size += $unknown_fields$.size();\n"); - } - format("}\n"); + format("}\n"); - // We update _cached_size_ even though this is a const method. Because - // const methods might be called concurrently this needs to be atomic - // operations or the program is undefined. In practice, since any concurrent - // writes will be writing the exact same value, normal writes will work on - // all common processors. We use a dedicated wrapper class to abstract away - // the underlying atomic. This makes it easier on platforms where even relaxed - // memory order might have perf impact to replace it with ordinary loads and - // stores. - format( - "int cached_size = ::$proto_ns$::internal::ToCachedSize(total_size);\n" - "SetCachedSize(cached_size);\n" - "return total_size;\n"); + // We update _cached_size_ even though this is a const method. Because + // const methods might be called concurrently this needs to be atomic + // operations or the program is undefined. In practice, since any + // concurrent writes will be writing the exact same value, normal writes + // will work on all common processors. We use a dedicated wrapper class to + // abstract away the underlying atomic. This makes it easier on platforms + // where even relaxed memory order might have perf impact to replace it with + // ordinary loads and stores. + format( + "int cached_size = ::$proto_ns$::internal::ToCachedSize(total_size);\n" + "SetCachedSize(cached_size);\n" + "return total_size;\n"); + } format.Outdent(); format("}\n"); } void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { + if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); format("bool $classname$::IsInitialized() const {\n"); format.Indent(); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.h index 904a98acfe..1e4e942d69 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.h @@ -134,6 +134,7 @@ class MessageGenerator { // Generate standard Message methods. void GenerateClear(io::Printer* printer); void GenerateOneofClear(io::Printer* printer); + void GenerateVerify(io::Printer* printer); void GenerateSerializeWithCachedSizes(io::Printer* printer); void GenerateSerializeWithCachedSizesToArray(io::Printer* printer); void GenerateSerializeWithCachedSizesBody(io::Printer* printer); @@ -177,6 +178,7 @@ class MessageGenerator { bool copy_constructor) const; size_t HasBitsSize() const; + size_t InlinedStringDonatedSize() const; int HasBitIndex(const FieldDescriptor* a) const; int HasByteIndex(const FieldDescriptor* a) const; int HasWordIndex(const FieldDescriptor* a) const; @@ -196,6 +198,13 @@ class MessageGenerator { std::vector<const FieldDescriptor*> optimized_order_; std::vector<int> has_bit_indices_; int max_has_bit_index_; + + // A map from field index to inlined_string index. For non-inlined-string + // fields, the element is -1. + std::vector<int> inlined_string_indices_; + // The count of inlined_string fields in the message. + int max_inlined_string_index_; + std::vector<const EnumGenerator*> enum_generators_; std::vector<const ExtensionGenerator*> extension_generators_; int num_required_fields_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.h index 4b4b8ea59b..712ddbfea1 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.h @@ -53,22 +53,25 @@ class MessageFieldGenerator : public FieldGenerator { ~MessageFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateInternalAccessorDeclarations(io::Printer* printer) const; - void GenerateInternalAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const override; + void GenerateInternalAccessorDeclarations( + io::Printer* printer) const override; + void GenerateInternalAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateDestructorCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; protected: const bool implicit_weak_field_; @@ -85,16 +88,17 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { ~MessageOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateNonInlineAccessorDefinitions( + io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; // MessageFieldGenerator, from which we inherit, overrides this so we need to // override it as well. - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateDestructorCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); @@ -108,17 +112,18 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { ~RepeatedMessageFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const {} - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override {} + void GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: const bool implicit_weak_field_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_options.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_options.h index ed5cd0b046..bc174c3d6e 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_options.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_options.h @@ -33,6 +33,7 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ +#include <set> #include <string> #include <google/protobuf/stubs/port.h> @@ -50,6 +51,11 @@ enum class EnforceOptimizeMode { kLiteRuntime, }; +struct FieldListenerOptions { + bool inject_field_listener_events = false; + std::set<TProtoStringType> forbidden_field_listener_events; +}; + // Generator options (see generator.cc for a description of each): struct Options { TProtoStringType dllexport_decl; @@ -65,6 +71,8 @@ struct Options { bool opensource_runtime = false; bool annotate_accessor = false; bool unused_field_stripping = false; + bool profile_driven_inline_string = false; + bool force_inline_string = false; TProtoStringType runtime_include_base; int num_cc_files = 0; TProtoStringType annotation_pragma_name; @@ -75,7 +83,7 @@ struct Options { kTCTableGuarded, kTCTableAlways } tctable_mode = kTCTableNever; - bool inject_field_listener_events = false; + FieldListenerOptions field_listener_options; bool eagerly_verified_lazy = false; bool force_eagerly_verified_lazy = false; }; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc index ea146f8992..93d44864c3 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc @@ -30,7 +30,9 @@ #include <google/protobuf/compiler/cpp/cpp_parse_function_generator.h> +#include <algorithm> #include <limits> +#include <string> #include <google/protobuf/compiler/cpp/cpp_helpers.h> #include <google/protobuf/wire_format.h> @@ -64,16 +66,6 @@ bool HasInternalAccessors(const FieldOptions::CType ctype) { return ctype == FieldOptions::STRING || ctype == FieldOptions::CORD; } -bool IsTcTableEnabled(const Options& options) { - return options.tctable_mode == Options::kTCTableAlways; -} -bool IsTcTableGuarded(const Options& options) { - return options.tctable_mode == Options::kTCTableGuarded; -} -bool IsTcTableDisabled(const Options& options) { - return options.tctable_mode == Options::kTCTableNever; -} - int TagSize(uint32_t field_number) { if (field_number < 16) return 1; GOOGLE_CHECK_LT(field_number, (1 << 14)) @@ -81,22 +73,38 @@ int TagSize(uint32_t field_number) { return 2; } +const char* CodedTagType(int tag_size) { + return tag_size == 1 ? "uint8_t" : "uint16_t"; +} + const char* TagType(const FieldDescriptor* field) { return CodedTagType(TagSize(field->number())); } -TProtoStringType MessageParseFunctionName(const FieldDescriptor* field, - const Options& options) { - TProtoStringType name = - "::" + ProtobufNamespace(options) + "::internal::TcParserBase::"; - if (field->is_repeated()) { - name.append("Repeated"); - } else { - name.append("Singular"); +TProtoStringType TcParserBaseName(const Options& options) { + return StrCat("::", ProtobufNamespace(options), + "::internal::TcParserBase::"); +} + +TProtoStringType MessageTcParseFunctionName(const FieldDescriptor* field, + const Options& options) { + if (field->message_type()->field_count() == 0 || + !HasGeneratedMethods(field->message_type()->file(), options)) { + // For files with `option optimize_for = CODE_SIZE`, or which derive from + // `ZeroFieldsBase`, we need to call the `_InternalParse` function, because + // there is no generated tailcall function. For tailcall parsing, this is + // done by helpers in TcParserBase. + return StrCat(TcParserBaseName(options), + (field->is_repeated() ? "Repeated" : "Singular"), + "ParseMessage<", + QualifiedClassName(field->message_type()), // + ", ", TagType(field), ">"); } - name.append("ParseMessage<" + QualifiedClassName(field->message_type()) + - ", " + TagType(field) + ">"); - return name; + // This matches macros in generated_message_tctable_impl.h: + return StrCat("PROTOBUF_TC_PARSE_", + (field->is_repeated() ? "REPEATED" : "SINGULAR"), + TagSize(field->number()), "(", + QualifiedClassName(field->message_type()), ")"); } TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, @@ -105,10 +113,6 @@ TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, } // namespace -const char* CodedTagType(int tag_size) { - return tag_size == 1 ? "uint8_t" : "uint16_t"; -} - TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, const Options& options, const std::vector<int>& has_bit_indices, @@ -139,9 +143,9 @@ TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, // Anything difficult slow path: if (field->is_map()) continue; if (field->real_containing_oneof()) continue; - if (field->options().lazy()) continue; if (field->options().weak()) continue; if (IsImplicitWeakField(field, options, scc_analyzer)) continue; + if (IsLazy(field, options, scc_analyzer)) continue; // The largest tag that can be read by the tailcall parser is two bytes // when varint-coded. This allows 14 bits for the numeric tag value: @@ -189,7 +193,7 @@ TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, switch (field->type()) { case FieldDescriptor::TYPE_MESSAGE: - name = MessageParseFunctionName(field, options); + name = MessageTcParseFunctionName(field, options); break; case FieldDescriptor::TYPE_FIXED64: @@ -210,7 +214,8 @@ TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, case FieldDescriptor::TYPE_BYTES: if (field->options().ctype() == FieldOptions::STRING && - field->default_value_string().empty()) { + field->default_value_string().empty() && + !IsStringInlined(field, options)) { name = FieldParseFunctionName(field, options, table_size_log2); } break; @@ -230,16 +235,6 @@ TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, fast_path_fields[idx].field = field; } - // Construct a mask of has-bits for required fields numbered <= 32. - has_hasbits_required_mask = 0; - for (auto field : FieldRange(descriptor)) { - if (field->is_required()) { - int idx = has_bit_indices[field->index()]; - if (idx >= 32) continue; - has_hasbits_required_mask |= 1u << idx; - } - } - // If there are no fallback fields, and at most one extension range, the // parser can use a generic fallback function. Otherwise, a message-specific // fallback routine is needed. @@ -249,15 +244,17 @@ TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, ParseFunctionGenerator::ParseFunctionGenerator( const Descriptor* descriptor, int max_has_bit_index, - const std::vector<int>& has_bit_indices, const Options& options, + const std::vector<int>& has_bit_indices, + const std::vector<int>& inlined_string_indices, const Options& options, MessageSCCAnalyzer* scc_analyzer, const std::map<TProtoStringType, TProtoStringType>& vars) : descriptor_(descriptor), scc_analyzer_(scc_analyzer), options_(options), variables_(vars), + inlined_string_indices_(inlined_string_indices), num_hasbits_(max_has_bit_index) { - if (IsTcTableGuarded(options_) || IsTcTableEnabled(options_)) { + if (should_generate_tctable()) { tc_table_info_.reset(new TailCallTableInfo(descriptor_, options_, has_bit_indices, scc_analyzer)); } @@ -268,28 +265,46 @@ ParseFunctionGenerator::ParseFunctionGenerator( void ParseFunctionGenerator::GenerateMethodDecls(io::Printer* printer) { Formatter format(printer, variables_); - if (IsTcTableGuarded(options_)) { - format.Outdent(); - format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); - format.Indent(); - } - if (IsTcTableGuarded(options_) || IsTcTableEnabled(options_)) { + if (should_generate_tctable()) { + auto declare_function = [&format](const char* name, + const TProtoStringType& guard) { + if (!guard.empty()) { + format.Outdent(); + format("#if $1$\n", guard); + format.Indent(); + } + format("static const char* $1$(PROTOBUF_TC_PARAM_DECL);\n", name); + if (!guard.empty()) { + format.Outdent(); + format("#endif // $1$\n", guard); + format.Indent(); + } + }; + if (should_generate_guarded_tctable()) { + format.Outdent(); + format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); + format.Indent(); + } + format("// The Tct_* functions are internal to the protobuf runtime:\n"); + // These guards are defined in port_def.inc: + declare_function("Tct_ParseS1", "PROTOBUF_TC_STATIC_PARSE_SINGULAR1"); + declare_function("Tct_ParseS2", "PROTOBUF_TC_STATIC_PARSE_SINGULAR2"); + declare_function("Tct_ParseR1", "PROTOBUF_TC_STATIC_PARSE_REPEATED1"); + declare_function("Tct_ParseR2", "PROTOBUF_TC_STATIC_PARSE_REPEATED2"); if (tc_table_info_->use_generated_fallback) { + format.Outdent(); format( - "static const char* Tct_ParseFallback(\n" - " ::$proto_ns$::MessageLite *msg, const char *ptr,\n" - " ::$proto_ns$::internal::ParseContext *ctx,\n" - " const ::$proto_ns$::internal::TailCallParseTableBase *table,\n" - " uint64_t hasbits, ::$proto_ns$::internal::TcFieldData data);\n" - "inline const char* Tct_FallbackImpl(\n" - " const char* ptr, ::$proto_ns$::internal::ParseContext* ctx,\n" - " const void*, $uint64$ hasbits);\n"); + " private:\n" + " "); + declare_function("Tct_ParseFallback", ""); + format(" public:\n"); + format.Indent(); + } + if (should_generate_guarded_tctable()) { + format.Outdent(); + format("#endif\n"); + format.Indent(); } - } - if (IsTcTableGuarded(options_)) { - format.Outdent(); - format("#endif\n"); - format.Indent(); } format( "const char* _InternalParse(const char* ptr, " @@ -298,8 +313,10 @@ void ParseFunctionGenerator::GenerateMethodDecls(io::Printer* printer) { void ParseFunctionGenerator::GenerateMethodImpls(io::Printer* printer) { Formatter format(printer, variables_); + bool need_parse_function = true; if (descriptor_->options().message_set_wire_format()) { // Special-case MessageSet. + need_parse_function = false; format( "const char* $classname$::_InternalParse(const char* ptr,\n" " ::$proto_ns$::internal::ParseContext* ctx) {\n" @@ -307,85 +324,157 @@ void ParseFunctionGenerator::GenerateMethodImpls(io::Printer* printer) { " return _extensions_.ParseMessageSet(ptr, \n" " internal_default_instance(), &_internal_metadata_, ctx);\n" "}\n"); + } + if (!should_generate_tctable()) { + if (need_parse_function) { + GenerateLoopingParseFunction(format); + } return; } - if (IsTcTableGuarded(options_)) { + if (should_generate_guarded_tctable()) { format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n\n"); } - if (IsTcTableGuarded(options_) || IsTcTableEnabled(options_)) { - format( - "const char* $classname$::_InternalParse(\n" - " const char* ptr, ::$proto_ns$::internal::ParseContext* ctx) {\n" - " return ::$proto_ns$::internal::TcParser<$1$>::ParseLoop(\n" - " this, ptr, ctx, &_table_.header);\n" - "}\n" - "\n", - tc_table_info_->table_size_log2); - if (tc_table_info_->use_generated_fallback) { - GenerateTailcallFallbackFunction(format); - } - } - if (IsTcTableGuarded(options_)) { - format("\n#else // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n\n"); + if (need_parse_function) { + GenerateTailcallParseFunction(format); } - if (IsTcTableGuarded(options_) || IsTcTableDisabled(options_)) { - GenerateLoopingParseFunction(format); + if (tc_table_info_->use_generated_fallback) { + GenerateTailcallFallbackFunction(format); } - if (IsTcTableGuarded(options_)) { + GenerateTailcallFieldParseFunctions(format); + if (should_generate_guarded_tctable()) { + if (need_parse_function) { + format("\n#else // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n\n"); + GenerateLoopingParseFunction(format); + } format("\n#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); } } -void ParseFunctionGenerator::GenerateTailcallFallbackFunction( - Formatter& format) { +bool ParseFunctionGenerator::should_generate_tctable() const { + if (options_.tctable_mode == Options::kTCTableNever) { + return false; + } + return true; +} + +void ParseFunctionGenerator::GenerateTailcallParseFunction(Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); + + // Generate an `_InternalParse` that starts the tail-calling loop. format( - "const char* $classname$::Tct_ParseFallback(PROTOBUF_TC_PARAM_DECL) {\n" - " return static_cast<$classname$*>(msg)->Tct_FallbackImpl(ptr, ctx, " - "table, hasbits);\n" + "const char* $classname$::_InternalParse(\n" + " const char* ptr, ::$proto_ns$::internal::ParseContext* ctx) {\n" + "$annotate_deserialize$" + " ptr = ::$proto_ns$::internal::TcParser<$1$>::ParseLoop(\n" + " this, ptr, ctx, &_table_.header);\n", + tc_table_info_->table_size_log2); + format( + " return ptr;\n" "}\n\n"); +} +void ParseFunctionGenerator::GenerateTailcallFallbackFunction( + Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); format( - "const char* $classname$::Tct_FallbackImpl(const char* ptr, " - "::$proto_ns$::internal::ParseContext* ctx, const void*, " - "$uint64$ hasbits) {\n" + "const char* $classname$::Tct_ParseFallback(PROTOBUF_TC_PARAM_DECL) {\n" "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) return nullptr\n"); format.Indent(); + format("auto* typed_msg = static_cast<$classname$*>(msg);\n"); if (num_hasbits_ > 0) { // Sync hasbits - format("_has_bits_[0] = hasbits;\n"); + format("typed_msg->_has_bits_[0] = hasbits;\n"); } - format.Set("has_bits", "_has_bits_"); - format.Set("continue", "goto success"); + format.Set("msg", "typed_msg->"); + format.Set("this", "typed_msg"); + format.Set("has_bits", "typed_msg->_has_bits_"); + format.Set("next_tag", "goto next_tag"); GenerateParseIterationBody(format, descriptor_, tc_table_info_->fallback_fields); format.Outdent(); - format("success:\n"); - format(" return ptr;\n"); format( + "next_tag:\n" + "message_done:\n" + " return ptr;\n" "#undef CHK_\n" "}\n"); } +void ParseFunctionGenerator::GenerateTailcallFieldParseFunctions( + Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); + // There are four cases where a tailcall target are needed for messages: + // {singular, repeated} x {1, 2}-byte tag + struct { + const char* type; + int size; + } const kTagLayouts[] = { + {"uint8_t", 1}, + {"uint16_t", 2}, + }; + // Singular: + for (const auto& layout : kTagLayouts) { + // Guard macros are defined in port_def.inc. + format( + "#if PROTOBUF_TC_STATIC_PARSE_SINGULAR$1$\n" + "const char* $classname$::Tct_ParseS$1$(PROTOBUF_TC_PARAM_DECL) {\n" + " if (PROTOBUF_PREDICT_FALSE(data.coded_tag<$2$>() != 0))\n" + " PROTOBUF_MUSTTAIL " + "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n" + " ptr += $1$;\n" + " hasbits |= (uint64_t{1} << data.hasbit_idx());\n" + " ::$proto_ns$::internal::TcParserBase::SyncHasbits" + "(msg, hasbits, table);\n" + " auto& field = ::$proto_ns$::internal::TcParserBase::" + "RefAt<$classtype$*>(msg, data.offset());\n" + " if (field == nullptr)\n" + " field = CreateMaybeMessage<$classtype$>(ctx->data().arena);\n" + " return ctx->ParseMessage(field, ptr);\n" + "}\n" + "#endif // PROTOBUF_TC_STATIC_PARSE_SINGULAR$1$\n", + layout.size, layout.type); + } + // Repeated: + for (const auto& layout : kTagLayouts) { + // Guard macros are defined in port_def.inc. + format( + "#if PROTOBUF_TC_STATIC_PARSE_REPEATED$1$\n" + "const char* $classname$::Tct_ParseR$1$(PROTOBUF_TC_PARAM_DECL) {\n" + " if (PROTOBUF_PREDICT_FALSE(data.coded_tag<$2$>() != 0)) {\n" + " PROTOBUF_MUSTTAIL " + "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n" + " }\n" + " ptr += $1$;\n" + " auto& field = ::$proto_ns$::internal::TcParserBase::RefAt<" + "::$proto_ns$::RepeatedPtrField<$classname$>>(msg, data.offset());\n" + " ::$proto_ns$::internal::TcParserBase::SyncHasbits" + "(msg, hasbits, table);\n" + " ptr = ctx->ParseMessage(field.Add(), ptr);\n" + " return ptr;\n" + "}\n" + "#endif // PROTOBUF_TC_STATIC_PARSE_REPEATED$1$\n", + layout.size, layout.type); + } +} + void ParseFunctionGenerator::GenerateDataDecls(io::Printer* printer) { - if (descriptor_->options().message_set_wire_format()) { + if (!should_generate_tctable()) { return; } Formatter format(printer, variables_); - if (IsTcTableGuarded(options_)) { + if (should_generate_guarded_tctable()) { format.Outdent(); format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); format.Indent(); } - if (IsTcTableGuarded(options_) || IsTcTableEnabled(options_)) { - format( - "static const ::$proto_ns$::internal::TailCallParseTable<$1$>\n" - " _table_;\n", - tc_table_info_->table_size_log2); - } - if (IsTcTableGuarded(options_)) { + format( + "static const ::$proto_ns$::internal::TailCallParseTable<$1$>\n" + " _table_;\n", + tc_table_info_->table_size_log2); + if (should_generate_guarded_tctable()) { format.Outdent(); format("#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); format.Indent(); @@ -393,17 +482,15 @@ void ParseFunctionGenerator::GenerateDataDecls(io::Printer* printer) { } void ParseFunctionGenerator::GenerateDataDefinitions(io::Printer* printer) { - if (descriptor_->options().message_set_wire_format()) { + if (!should_generate_tctable()) { return; } Formatter format(printer, variables_); - if (IsTcTableGuarded(options_)) { + if (should_generate_guarded_tctable()) { format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); } - if (IsTcTableGuarded(options_) || IsTcTableEnabled(options_)) { - GenerateTailCallTable(format); - } - if (IsTcTableGuarded(options_)) { + GenerateTailCallTable(format); + if (should_generate_guarded_tctable()) { format("#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n"); } } @@ -415,6 +502,8 @@ void ParseFunctionGenerator::GenerateLoopingParseFunction(Formatter& format) { "$annotate_deserialize$" "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure\n"); format.Indent(); + format.Set("msg", ""); + format.Set("this", "this"); int hasbits_size = 0; if (num_hasbits_ > 0) { hasbits_size = (num_hasbits_ + 31) / 32; @@ -427,7 +516,7 @@ void ParseFunctionGenerator::GenerateLoopingParseFunction(Formatter& format) { } else { format.Set("has_bits", "_has_bits_"); } - format.Set("continue", "continue"); + format.Set("next_tag", "continue"); format("while (!ctx->Done(&ptr)) {\n"); format.Indent(); @@ -438,26 +527,26 @@ void ParseFunctionGenerator::GenerateLoopingParseFunction(Formatter& format) { format("} // while\n"); format.Outdent(); - format("success:\n"); + format("message_done:\n"); if (hasbits_size) format(" _has_bits_.Or(has_bits);\n"); format( " return ptr;\n" "failure:\n" " ptr = nullptr;\n" - " goto success;\n" + " goto message_done;\n" "#undef CHK_\n" "}\n"); } void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) { + GOOGLE_CHECK(should_generate_tctable()); // All entries without a fast-path parsing function need a fallback. TProtoStringType fallback; if (tc_table_info_->use_generated_fallback) { fallback = ClassName(descriptor_) + "::Tct_ParseFallback"; } else { - fallback = "::" + ProtobufNamespace(options_) + - "::internal::TcParserBase::GenericFallback"; + fallback = TcParserBaseName(options_) + "GenericFallback"; if (GetOptimizeFor(descriptor_->file(), options_) == FileOptions::LITE_RUNTIME) { fallback += "Lite"; @@ -493,10 +582,8 @@ void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) { format("0, 0, 0, // no _extensions_\n"); } format( - "$1$, // has_bits_required_mask\n" - "&$2$._instance,\n" - "$3$ // fallback\n", - tc_table_info_->has_hasbits_required_mask, + "&$1$._instance,\n" + "$2$ // fallback\n", DefaultInstanceName(descriptor_, options_), fallback); format.Outdent(); format("}, {\n"); @@ -536,13 +623,26 @@ void ParseFunctionGenerator::GenerateArenaString(Formatter& format, "::" + MakeDefaultName(field) + ".get()"; format( "if (arena != nullptr) {\n" - " ptr = ctx->ReadArenaString(ptr, &$1$_, arena);\n" + " ptr = ctx->ReadArenaString(ptr, &$msg$$name$_, arena"); + if (IsStringInlined(field, options_)) { + GOOGLE_DCHECK(!inlined_string_indices_.empty()); + int inlined_string_index = inlined_string_indices_[field->index()]; + GOOGLE_DCHECK_GE(inlined_string_index, 0); + format( + ", $msg$_internal_$name$_donated()" + ", &$msg$_inlined_string_donated_[$1$]" + ", ~0x$2$u", + inlined_string_index / 32, + strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8)); + } + format( + ");\n" "} else {\n" " ptr = ::$proto_ns$::internal::InlineGreedyStringParser(" - "$1$_.MutableNoArenaNoDefault(&$2$), ptr, ctx);\n" + "$msg$$name$_.MutableNoArenaNoDefault(&$1$), ptr, ctx);\n" "}\n" - "const TProtoStringType* str = &$1$_.Get(); (void)str;\n", - FieldName(field), default_string); + "const TProtoStringType* str = &$msg$$name$_.Get(); (void)str;\n", + default_string); } void ParseFunctionGenerator::GenerateStrings(Formatter& format, @@ -560,24 +660,24 @@ void ParseFunctionGenerator::GenerateStrings(Formatter& format, !field->real_containing_oneof() && ctype == FieldOptions::STRING) { GenerateArenaString(format, field); } else { - TProtoStringType name; + TProtoStringType parser_name; switch (ctype) { case FieldOptions::STRING: - name = "GreedyStringParser"; + parser_name = "GreedyStringParser"; break; case FieldOptions::CORD: - name = "CordParser"; + parser_name = "CordParser"; break; case FieldOptions::STRING_PIECE: - name = "StringPieceParser"; + parser_name = "StringPieceParser"; break; } format( - "auto str = $1$$2$_$3$();\n" - "ptr = ::$proto_ns$::internal::Inline$4$(str, ptr, ctx);\n", + "auto str = $msg$$1$$2$_$name$();\n" + "ptr = ::$proto_ns$::internal::Inline$3$(str, ptr, ctx);\n", HasInternalAccessors(ctype) ? "_internal_" : "", field->is_repeated() && !field->is_packable() ? "add" : "mutable", - FieldName(field), name); + parser_name); } if (!check_utf8) return; // return if this is a bytes field auto level = GetUtf8CheckMode(field, options_); @@ -614,24 +714,20 @@ void ParseFunctionGenerator::GenerateStrings(Formatter& format, void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format, const FieldDescriptor* field) { if (field->is_packable()) { - TProtoStringType enum_validator; if (field->type() == FieldDescriptor::TYPE_ENUM && !HasPreservingUnknownEnumSemantics(field)) { - enum_validator = - StrCat(", ", QualifiedClassName(field->enum_type(), options_), - "_IsValid, &_internal_metadata_, ", field->number()); + TProtoStringType enum_type = QualifiedClassName(field->enum_type(), options_); format( "ptr = " "::$proto_ns$::internal::Packed$1$Parser<$unknown_fields_type$>(" - "_internal_mutable_$2$(), ptr, ctx$3$);\n", - DeclaredTypeMethodName(field->type()), FieldName(field), - enum_validator); + "$msg$_internal_mutable_$name$(), ptr, ctx, $2$_IsValid, " + "&$msg$_internal_metadata_, $3$);\n", + DeclaredTypeMethodName(field->type()), enum_type, field->number()); } else { format( "ptr = ::$proto_ns$::internal::Packed$1$Parser(" - "_internal_mutable_$2$(), ptr, ctx$3$);\n", - DeclaredTypeMethodName(field->type()), FieldName(field), - enum_validator); + "$msg$_internal_mutable_$name$(), ptr, ctx);\n", + DeclaredTypeMethodName(field->type())); } } else { auto field_type = field->type(); @@ -651,61 +747,59 @@ void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format, !HasPreservingUnknownEnumSemantics(field)) { format( "auto object = " - "::$proto_ns$::internal::InitEnumParseWrapper<$unknown_" - "fields_type$>(" - "&$1$_, $2$_IsValid, $3$, &_internal_metadata_);\n" + "::$proto_ns$::internal::InitEnumParseWrapper<" + "$unknown_fields_type$>(&$msg$$name$_, $1$_IsValid, " + "$2$, &$msg$_internal_metadata_);\n" "ptr = ctx->ParseMessage(&object, ptr);\n", - FieldName(field), QualifiedClassName(val->enum_type()), + QualifiedClassName(val->enum_type(), options_), field->number()); } else { - format("ptr = ctx->ParseMessage(&$1$_, ptr);\n", FieldName(field)); + format("ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n"); } } else if (IsLazy(field, options_, scc_analyzer_)) { if (field->real_containing_oneof()) { format( - "if (!_internal_has_$1$()) {\n" - " clear_$2$();\n" - " $2$_.$1$_ = ::$proto_ns$::Arena::CreateMessage<\n" + "if (!$msg$_internal_has_$name$()) {\n" + " $msg$clear_$1$();\n" + " $msg$$1$_.$name$_ = ::$proto_ns$::Arena::CreateMessage<\n" " ::$proto_ns$::internal::LazyField>(" - "GetArenaForAllocation());\n" - " set_has_$1$();\n" + "$msg$GetArenaForAllocation());\n" + " $msg$set_has_$name$();\n" "}\n" - "ptr = ctx->ParseMessage($2$_.$1$_, ptr);\n", - FieldName(field), field->containing_oneof()->name()); + "ptr = ctx->ParseMessage($msg$$1$_.$name$_, ptr);\n", + field->containing_oneof()->name()); } else if (HasHasbit(field)) { format( - "_Internal::set_has_$1$(&$has_bits$);\n" - "ptr = ctx->ParseMessage(&$1$_, ptr);\n", - FieldName(field)); + "_Internal::set_has_$name$(&$has_bits$);\n" + "ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n"); } else { - format("ptr = ctx->ParseMessage(&$1$_, ptr);\n", FieldName(field)); + format("ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n"); } } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) { if (!field->is_repeated()) { format( - "ptr = ctx->ParseMessage(_Internal::mutable_$1$(this), " - "ptr);\n", - FieldName(field)); + "ptr = ctx->ParseMessage(_Internal::mutable_$name$($this$), " + "ptr);\n"); } else { format( - "ptr = ctx->ParseMessage($1$_.AddWeak(reinterpret_cast<const " - "::$proto_ns$::MessageLite*>($2$::_$3$_default_instance_ptr_)" + "ptr = ctx->ParseMessage($msg$$name$_.AddWeak(" + "reinterpret_cast<const ::$proto_ns$::MessageLite*>($1$ptr_)" "), ptr);\n", - FieldName(field), Namespace(field->message_type(), options_), - ClassName(field->message_type())); + QualifiedDefaultInstanceName(field->message_type(), options_)); } } else if (IsWeak(field, options_)) { format( "{\n" " auto* default_ = &reinterpret_cast<const Message&>($1$);\n" - " ptr = ctx->ParseMessage(_weak_field_map_.MutableMessage($2$," - " default_), ptr);\n" + " ptr = ctx->ParseMessage($msg$_weak_field_map_.MutableMessage(" + "$2$, default_), ptr);\n" "}\n", QualifiedDefaultInstanceName(field->message_type(), options_), field->number()); } else { - format("ptr = ctx->ParseMessage(_internal_$1$_$2$(), ptr);\n", - field->is_repeated() ? "add" : "mutable", FieldName(field)); + format( + "ptr = ctx->ParseMessage($msg$_internal_$mutable_field$(), " + "ptr);\n"); } break; } @@ -728,29 +822,39 @@ static bool ShouldRepeat(const FieldDescriptor* descriptor, void ParseFunctionGenerator::GenerateFieldBody( Formatter& format, WireFormatLite::WireType wiretype, const FieldDescriptor* field) { + Formatter::SaveState formatter_state(&format); + format.AddMap( + {{"name", FieldName(field)}, + {"primitive_type", PrimitiveTypeName(options_, field->cpp_type())}}); + if (field->is_repeated()) { + format.AddMap({{"put_field", StrCat("add_", FieldName(field))}, + {"mutable_field", StrCat("add_", FieldName(field))}}); + } else { + format.AddMap( + {{"put_field", StrCat("set_", FieldName(field))}, + {"mutable_field", StrCat("mutable_", FieldName(field))}}); + } uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype); switch (wiretype) { case WireFormatLite::WIRETYPE_VARINT: { TProtoStringType type = PrimitiveTypeName(options_, field->cpp_type()); - TProtoStringType prefix = field->is_repeated() ? "add" : "set"; if (field->type() == FieldDescriptor::TYPE_ENUM) { + format.Set("enum_type", + QualifiedClassName(field->enum_type(), options_)); format( "$uint64$ val = ::$proto_ns$::internal::ReadVarint64(&ptr);\n" "CHK_(ptr);\n"); if (!HasPreservingUnknownEnumSemantics(field)) { - format("if (PROTOBUF_PREDICT_TRUE($1$_IsValid(val))) {\n", - QualifiedClassName(field->enum_type(), options_)); + format("if (PROTOBUF_PREDICT_TRUE($enum_type$_IsValid(val))) {\n"); format.Indent(); } - format("_internal_$1$_$2$(static_cast<$3$>(val));\n", prefix, - FieldName(field), - QualifiedClassName(field->enum_type(), options_)); + format("$msg$_internal_$put_field$(static_cast<$enum_type$>(val));\n"); if (!HasPreservingUnknownEnumSemantics(field)) { format.Outdent(); format( "} else {\n" " ::$proto_ns$::internal::WriteVarint(" - "$1$, val, mutable_unknown_fields());\n" + "$1$, val, $msg$mutable_unknown_fields());\n" "}\n", field->number()); } @@ -765,42 +869,38 @@ void ParseFunctionGenerator::GenerateFieldBody( zigzag = "ZigZag"; } if (field->is_repeated() || field->real_containing_oneof()) { - TProtoStringType prefix = field->is_repeated() ? "add" : "set"; format( - "_internal_$1$_$2$(" - "::$proto_ns$::internal::ReadVarint$3$$4$(&ptr));\n" + "$msg$_internal_$put_field$(" + "::$proto_ns$::internal::ReadVarint$1$$2$(&ptr));\n" "CHK_(ptr);\n", - prefix, FieldName(field), zigzag, size); + zigzag, size); } else { if (HasHasbit(field)) { - format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field)); + format("_Internal::set_has_$name$(&$has_bits$);\n"); } format( - "$1$_ = ::$proto_ns$::internal::ReadVarint$2$$3$(&ptr);\n" + "$msg$$name$_ = ::$proto_ns$::internal::ReadVarint$1$$2$(&ptr);\n" "CHK_(ptr);\n", - FieldName(field), zigzag, size); + zigzag, size); } } break; } case WireFormatLite::WIRETYPE_FIXED32: case WireFormatLite::WIRETYPE_FIXED64: { - TProtoStringType type = PrimitiveTypeName(options_, field->cpp_type()); if (field->is_repeated() || field->real_containing_oneof()) { - TProtoStringType prefix = field->is_repeated() ? "add" : "set"; format( - "_internal_$1$_$2$(" - "::$proto_ns$::internal::UnalignedLoad<$3$>(ptr));\n" - "ptr += sizeof($3$);\n", - prefix, FieldName(field), type); + "$msg$_internal_$put_field$(" + "::$proto_ns$::internal::UnalignedLoad<$primitive_type$>(ptr));\n" + "ptr += sizeof($primitive_type$);\n"); } else { if (HasHasbit(field)) { - format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field)); + format("_Internal::set_has_$name$(&$has_bits$);\n"); } format( - "$1$_ = ::$proto_ns$::internal::UnalignedLoad<$2$>(ptr);\n" - "ptr += sizeof($2$);\n", - FieldName(field), type); + "$msg$$name$_ = " + "::$proto_ns$::internal::UnalignedLoad<$primitive_type$>(ptr);\n" + "ptr += sizeof($primitive_type$);\n"); } break; } @@ -811,9 +911,9 @@ void ParseFunctionGenerator::GenerateFieldBody( } case WireFormatLite::WIRETYPE_START_GROUP: { format( - "ptr = ctx->ParseGroup(_internal_$1$_$2$(), ptr, $3$);\n" + "ptr = ctx->ParseGroup($msg$_internal_$mutable_field$(), ptr, $1$);\n" "CHK_(ptr);\n", - field->is_repeated() ? "add" : "mutable", FieldName(field), tag); + tag); break; } case WireFormatLite::WIRETYPE_END_GROUP: { @@ -845,14 +945,90 @@ static uint32_t ExpectedTag(const FieldDescriptor* field, return expected_tag; } +// These variables are used by the generated parse iteration, and must already +// be defined in the generated code: +// - `const char* ptr`: the input buffer. +// - `ParseContext* ctx`: the associated context for `ptr`. +// - implicit `this`: i.e., we must be in a non-static member function. +// +// The macro `CHK_(x)` must be defined. It should return an error condition if +// the macro parameter is false. +// +// Whenever an END_GROUP tag was read, or tag 0 was read, the generated code +// branches to the label `message_done`. +// +// These formatter variables are used: +// - `next_tag`: a single statement to begin parsing the next tag. +// +// At the end of the generated code, the enclosing function should proceed to +// parse the next tag in the stream. void ParseFunctionGenerator::GenerateParseIterationBody( Formatter& format, const Descriptor* descriptor, const std::vector<const FieldDescriptor*>& ordered_fields) { format( "$uint32$ tag;\n" "ptr = ::$proto_ns$::internal::ReadTag(ptr, &tag);\n"); - if (!ordered_fields.empty()) format("switch (tag >> 3) {\n"); + if (!ordered_fields.empty()) { + GenerateFieldSwitch(format, ordered_fields); + // Each field `case` only considers field number. Field numbers that are + // not defined in the message, or tags with an incompatible wire type, are + // considered "unusual" cases. They will be handled by the logic below. + format.Outdent(); + format("handle_unusual:\n"); + format.Indent(); + } + + // Unusual/extension/unknown case: + format( + "if ((tag == 0) || ((tag & 7) == 4)) {\n" + " CHK_(ptr);\n" + " ctx->SetLastTag(tag);\n" + " goto message_done;\n" + "}\n"); + if (IsMapEntryMessage(descriptor)) { + format("$next_tag$;\n"); + } else { + if (descriptor->extension_range_count() > 0) { + format("if ("); + for (int i = 0; i < descriptor->extension_range_count(); i++) { + const Descriptor::ExtensionRange* range = + descriptor->extension_range(i); + if (i > 0) format(" ||\n "); + + uint32_t start_tag = WireFormatLite::MakeTag( + range->start, static_cast<WireFormatLite::WireType>(0)); + uint32_t end_tag = WireFormatLite::MakeTag( + range->end, static_cast<WireFormatLite::WireType>(0)); + + if (range->end > FieldDescriptor::kMaxNumber) { + format("($1$u <= tag)", start_tag); + } else { + format("($1$u <= tag && tag < $2$u)", start_tag, end_tag); + } + } + format( + ") {\n" + " ptr = $msg$_extensions_.ParseField(tag, ptr, " + "internal_default_instance(), &$msg$_internal_metadata_, ctx);\n" + " CHK_(ptr != nullptr);\n" + " $next_tag$;\n" + "}\n"); + } + format( + "ptr = UnknownFieldParse(\n" + " tag,\n" + " $msg$_internal_metadata_.mutable_unknown_fields<" + "$unknown_fields_type$>(),\n" + " ptr, ctx);\n" + "CHK_(ptr != nullptr);\n"); + } +} + +void ParseFunctionGenerator::GenerateFieldSwitch( + Formatter& format, + const std::vector<const FieldDescriptor*>& ordered_fields) { + format("switch (tag >> 3) {\n"); format.Indent(); for (const auto* field : ordered_fields) { @@ -893,61 +1069,18 @@ void ParseFunctionGenerator::GenerateParseIterationBody( field); format.Outdent(); } - format.Outdent(); format( - " } else goto handle_unusual;\n" - " $continue$;\n"); + "} else\n" + " goto handle_unusual;\n" + "$next_tag$;\n"); + format.Outdent(); } // for loop over ordered fields - // Default case - if (!ordered_fields.empty()) format("default: {\n"); - if (!ordered_fields.empty()) format("handle_unusual:\n"); format( - " if ((tag == 0) || ((tag & 7) == 4)) {\n" - " CHK_(ptr);\n" - " ctx->SetLastTag(tag);\n" - " goto success;\n" - " }\n"); - if (IsMapEntryMessage(descriptor)) { - format(" $continue$;\n"); - } else { - if (descriptor->extension_range_count() > 0) { - format("if ("); - for (int i = 0; i < descriptor->extension_range_count(); i++) { - const Descriptor::ExtensionRange* range = - descriptor->extension_range(i); - if (i > 0) format(" ||\n "); - - uint32_t start_tag = WireFormatLite::MakeTag( - range->start, static_cast<WireFormatLite::WireType>(0)); - uint32_t end_tag = WireFormatLite::MakeTag( - range->end, static_cast<WireFormatLite::WireType>(0)); - - if (range->end > FieldDescriptor::kMaxNumber) { - format("($1$u <= tag)", start_tag); - } else { - format("($1$u <= tag && tag < $2$u)", start_tag, end_tag); - } - } - format(") {\n"); - format( - " ptr = _extensions_.ParseField(tag, ptr,\n" - " internal_default_instance(), &_internal_metadata_, ctx);\n" - " CHK_(ptr != nullptr);\n" - " $continue$;\n" - "}\n"); - } - format( - " ptr = UnknownFieldParse(tag,\n" - " _internal_metadata_.mutable_unknown_fields<$unknown_" - "fields_type$>(),\n" - " ptr, ctx);\n" - " CHK_(ptr != nullptr);\n" - " $continue$;\n"); - } - if (!ordered_fields.empty()) format("}\n"); // default case + "default:\n" + " goto handle_unusual;\n"); format.Outdent(); - if (!ordered_fields.empty()) format("} // switch\n"); + format("} // switch\n"); } namespace { @@ -1137,31 +1270,30 @@ TProtoStringType GetTailCallFieldHandlerName(ParseCardinality card, name.append(CodedTagType(tag_length_bytes)); - TProtoStringType tcpb = - StrCat(ProtobufNamespace(options), "::internal::TcParserBase"); - switch (type_format) { case TypeFormat::kVar64: case TypeFormat::kVar32: case TypeFormat::kBool: - name.append(StrCat(", ::", tcpb, "::kNoConversion")); + name.append( + StrCat(", ", TcParserBaseName(options), "kNoConversion")); break; case TypeFormat::kSInt64: case TypeFormat::kSInt32: - name.append(StrCat(", ::", tcpb, "::kZigZag")); + name.append(StrCat(", ", TcParserBaseName(options), "kZigZag")); break; case TypeFormat::kBytes: - name.append(StrCat(", ::", tcpb, "::kNoUtf8")); + name.append(StrCat(", ", TcParserBaseName(options), "kNoUtf8")); break; case TypeFormat::kString: - name.append(StrCat(", ::", tcpb, "::kUtf8")); + name.append(StrCat(", ", TcParserBaseName(options), "kUtf8")); break; case TypeFormat::kStringValidateOnly: - name.append(StrCat(", ::", tcpb, "::kUtf8ValidateOnly")); + name.append( + StrCat(", ", TcParserBaseName(options), "kUtf8ValidateOnly")); break; default: diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h index b992bb38c8..34c8fc488b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h @@ -76,6 +76,7 @@ class ParseFunctionGenerator { public: ParseFunctionGenerator(const Descriptor* descriptor, int max_has_bit_index, const std::vector<int>& has_bit_indices, + const std::vector<int>& inlined_string_indices, const Options& options, MessageSCCAnalyzer* scc_analyzer, const std::map<TProtoStringType, TProtoStringType>& vars); @@ -93,9 +94,25 @@ class ParseFunctionGenerator { void GenerateDataDefinitions(io::Printer* printer); private: + // Returns true if tailcall table code should be generated. + bool should_generate_tctable() const; + + // Returns true if tailcall table code should be generated, but inside an + // #ifdef guard. + bool should_generate_guarded_tctable() const { + return should_generate_tctable() && + options_.tctable_mode == Options::kTCTableGuarded; + } + + // Generates a tail-calling `_InternalParse` function. + void GenerateTailcallParseFunction(Formatter& format); + // Generates a fallback function for tailcall table-based parsing. void GenerateTailcallFallbackFunction(Formatter& format); + // Generates functions for parsing this message as a field. + void GenerateTailcallFieldParseFunctions(Formatter& format); + // Generates a looping `_InternalParse` function. void GenerateLoopingParseFunction(Formatter& format); @@ -123,18 +140,20 @@ class ParseFunctionGenerator { Formatter& format, const Descriptor* descriptor, const std::vector<const FieldDescriptor*>& ordered_fields); + // Generates a `switch` statement to parse each of `ordered_fields`. + void GenerateFieldSwitch( + Formatter& format, + const std::vector<const FieldDescriptor*>& ordered_fields); + const Descriptor* descriptor_; MessageSCCAnalyzer* scc_analyzer_; const Options& options_; std::map<TProtoStringType, TProtoStringType> variables_; std::unique_ptr<TailCallTableInfo> tc_table_info_; + std::vector<int> inlined_string_indices_; int num_hasbits_; }; -// Returns the integer type that holds a tag of the given length (in bytes) when -// wire-encoded. -const char* CodedTagType(int tag_size); - enum class ParseCardinality { kSingular, kOneof, diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc index da229ce3c4..8b37b866ae 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc @@ -209,10 +209,19 @@ void PrimitiveFieldGenerator::GenerateByteSize(io::Printer* printer) const { Formatter format(printer, variables_); int fixed_size = FixedSize(descriptor_->type()); if (fixed_size == -1) { - format( - "total_size += $tag_size$ +\n" - " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" - " this->_internal_$name$());\n"); + if (internal::WireFormat::TagSize(descriptor_->number(), + descriptor_->type()) == 1) { + // Adding one is very common and it turns out it can be done for + // free inside of WireFormatLite, so we can save an instruction here. + format( + "total_size += ::$proto_ns$::internal::WireFormatLite::" + "$declared_type$SizePlusOne(this->_internal_$name$());\n"); + } else { + format( + "total_size += $tag_size$ +\n" + " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n" + " this->_internal_$name$());\n"); + } } else { format("total_size += $tag_size$ + $fixed_size$;\n"); } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.h index 394b304770..ce0f97d930 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_primitive_field.h @@ -51,17 +51,17 @@ class PrimitiveFieldGenerator : public FieldGenerator { ~PrimitiveFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); @@ -74,10 +74,10 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { ~PrimitiveOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); @@ -90,17 +90,17 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { ~RepeatedPrimitiveFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 12faeaf7a0..0adde4e777 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -104,7 +104,8 @@ void SetStringVariables(const FieldDescriptor* descriptor, StringFieldGenerator::StringFieldGenerator(const FieldDescriptor* descriptor, const Options& options) - : FieldGenerator(descriptor, options) { + : FieldGenerator(descriptor, options), + inlined_(IsStringInlined(descriptor, options)) { SetStringVariables(descriptor, &variables_, options); } @@ -112,7 +113,14 @@ StringFieldGenerator::~StringFieldGenerator() {} void StringFieldGenerator::GeneratePrivateMembers(io::Printer* printer) const { Formatter format(printer, variables_); - format("::$proto_ns$::internal::ArenaStringPtr $name$_;\n"); + if (!inlined_) { + format("::$proto_ns$::internal::ArenaStringPtr $name$_;\n"); + } else { + // `_init_inline_xxx` is used for initializing default instances. + format( + "::$proto_ns$::internal::InlinedStringField $name$_;\n" + "static std::true_type _init_inline_$name$_;\n"); + } } void StringFieldGenerator::GenerateStaticMembers(io::Printer* printer) const { @@ -172,8 +180,13 @@ void StringFieldGenerator::GenerateAccessorDeclarations( "const TProtoStringType& _internal_$name$() const;\n" "inline PROTOBUF_ALWAYS_INLINE void " "_internal_set_$name$(const TProtoStringType& value);\n" - "TProtoStringType* _internal_mutable_$name$();\n" - "public:\n"); + "TProtoStringType* _internal_mutable_$name$();\n"); + if (inlined_) { + format( + "inline PROTOBUF_ALWAYS_INLINE bool _internal_$name$_donated() " + "const;\n"); + } + format("public:\n"); if (unknown_ctype) { format.Outdent(); @@ -196,16 +209,36 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions( } format( " return _internal_$name$();\n" - "}\n" - "template <typename ArgT0, typename... ArgT>\n" - "inline PROTOBUF_ALWAYS_INLINE\n" - "void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n" - " $set_hasbit$\n" - " $name$_.$setter$($default_value_tag$, static_cast<ArgT0 &&>(arg0)," - " args..., GetArenaForAllocation());\n" - "$annotate_set$" - " // @@protoc_insertion_point(field_set:$full_name$)\n" - "}\n" + "}\n"); + if (!inlined_) { + format( + "template <typename ArgT0, typename... ArgT>\n" + "inline PROTOBUF_ALWAYS_INLINE\n" + "void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n" + " $set_hasbit$\n" + " $name$_.$setter$($default_value_tag$, static_cast<ArgT0 &&>(arg0)," + " args..., GetArenaForAllocation());\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n"); + } else { + format( + "template <typename ArgT0, typename... ArgT>\n" + "inline PROTOBUF_ALWAYS_INLINE\n" + "void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n" + " $set_hasbit$\n" + " $name$_.$setter$(nullptr, static_cast<ArgT0 &&>(arg0)," + " args..., GetArenaForAllocation(), _internal_$name$_donated(), " + "&$donating_states_word$, $mask_for_undonate$);\n" + "$annotate_set$" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + "}\n" + "inline bool $classname$::_internal_$name$_donated() const {\n" + " bool value = $inlined_string_donated$\n" + " return value;\n" + "}\n"); + } + format( "inline TProtoStringType* $classname$::mutable_$name$() {\n" " TProtoStringType* _s = _internal_mutable_$name$();\n" "$annotate_mutable$" @@ -217,15 +250,34 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions( "}\n" "inline void $classname$::_internal_set_$name$(const TProtoStringType& " "value) {\n" - " $set_hasbit$\n" - " $name$_.Set($default_value_tag$, value, GetArenaForAllocation());\n" - "}\n"); + " $set_hasbit$\n"); + if (!inlined_) { + format( + " $name$_.Set($default_value_tag$, value, GetArenaForAllocation());\n" + "}\n"); + } else { + format( + " $name$_.Set(nullptr, value, GetArenaForAllocation(),\n" + " _internal_$name$_donated(), &$donating_states_word$, " + "$mask_for_undonate$);\n" + "}\n"); + } format( "inline TProtoStringType* $classname$::_internal_mutable_$name$() {\n" - " $set_hasbit$\n" - " return $name$_.Mutable($default_variable_or_tag$, " - "GetArenaForAllocation());\n" - "}\n" + " $set_hasbit$\n"); + if (!inlined_) { + format( + " return $name$_.Mutable($default_variable_or_tag$, " + "GetArenaForAllocation());\n" + "}\n"); + } else { + format( + " return $name$_.Mutable($default_variable_or_tag$, " + "GetArenaForAllocation(), _internal_$name$_donated(), " + "&$donating_states_word$, $mask_for_undonate$);\n" + "}\n"); + } + format( "inline TProtoStringType* $classname$::$release_name$() {\n" "$annotate_release$" " // @@protoc_insertion_point(field_release:$full_name$)\n"); @@ -235,9 +287,16 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions( " if (!_internal_has_$name$()) {\n" " return nullptr;\n" " }\n" - " $clear_hasbit$\n" - " return $name$_.ReleaseNonDefault($init_value$, " - "GetArenaForAllocation());\n"); + " $clear_hasbit$\n"); + if (!inlined_) { + format( + " return $name$_.ReleaseNonDefault($init_value$, " + "GetArenaForAllocation());\n"); + } else { + format( + " return $name$_.Release(nullptr, GetArenaForAllocation(), " + "_internal_$name$_donated());\n"); + } } else { format( " return $name$_.Release($init_value$, GetArenaForAllocation());\n"); @@ -250,9 +309,19 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions( " $set_hasbit$\n" " } else {\n" " $clear_hasbit$\n" - " }\n" - " $name$_.SetAllocated($init_value$, $name$,\n" - " GetArenaForAllocation());\n" + " }\n"); + if (!inlined_) { + format( + " $name$_.SetAllocated($init_value$, $name$,\n" + " GetArenaForAllocation());\n"); + } else { + // Currently, string fields with default value can't be inlined. + format( + " $name$_.SetAllocated(nullptr, $name$, GetArenaForAllocation(), " + "_internal_$name$_donated(), &$donating_states_word$, " + "$mask_for_undonate$);\n"); + } + format( "$annotate_set$" " // @@protoc_insertion_point(field_set_allocated:$full_name$)\n" "}\n"); @@ -274,6 +343,7 @@ void StringFieldGenerator::GenerateClearingCode(io::Printer* printer) const { if (descriptor_->default_value_string().empty()) { format("$name$_.ClearToEmpty();\n"); } else { + GOOGLE_DCHECK(!inlined_); format( "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n"); } @@ -292,6 +362,18 @@ void StringFieldGenerator::GenerateMessageClearingCode( // checks against the default variable. const bool must_be_present = HasHasbit(descriptor_); + if (inlined_ && must_be_present) { + // Calling mutable_$name$() gives us a string reference and sets the has bit + // for $name$ (in proto2). We may get here when the string field is inlined + // but the string's contents have not been changed by the user, so we cannot + // make an assertion about the contents of the string and could never make + // an assertion about the string instance. + // + // For non-inlined strings, we distinguish from non-default by comparing + // instances, rather than contents. + format("$DCHK$(!$name$_.IsDefault(nullptr));\n"); + } + if (descriptor_->default_value_string().empty()) { if (must_be_present) { format("$name$_.ClearNonDefaultToEmpty();\n"); @@ -314,16 +396,31 @@ void StringFieldGenerator::GenerateMergingCode(io::Printer* printer) const { void StringFieldGenerator::GenerateSwappingCode(io::Printer* printer) const { Formatter format(printer, variables_); - format( - "::$proto_ns$::internal::ArenaStringPtr::InternalSwap(\n" - " $init_value$,\n" - " &$name$_, GetArenaForAllocation(),\n" - " &other->$name$_, other->GetArenaForAllocation()\n" - ");\n"); + if (!inlined_) { + format( + "::$proto_ns$::internal::ArenaStringPtr::InternalSwap(\n" + " $init_value$,\n" + " &$name$_, lhs_arena,\n" + " &other->$name$_, rhs_arena\n" + ");\n"); + } else { + // At this point, it's guaranteed that the two fields being swapped are on + // the same arena. + format( + "$name$_.Swap(&other->$name$_, nullptr, GetArenaForAllocation(), " + "_internal_$name$_donated(), other->_internal_$name$_donated(), " + "&$donating_states_word$, &(other->$donating_states_word$), " + "$mask_for_undonate$);\n"); + } } void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const { Formatter format(printer, variables_); + if (inlined_ && descriptor_->default_value_string().empty()) { + // Automatic initialization will construct the string. + return; + } + GOOGLE_DCHECK(!inlined_); format("$name$_.UnsafeSetDefault($init_value$);\n"); } @@ -340,10 +437,16 @@ void StringFieldGenerator::GenerateCopyConstructorCode( format.Indent(); - // TODO(gpike): improve this - format( - "$name$_.Set($default_value_tag$, from._internal_$name$(), \n" - " GetArenaForAllocation());\n"); + if (!inlined_) { + format( + "$name$_.Set($default_value_tag$, from._internal_$name$(), \n" + " GetArenaForAllocation());\n"); + } else { + format( + "$name$_.Set(nullptr, from._internal_$name$(),\n" + " GetArenaForAllocation(), _internal_$name$_donated(), " + "&$donating_states_word$, $mask_for_undonate$);\n"); + } format.Outdent(); format("}\n"); @@ -351,6 +454,11 @@ void StringFieldGenerator::GenerateCopyConstructorCode( void StringFieldGenerator::GenerateDestructorCode(io::Printer* printer) const { Formatter format(printer, variables_); + if (inlined_) { + // The destructor is automatically invoked. + return; + } + format("$name$_.DestroyNoArena($init_value$);\n"); } @@ -380,6 +488,10 @@ void StringFieldGenerator::GenerateByteSize(io::Printer* printer) const { void StringFieldGenerator::GenerateConstinitInitializer( io::Printer* printer) const { Formatter format(printer, variables_); + if (inlined_) { + format("$name$_(nullptr, false)"); + return; + } if (descriptor_->default_value_string().empty()) { format("$name$_(&::$proto_ns$::internal::fixed_address_empty_string)"); } else { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.h index 213f13465d..85689bbec8 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_string_field.h @@ -51,23 +51,25 @@ class StringFieldGenerator : public FieldGenerator { ~StringFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateStaticMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateDestructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateStaticMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateDestructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; + bool IsInlined() const override { return inlined_; } private: + bool inlined_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); }; @@ -78,14 +80,14 @@ class StringOneofFieldGenerator : public StringFieldGenerator { ~StringOneofFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; // StringFieldGenerator, from which we inherit, overrides this so we need to // override it as well. - void GenerateMessageClearingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; + void GenerateMessageClearingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOneofFieldGenerator); @@ -98,17 +100,17 @@ class RepeatedStringFieldGenerator : public FieldGenerator { ~RepeatedStringFieldGenerator(); // implements FieldGenerator --------------------------------------- - void GeneratePrivateMembers(io::Printer* printer) const; - void GenerateAccessorDeclarations(io::Printer* printer) const; - void GenerateInlineAccessorDefinitions(io::Printer* printer) const; - void GenerateClearingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateSwappingCode(io::Printer* printer) const; - void GenerateConstructorCode(io::Printer* printer) const; - void GenerateCopyConstructorCode(io::Printer* printer) const; - void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; - void GenerateByteSize(io::Printer* printer) const; - void GenerateConstinitInitializer(io::Printer* printer) const; + void GeneratePrivateMembers(io::Printer* printer) const override; + void GenerateAccessorDeclarations(io::Printer* printer) const override; + void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; + void GenerateClearingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateSwappingCode(io::Printer* printer) const override; + void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateCopyConstructorCode(io::Printer* printer) const override; + void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override; + void GenerateByteSize(io::Printer* printer) const override; + void GenerateConstinitInitializer(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedStringFieldGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum.cc b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum.cc index a16ca71151..c0ee9ef191 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -48,7 +48,7 @@ namespace compiler { namespace csharp { EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor, const Options* options) : - SourceGeneratorBase(descriptor->file(), options), + SourceGeneratorBase(options), descriptor_(descriptor) { } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum_field.h index 9f1a2ea777..e282d72390 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_enum_field.h @@ -51,11 +51,11 @@ class EnumFieldGenerator : public PrimitiveFieldGenerator { EnumFieldGenerator(const EnumFieldGenerator&) = delete; EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; }; class EnumOneofFieldGenerator : public PrimitiveOneofFieldGenerator { @@ -68,10 +68,10 @@ class EnumOneofFieldGenerator : public PrimitiveOneofFieldGenerator { EnumOneofFieldGenerator(const EnumOneofFieldGenerator&) = delete; EnumOneofFieldGenerator& operator=(const EnumOneofFieldGenerator&) = delete; - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_field_base.cc index d0b10213a0..5e97b46441 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_field_base.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -137,7 +137,7 @@ void FieldGeneratorBase::SetCommonOneofFieldVariables( FieldGeneratorBase::FieldGeneratorBase(const FieldDescriptor* descriptor, int presenceIndex, const Options* options) - : SourceGeneratorBase(descriptor->file(), options), + : SourceGeneratorBase(options), descriptor_(descriptor), presenceIndex_(presenceIndex) { SetCommonFieldVariables(&variables_); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_map_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_map_field.h index 54156ecf54..9b5e214e6d 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_map_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_map_field.h @@ -51,19 +51,19 @@ class MapFieldGenerator : public FieldGeneratorBase { MapFieldGenerator(const MapFieldGenerator&) = delete; MapFieldGenerator& operator=(const MapFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); - virtual void GenerateSerializedSizeCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message.cc b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message.cc index 29c31bfef2..f3e2eff8a1 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -60,7 +60,7 @@ bool CompareFieldNumbers(const FieldDescriptor* d1, const FieldDescriptor* d2) { MessageGenerator::MessageGenerator(const Descriptor* descriptor, const Options* options) - : SourceGeneratorBase(descriptor->file(), options), + : SourceGeneratorBase(options), descriptor_(descriptor), has_bit_field_count_(0), end_tag_(GetGroupEndTag(descriptor)), diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message_field.h index 2463d912ba..1436fe2008 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_message_field.h @@ -51,19 +51,19 @@ class MessageFieldGenerator : public FieldGeneratorBase { MessageFieldGenerator(const MessageFieldGenerator&) = delete; MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; class MessageOneofFieldGenerator : public MessageFieldGenerator { @@ -77,11 +77,11 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { MessageOneofFieldGenerator& operator=(const MessageOneofFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_primitive_field.h index 5edcc42b7b..a2c11050e2 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_primitive_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_primitive_field.h @@ -53,18 +53,18 @@ class PrimitiveFieldGenerator : public FieldGeneratorBase { PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); - - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; + + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; protected: bool is_value_type; @@ -81,11 +81,11 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { PrimitiveOneofFieldGenerator& operator=(const PrimitiveOneofFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc index bd60ba6eb9..d462273c4a 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc @@ -53,7 +53,7 @@ namespace csharp { ReflectionClassGenerator::ReflectionClassGenerator(const FileDescriptor* file, const Options* options) - : SourceGeneratorBase(file, options), + : SourceGeneratorBase(options), file_(file) { namespace_ = GetFileNamespace(file); reflectionClassname_ = GetReflectionClassUnqualifiedName(file); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h index 9b9ebd48fa..2e265702fb 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h @@ -54,20 +54,20 @@ class RepeatedEnumFieldGenerator : public FieldGeneratorBase { RepeatedEnumFieldGenerator& operator=(const RepeatedEnumFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h index 90441b82ef..a2267adf3d 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h @@ -54,20 +54,20 @@ class RepeatedMessageFieldGenerator : public FieldGeneratorBase { RepeatedMessageFieldGenerator& operator=( const RepeatedMessageFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h index 23e77a9a2e..d432f37b2f 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h @@ -50,20 +50,20 @@ class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase { RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) = delete; RepeatedPrimitiveFieldGenerator& operator=(const RepeatedPrimitiveFieldGenerator&) = delete; - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateFreezingCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateFreezingCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc index 92c427c1ac..91af159a7b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc @@ -46,9 +46,8 @@ namespace protobuf { namespace compiler { namespace csharp { -SourceGeneratorBase::SourceGeneratorBase(const FileDescriptor* descriptor, - const Options *options) - : descriptor_(descriptor), options_(options) { +SourceGeneratorBase::SourceGeneratorBase( + const Options *options) : options_(options) { } SourceGeneratorBase::~SourceGeneratorBase() { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h index 9686e89716..5938d5d1fd 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h @@ -45,7 +45,7 @@ struct Options; class SourceGeneratorBase { protected: - SourceGeneratorBase(const FileDescriptor* descriptor, const Options* options); + SourceGeneratorBase(const Options* options); virtual ~SourceGeneratorBase(); SourceGeneratorBase(const SourceGeneratorBase&) = delete; @@ -59,7 +59,6 @@ class SourceGeneratorBase { void WriteGeneratedCodeAttributes(io::Printer* printer); private: - const FileDescriptor* descriptor_; const Options *options_; }; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h index e9bd043f22..57c4f5e76b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h @@ -53,20 +53,20 @@ class WrapperFieldGenerator : public FieldGeneratorBase { WrapperFieldGenerator(const WrapperFieldGenerator&) = delete; WrapperFieldGenerator& operator=(const WrapperFieldGenerator&) = delete; - virtual void GenerateCodecCode(io::Printer* printer); - virtual void GenerateCloningCode(io::Printer* printer); - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); - virtual void GenerateSerializedSizeCode(io::Printer* printer); - virtual void GenerateExtensionCode(io::Printer* printer); + virtual void GenerateCodecCode(io::Printer* printer) override; + virtual void GenerateCloningCode(io::Printer* printer) override; + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; + virtual void GenerateExtensionCode(io::Printer* printer) override; - virtual void WriteHash(io::Printer* printer); - virtual void WriteEquals(io::Printer* printer); - virtual void WriteToString(io::Printer* printer); + virtual void WriteHash(io::Printer* printer) override; + virtual void WriteEquals(io::Printer* printer) override; + virtual void WriteToString(io::Printer* printer) override; private: bool is_value_type; // True for int32 etc; false for bytes and string @@ -82,13 +82,13 @@ class WrapperOneofFieldGenerator : public WrapperFieldGenerator { WrapperOneofFieldGenerator(const WrapperOneofFieldGenerator&) = delete; WrapperOneofFieldGenerator& operator=(const WrapperOneofFieldGenerator&) = delete; - virtual void GenerateMembers(io::Printer* printer); - virtual void GenerateMergingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer); - virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context); - virtual void GenerateSerializationCode(io::Printer* printer); - virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context); - virtual void GenerateSerializedSizeCode(io::Printer* printer); + virtual void GenerateMembers(io::Printer* printer) override; + virtual void GenerateMergingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer) override; + virtual void GenerateParsingCode(io::Printer* printer, bool use_parse_context) override; + virtual void GenerateSerializationCode(io::Printer* printer) override; + virtual void GenerateSerializationCode(io::Printer* printer, bool use_write_context) override; + virtual void GenerateSerializedSizeCode(io::Printer* printer) override; }; } // namespace csharp diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc b/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc index 2fdbf5ce1f..fd6d5eb766 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc @@ -290,11 +290,11 @@ static TProtoStringType CanonicalizePath(TProtoStringType path) { std::vector<TProtoStringType> canonical_parts; std::vector<TProtoStringType> parts = Split( path, "/", true); // Note: Removes empty parts. - for (int i = 0; i < parts.size(); i++) { - if (parts[i] == ".") { + for (const TProtoStringType& part : parts) { + if (part == ".") { // Ignore. } else { - canonical_parts.push_back(parts[i]); + canonical_parts.push_back(part); } } TProtoStringType result = Join(canonical_parts, "/"); @@ -464,10 +464,10 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile( return NULL; } - for (int i = 0; i < mappings_.size(); i++) { + for (const auto& mapping : mappings_) { TProtoStringType temp_disk_file; - if (ApplyMapping(virtual_file, mappings_[i].virtual_path, - mappings_[i].disk_path, &temp_disk_file)) { + if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path, + &temp_disk_file)) { io::ZeroCopyInputStream* stream = OpenDiskFile(temp_disk_file); if (stream != NULL) { if (disk_file != NULL) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.h index 13414bd8db..5d3564530e 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.h @@ -101,15 +101,15 @@ class ImmutableEnumOneofFieldGenerator : public ImmutableEnumFieldGenerator { Context* context); ~ImmutableEnumOneofFieldGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumOneofFieldGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc index e94f70289b..91b6b4842e 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field_lite.cc @@ -569,9 +569,14 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateMembers( WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_GETTER); printer->Print( variables_, + // NB: Do not use the "$name$_converter_" field; the usage of generics + // (and requisite upcasts to Object) prevent optimizations. Even + // without any optimizations, the below code is cheaper because it + // avoids boxing an int and a checkcast from the generics. "@java.lang.Override\n" "$deprecation$public $type$ ${$get$capitalized_name$$}$(int index) {\n" - " return $name$_converter_.convert($name$_.getInt(index));\n" + " $type$ result = $type$.forNumber($name$_.getInt(index));\n" + " return result == null ? $unknown$ : result;\n" "}\n"); printer->Annotate("{", "}", descriptor_); if (SupportUnknownEnumValue(descriptor_->file())) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension.h index 76defbb8cb..c08f12f75c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension.h @@ -94,9 +94,9 @@ class ImmutableExtensionGenerator : public ExtensionGenerator { Context* context); virtual ~ImmutableExtensionGenerator(); - virtual void Generate(io::Printer* printer); - virtual int GenerateNonNestedInitializationCode(io::Printer* printer); - virtual int GenerateRegistrationCode(io::Printer* printer); + virtual void Generate(io::Printer* printer) override; + virtual int GenerateNonNestedInitializationCode(io::Printer* printer) override; + virtual int GenerateRegistrationCode(io::Printer* printer) override; protected: const FieldDescriptor* descriptor_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension_lite.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension_lite.h index 8912d4ea56..af835946b9 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension_lite.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_extension_lite.h @@ -51,13 +51,14 @@ class ImmutableExtensionLiteGenerator : public ExtensionGenerator { Context* context); virtual ~ImmutableExtensionLiteGenerator(); - virtual void Generate(io::Printer* printer); + virtual void Generate(io::Printer* printer) override; // Returns an estimate of the number of bytes the printed code will compile to - virtual int GenerateNonNestedInitializationCode(io::Printer* printer); + virtual int GenerateNonNestedInitializationCode( + io::Printer* printer) override; // Returns an estimate of the number of bytes the printed code will compile to - virtual int GenerateRegistrationCode(io::Printer* printer); + virtual int GenerateRegistrationCode(io::Printer* printer) override; private: const FieldDescriptor* descriptor_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator_factory.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator_factory.h index 16688a56d0..e64a45dd49 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator_factory.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator_factory.h @@ -81,13 +81,13 @@ class ImmutableGeneratorFactory : public GeneratorFactory { virtual ~ImmutableGeneratorFactory(); virtual MessageGenerator* NewMessageGenerator( - const Descriptor* descriptor) const; + const Descriptor* descriptor) const override; virtual ExtensionGenerator* NewExtensionGenerator( - const FieldDescriptor* descriptor) const; + const FieldDescriptor* descriptor) const override; virtual ServiceGenerator* NewServiceGenerator( - const ServiceDescriptor* descriptor) const; + const ServiceDescriptor* descriptor) const override; private: Context* context_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.h index d4bfbfe132..1d2b7ad398 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.h @@ -65,7 +65,7 @@ class ImmutableMapFieldGenerator : public ImmutableFieldGenerator { void GenerateHashCode(io::Printer* printer) const override; void GenerateKotlinDslMembers(io::Printer* printer) const override; - TProtoStringType GetBoxedType() const; + TProtoStringType GetBoxedType() const override; private: const FieldDescriptor* descriptor_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc index 029d886cde..3cc9c24e90 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc @@ -316,7 +316,6 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { WriteMessageDocComment(printer, descriptor_); MaybePrintGeneratedAnnotation(context_, printer, descriptor_, /* immutable = */ true); - // The builder_type stores the super type name of the nested Builder class. TProtoStringType builder_type; if (descriptor_->extension_range_count() > 0) { @@ -1409,7 +1408,7 @@ void ImmutableMessageGenerator::GenerateKotlinDsl(io::Printer* printer) const { "@com.google.protobuf.kotlin.ProtoDslMarker\n"); printer->Print( "class Dsl private constructor(\n" - " @kotlin.jvm.JvmField private val _builder: $message$.Builder\n" + " private val _builder: $message$.Builder\n" ") {\n" " companion object {\n" " @kotlin.jvm.JvmSynthetic\n" @@ -1457,7 +1456,7 @@ void ImmutableMessageGenerator::GenerateKotlinMembers( io::Printer* printer) const { printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> Unit): " + "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> kotlin.Unit): " "$message$ " "=\n" " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() " @@ -1482,7 +1481,7 @@ void ImmutableMessageGenerator::GenerateTopLevelKotlinMembers( io::Printer* printer) const { printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun $message$.copy(block: $message_kt$.Dsl.() -> Unit): " + "inline fun $message$.copy(block: $message_kt$.Dsl.() -> kotlin.Unit): " "$message$ =\n" " $message_kt$.Dsl._create(this.toBuilder()).apply { block() " "}._build()\n", diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.h index 2716498328..9674ab425e 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.h @@ -65,25 +65,25 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator { // implements ImmutableFieldGenerator // --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - void GenerateKotlinDslMembers(io::Printer* printer) const; - - TProtoStringType GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateParsingCode(io::Printer* printer) const override; + void GenerateParsingDoneCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode(io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + TProtoStringType GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -111,13 +111,13 @@ class ImmutableMessageOneofFieldGenerator Context* context); ~ImmutableMessageOneofFieldGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.h index 22a12ce857..9f778da45b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.h @@ -66,16 +66,16 @@ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator { // implements ImmutableFieldLiteGenerator // ------------------------------------ - int GetNumBitsForMessage() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; + int GetNumBitsForMessage() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector<uint16_t>* output) const; - void GenerateKotlinDslMembers(io::Printer* printer) const; + std::vector<uint16_t>* output) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; - TProtoStringType GetBoxedType() const; + TProtoStringType GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -95,10 +95,10 @@ class ImmutableMessageOneofFieldLiteGenerator Context* context); ~ImmutableMessageOneofFieldLiteGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector<uint16_t>* output) const; + std::vector<uint16_t>* output) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldLiteGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.cc index bec5a7f47c..bb8bcf7a95 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.cc @@ -732,7 +732,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinDsl( "@com.google.protobuf.kotlin.ProtoDslMarker\n"); printer->Print( "class Dsl private constructor(\n" - " @kotlin.jvm.JvmField private val _builder: $message$.Builder\n" + " private val _builder: $message$.Builder\n" ") {\n" " companion object {\n" " @kotlin.jvm.JvmSynthetic\n" @@ -780,7 +780,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( io::Printer* printer) const { printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> Unit): " + "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> kotlin.Unit): " "$message$ =\n" " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() " "}._build()\n", @@ -803,7 +803,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( void ImmutableMessageLiteGenerator::GenerateTopLevelKotlinMembers( io::Printer* printer) const { printer->Print( - "inline fun $message$.copy(block: $message_kt$.Dsl.() -> Unit): " + "inline fun $message$.copy(block: $message_kt$.Dsl.() -> kotlin.Unit): " "$message$ =\n" " $message_kt$.Dsl._create(this.toBuilder()).apply { block() " "}._build()\n", diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.h index 4dfa291314..0af0cb8ad2 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_lite.h @@ -50,12 +50,12 @@ class ImmutableMessageLiteGenerator : public MessageGenerator { ImmutableMessageLiteGenerator(const Descriptor* descriptor, Context* context); virtual ~ImmutableMessageLiteGenerator(); - virtual void Generate(io::Printer* printer); - virtual void GenerateInterface(io::Printer* printer); - virtual void GenerateExtensionRegistrationCode(io::Printer* printer); + virtual void Generate(io::Printer* printer) override; + virtual void GenerateInterface(io::Printer* printer) override; + virtual void GenerateExtensionRegistrationCode(io::Printer* printer) override; virtual void GenerateStaticVariables(io::Printer* printer, - int* bytecode_estimate); - virtual int GenerateStaticVariableInitializers(io::Printer* printer); + int* bytecode_estimate) override; + virtual int GenerateStaticVariableInitializers(io::Printer* printer) override; void GenerateKotlinDsl(io::Printer* printer) const override; void GenerateKotlinMembers(io::Printer* printer) const override; void GenerateTopLevelKotlinMembers(io::Printer* printer) const override; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.h index b90ea89257..f04fd0f7b5 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.h @@ -103,13 +103,13 @@ class ImmutablePrimitiveOneofFieldGenerator int builderBitIndex, Context* context); ~ImmutablePrimitiveOneofFieldGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.h index 1359c358df..445012e0e3 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.h @@ -95,11 +95,11 @@ class ImmutablePrimitiveOneofFieldLiteGenerator Context* context); ~ImmutablePrimitiveOneofFieldLiteGenerator(); - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; void GenerateFieldInfo(io::Printer* printer, - std::vector<uint16_t>* output) const; + std::vector<uint16_t>* output) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldLiteGenerator); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_service.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_service.h index e3d52a40ca..7314f340d9 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_service.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_service.h @@ -80,7 +80,7 @@ class ImmutableServiceGenerator : public ServiceGenerator { Context* context); virtual ~ImmutableServiceGenerator(); - virtual void Generate(io::Printer* printer); + virtual void Generate(io::Printer* printer) override; private: // Generate the getDescriptorForType() method. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc index e0019a5ffe..ac17bb77fd 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.cc @@ -80,6 +80,8 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, " if (value == null) {\n" " throw new NullPointerException();\n" " }\n"; + (*variables)["isStringEmpty"] = "com.google.protobuf.GeneratedMessage" + + GeneratedCodeVersionSuffix() + ".isStringEmpty"; (*variables)["writeString"] = "com.google.protobuf.GeneratedMessage" + GeneratedCodeVersionSuffix() + ".writeString"; (*variables)["computeStringSize"] = "com.google.protobuf.GeneratedMessage" + @@ -117,7 +119,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["clear_has_field_bit_builder"] = ""; (*variables)["is_field_present_message"] = - "!get" + (*variables)["capitalized_name"] + "Bytes().isEmpty()"; + "!" + (*variables)["isStringEmpty"] + "(" + (*variables)["name"] + "_)"; } // For repeated builders, one bit is used for whether the array is immutable. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.h index d209975918..680e77252c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field.h @@ -65,25 +65,25 @@ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator { // implements ImmutableFieldGenerator // --------------------------------------- - int GetNumBitsForMessage() const; - int GetNumBitsForBuilder() const; - void GenerateInterfaceMembers(io::Printer* printer) const; - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateInitializationCode(io::Printer* printer) const; - void GenerateBuilderClearCode(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateParsingDoneCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; - void GenerateFieldBuilderInitializationCode(io::Printer* printer) const; - void GenerateEqualsCode(io::Printer* printer) const; - void GenerateHashCode(io::Printer* printer) const; - void GenerateKotlinDslMembers(io::Printer* printer) const; - - TProtoStringType GetBoxedType() const; + int GetNumBitsForMessage() const override; + int GetNumBitsForBuilder() const override; + void GenerateInterfaceMembers(io::Printer* printer) const override; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateInitializationCode(io::Printer* printer) const override; + void GenerateBuilderClearCode(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateParsingCode(io::Printer* printer) const override; + void GenerateParsingDoneCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; + void GenerateFieldBuilderInitializationCode(io::Printer* printer) const override; + void GenerateEqualsCode(io::Printer* printer) const override; + void GenerateHashCode(io::Printer* printer) const override; + void GenerateKotlinDslMembers(io::Printer* printer) const override; + + TProtoStringType GetBoxedType() const override; protected: const FieldDescriptor* descriptor_; @@ -103,13 +103,13 @@ class ImmutableStringOneofFieldGenerator ~ImmutableStringOneofFieldGenerator(); private: - void GenerateMembers(io::Printer* printer) const; - void GenerateBuilderMembers(io::Printer* printer) const; - void GenerateMergingCode(io::Printer* printer) const; - void GenerateBuildingCode(io::Printer* printer) const; - void GenerateParsingCode(io::Printer* printer) const; - void GenerateSerializationCode(io::Printer* printer) const; - void GenerateSerializedSizeCode(io::Printer* printer) const; + void GenerateMembers(io::Printer* printer) const override; + void GenerateBuilderMembers(io::Printer* printer) const override; + void GenerateMergingCode(io::Printer* printer) const override; + void GenerateBuildingCode(io::Printer* printer) const override; + void GenerateParsingCode(io::Printer* printer) const override; + void GenerateSerializationCode(io::Printer* printer) const override; + void GenerateSerializedSizeCode(io::Printer* printer) const override; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldGenerator); }; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.cc index 521bcd0226..ac334018df 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.cc @@ -94,10 +94,6 @@ bool IsReserved(const TProtoStringType& ident) { return false; } -bool StrEndsWith(StringPiece sp, StringPiece x) { - return sp.size() >= x.size() && sp.substr(sp.size() - x.size()) == x; -} - TProtoStringType GetSnakeFilename(const TProtoStringType& filename) { TProtoStringType snake_name = filename; ReplaceCharacters(&snake_name, "/", '_'); @@ -1412,24 +1408,17 @@ bool HasFieldPresence(const GeneratorOptions& options, // were the final one for a given filename. class FileDeduplicator { public: - explicit FileDeduplicator(const GeneratorOptions& options) - : error_on_conflict_(options.error_on_name_conflict) {} + explicit FileDeduplicator(const GeneratorOptions& options) {} // params: // filenames: a pair of {short filename, full filename} // (short filename don't have extra information, full filename // contains extra information) // desc: The Descriptor or SCC pointer or EnumDescriptor. - // error: The returned error information. bool AddFile(const std::pair<TProtoStringType, TProtoStringType> filenames, - const void* desc, TProtoStringType* error) { + const void* desc) { if (descs_by_shortname_.find(filenames.first) != descs_by_shortname_.end()) { - if (error_on_conflict_) { - *error = "Name conflict: file name " + filenames.first + - " would be generated by two descriptors"; - return false; - } // Change old pointer's actual name to full name. auto short_name_desc = descs_by_shortname_[filenames.first]; allowed_descs_actual_name_[short_name_desc] = @@ -1447,7 +1436,6 @@ class FileDeduplicator { } private: - bool error_on_conflict_; // The map that restores all the descs that are using short name as filename. std::map<TProtoStringType, const void*> descs_by_shortname_; // The final actual filename map. @@ -1541,8 +1529,7 @@ struct DepsGenerator { bool GenerateJspbAllowedMap(const GeneratorOptions& options, const std::vector<const FileDescriptor*>& files, std::map<const void*, TProtoStringType>* allowed_set, - SCCAnalyzer<DepsGenerator>* analyzer, - TProtoStringType* error) { + SCCAnalyzer<DepsGenerator>* analyzer) { std::vector<const FileDescriptor*> files_ordered; GenerateJspbFileOrder(files, &files_ordered); @@ -1557,7 +1544,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options, std::make_pair( GetMessagesFileName(options, analyzer->GetSCC(desc), false), GetMessagesFileName(options, analyzer->GetSCC(desc), true)), - analyzer->GetSCC(desc), error)) { + analyzer->GetSCC(desc))) { return false; } } @@ -1565,7 +1552,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options, const EnumDescriptor* desc = files_ordered[i]->enum_type(j); if (!dedup.AddFile(std::make_pair(GetEnumFileName(options, desc, false), GetEnumFileName(options, desc, true)), - desc, error)) { + desc)) { return false; } } @@ -1584,7 +1571,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options, std::make_pair( GetExtensionFileName(options, files_ordered[i], false), GetExtensionFileName(options, files_ordered[i], true)), - files_ordered[i], error)) { + files_ordered[i])) { return false; } } @@ -3477,12 +3464,10 @@ bool GeneratorOptions::ParseFromOptions( return false; } testonly = true; + } else if (options[i].first == "error_on_name_conflict") { - if (options[i].second != "") { - *error = "Unexpected option value for error_on_name_conflict"; - return false; - } - error_on_name_conflict = true; + GOOGLE_LOG(WARNING) << "Ignoring error_on_name_conflict option, this " + "will be removed in a future release"; } else if (options[i].first == "output_dir") { output_dir = options[i].second; } else if (options[i].first == "namespace_prefix") { @@ -3531,11 +3516,10 @@ bool GeneratorOptions::ParseFromOptions( if (import_style != kImportClosure && (add_require_for_enums || testonly || !library.empty() || - error_on_name_conflict || extension != ".js" || - one_output_file_per_input_file)) { + extension != ".js" || one_output_file_per_input_file)) { *error = - "The add_require_for_enums, testonly, library, error_on_name_conflict, " - "extension, and one_output_file_per_input_file options should only be " + "The add_require_for_enums, testonly, library, extension, and " + "one_output_file_per_input_file options should only be " "used for import_style=closure"; return false; } @@ -3770,8 +3754,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files, std::set<const Descriptor*> have_printed; SCCAnalyzer<DepsGenerator> analyzer; std::map<const void*, TProtoStringType> allowed_map; - if (!GenerateJspbAllowedMap(options, files, &allowed_map, &analyzer, - error)) { + if (!GenerateJspbAllowedMap(options, files, &allowed_map, &analyzer)) { return false; } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.h index 4e6c89b019..6486382e63 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/js/js_generator.h @@ -83,7 +83,6 @@ struct GeneratorOptions { add_require_for_enums(false), testonly(false), library(""), - error_on_name_conflict(false), extension(".js"), one_output_file_per_input_file(false), annotate_code(false) {} @@ -119,8 +118,6 @@ struct GeneratorOptions { // Create a library with name <name>_lib.js rather than a separate .js file // per type? TProtoStringType library; - // Error if there are two types that would generate the same output file? - bool error_on_name_conflict; // The extension to use for output file names. TProtoStringType extension; // Create a separate output file for each input file? diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h index 7016c8022c..89d3e6907c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h @@ -48,10 +48,12 @@ class EnumFieldGenerator : public SingleFieldGenerator { EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete; public: - virtual void GenerateCFunctionDeclarations(io::Printer* printer) const; - virtual void GenerateCFunctionImplementations(io::Printer* printer) const; + virtual void GenerateCFunctionDeclarations( + io::Printer* printer) const override; + virtual void GenerateCFunctionImplementations( + io::Printer* printer) const override; virtual void DetermineForwardDeclarations( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; protected: EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); @@ -63,7 +65,7 @@ class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator { const Options& options); public: - virtual void FinishInitialization(); + virtual void FinishInitialization() override; protected: RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_field.h index 24c64dbc05..b2d2e676b1 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_field.h @@ -112,12 +112,12 @@ class SingleFieldGenerator : public FieldGenerator { SingleFieldGenerator(const SingleFieldGenerator&) = delete; SingleFieldGenerator& operator=(const SingleFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; + virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyImplementation(io::Printer* printer) const; + virtual void GeneratePropertyImplementation(io::Printer* printer) const override; - virtual bool RuntimeUsesHasBit(void) const; + virtual bool RuntimeUsesHasBit(void) const override; protected: SingleFieldGenerator(const FieldDescriptor* descriptor, @@ -132,8 +132,8 @@ class ObjCObjFieldGenerator : public SingleFieldGenerator { ObjCObjFieldGenerator(const ObjCObjFieldGenerator&) = delete; ObjCObjFieldGenerator& operator=(const ObjCObjFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; + virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; protected: ObjCObjFieldGenerator(const FieldDescriptor* descriptor, @@ -147,17 +147,17 @@ class RepeatedFieldGenerator : public ObjCObjFieldGenerator { RepeatedFieldGenerator(const RepeatedFieldGenerator&) = delete; RepeatedFieldGenerator& operator=(const RepeatedFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; - virtual void GeneratePropertyDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; + virtual void GeneratePropertyDeclaration(io::Printer* printer) const override; - virtual void GeneratePropertyImplementation(io::Printer* printer) const; + virtual void GeneratePropertyImplementation(io::Printer* printer) const override; - virtual bool RuntimeUsesHasBit(void) const; + virtual bool RuntimeUsesHasBit(void) const override; protected: RepeatedFieldGenerator(const FieldDescriptor* descriptor, const Options& options); - virtual void FinishInitialization(void); + virtual void FinishInitialization(void) override; }; // Convenience class which constructs FieldGenerators for a Descriptor. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h index c1f6cb19de..6bd747ac5e 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h @@ -58,8 +58,6 @@ class FileGenerator { void GenerateSource(io::Printer* printer); void GenerateHeader(io::Printer* printer); - const TProtoStringType& RootClassName() const { return root_class_name_; } - private: const FileDescriptor* file_; TProtoStringType root_class_name_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_generator.cc index 2157896253..371234aafe 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_generator.cc @@ -28,8 +28,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include <fstream> #include <iostream> #include <string> +#include <unordered_set> #include <google/protobuf/compiler/objectivec/objectivec_generator.h> #include <google/protobuf/compiler/objectivec/objectivec_file.h> #include <google/protobuf/compiler/objectivec/objectivec_helpers.h> @@ -138,6 +140,34 @@ bool ObjectiveCGenerator::GenerateAll( // header search path since the generate #import will be more complete. generation_options.runtime_import_prefix = StripSuffixString(options[i].second, "/"); + } else if (options[i].first == "use_package_as_prefix") { + // Controls how the symbols should be prefixed to avoid symbols + // collisions. The objc_class_prefix file option is always honored, this + // is just what to do if that isn't set. The available options are: + // "no": Not prefixed (the existing mode). + // "yes": Make a prefix out of the proto package. + TProtoStringType upper_value(options[i].second); + UpperString(&upper_value); + if (upper_value == "NO") { + SetUseProtoPackageAsDefaultPrefix(false); + } else if (upper_value == "YES") { + SetUseProtoPackageAsDefaultPrefix(true); + } else { + *error = "error: Unknown use_package_as_prefix: " + options[i].second; + return false; + } + } else if (options[i].first == "proto_package_prefix_exceptions_path") { + // Path to find a file containing the list of proto package names that are + // exceptions when use_package_as_prefix is enabled. This can be used to + // migrate packages one at a time to use_package_as_prefix since there + // are likely code updates needed with each one. + // + // The format of the file is: + // - An entry is a line of "proto.package.name". + // - Comments start with "#". + // - A comment can go on a line after a expected package/prefix pair. + // (i.e. - "some.proto.package # comment") + SetProtoPackagePrefixExceptionList(options[i].second); } else { *error = "error: Unknown generator option: " + options[i].first; return false; @@ -146,6 +176,25 @@ bool ObjectiveCGenerator::GenerateAll( // ----------------------------------------------------------------- + // These are not official generation options and could be removed/changed in + // the future and doing that won't count as a breaking change. + bool headers_only = getenv("GPB_OBJC_HEADERS_ONLY") != NULL; + std::unordered_set<TProtoStringType> skip_impls; + if (getenv("GPB_OBJC_SKIP_IMPLS_FILE") != NULL) { + std::ifstream skip_file(getenv("GPB_OBJC_SKIP_IMPLS_FILE")); + if (skip_file.is_open()) { + std::string line; + while (std::getline(skip_file, line)) { + skip_impls.insert(line.c_str()); + } + } else { + *error = "error: Failed to open GPB_OBJC_SKIP_IMPLS_FILE file"; + return false; + } + } + + // ----------------------------------------------------------------- + // Validate the objc prefix/package pairings. if (!ValidateObjCClassPrefixes(files, generation_options, error)) { // *error will have been filled in. @@ -166,7 +215,7 @@ bool ObjectiveCGenerator::GenerateAll( } // Generate m file. - { + if (!headers_only && skip_impls.count(file->name()) == 0) { std::unique_ptr<io::ZeroCopyOutputStream> output( context->Open(filepath + ".pbobjc.m")); io::Printer printer(output.get(), '$'); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index dbcc4ce110..bbcfbdd2bc 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -72,6 +72,102 @@ using ::open; #endif } // namespace port +namespace { + +class SimpleLineCollector : public LineConsumer { + public: + SimpleLineCollector(std::unordered_set<TProtoStringType>* inout_set) + : set_(inout_set) {} + + virtual bool ConsumeLine(const StringPiece& line, TProtoStringType* out_error) override { + set_->insert(TProtoStringType(line)); + return true; + } + + private: + std::unordered_set<TProtoStringType>* set_; +}; + +class PrefixModeStorage { + public: + PrefixModeStorage(); + + bool use_package_name() const { return use_package_name_; } + void set_use_package_name(bool on_or_off) { use_package_name_ = on_or_off; } + + const TProtoStringType exception_path() const { return exception_path_; } + void set_exception_path(const TProtoStringType& path) { + exception_path_ = path; + exceptions_.clear(); + } + + bool is_package_exempted(const TProtoStringType& package); + + private: + bool use_package_name_; + TProtoStringType exception_path_; + std::unordered_set<TProtoStringType> exceptions_; +}; + +PrefixModeStorage::PrefixModeStorage() { + // Even thought there are generation options, have an env back door since some + // of these helpers could be used in other plugins. + + const char* use_package_cstr = getenv("GPB_OBJC_USE_PACKAGE_AS_PREFIX"); + use_package_name_ = + (use_package_cstr && (TProtoStringType("YES") == ToUpper(use_package_cstr))); + + const char* exception_path = getenv("GPB_OBJC_PACKAGE_PREFIX_EXCEPTIONS_PATH"); + if (exception_path) { + exception_path_ = exception_path; + } +} + +bool PrefixModeStorage::is_package_exempted(const TProtoStringType& package) { + if (exceptions_.empty() && !exception_path_.empty()) { + TProtoStringType error_str; + SimpleLineCollector collector(&exceptions_); + if (!ParseSimpleFile(exception_path_, &collector, &error_str)) { + if (error_str.empty()) { + error_str = TProtoStringType("protoc:0: warning: Failed to parse") + + TProtoStringType(" package prefix exceptions file: ") + + exception_path_; + } + std::cerr << error_str << std::endl; + std::cerr.flush(); + exceptions_.clear(); + } + + // If the file was empty put something in it so it doesn't get reloaded over + // and over. + if (exceptions_.empty()) { + exceptions_.insert("<not a real package>"); + } + } + + return exceptions_.count(package) != 0; +} + +PrefixModeStorage g_prefix_mode; + +} // namespace + +bool UseProtoPackageAsDefaultPrefix() { + return g_prefix_mode.use_package_name(); +} + +void SetUseProtoPackageAsDefaultPrefix(bool on_or_off) { + g_prefix_mode.set_use_package_name(on_or_off); +} + +TProtoStringType GetProtoPackagePrefixExceptionList() { + return g_prefix_mode.exception_path(); +} + +void SetProtoPackagePrefixExceptionList(const TProtoStringType& file_path) { + g_prefix_mode.set_exception_path(file_path); +} + Options::Options() { // Default is the value of the env for the package prefixes. const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); @@ -361,6 +457,15 @@ TProtoStringType GetEnumNameForFlagType(const FlagType flag_type) { } } +void MaybeUnQuote(StringPiece* input) { + if ((input->length() >= 2) && + ((*input->data() == '\'' || *input->data() == '"')) && + ((*input)[input->length() - 1] == *input->data())) { + input->remove_prefix(1); + input->remove_suffix(1); + } +} + } // namespace // Escape C++ trigraphs by escaping question marks to \? @@ -399,8 +504,39 @@ TProtoStringType BaseFileName(const FileDescriptor* file) { } TProtoStringType FileClassPrefix(const FileDescriptor* file) { - // Default is empty string, no need to check has_objc_class_prefix. - TProtoStringType result = file->options().objc_class_prefix(); + // Always honor the file option. + if (file->options().has_objc_class_prefix()) { + return file->options().objc_class_prefix(); + } + + // If package prefix isn't enabled or no package, done. + if (!g_prefix_mode.use_package_name() || file->package().empty()) { + return ""; + } + + // If the package is in the exceptions list, done. + if (g_prefix_mode.is_package_exempted(file->package())) { + return ""; + } + + // Transform the package into a prefix: use the dot segments as part, + // camelcase each one and then join them with underscores, and add an + // underscore at the end. + TProtoStringType result; + const std::vector<TProtoStringType> segments = Split(file->package(), ".", true); + for (const auto& segment : segments) { + const TProtoStringType part = UnderscoresToCamelCase(segment, true); + if (part.empty()) { + continue; + } + if (!result.empty()) { + result.append("_"); + } + result.append(part); + } + if (!result.empty()) { + result.append("_"); + } return result; } @@ -1052,7 +1188,7 @@ class ExpectedPrefixesCollector : public LineConsumer { ExpectedPrefixesCollector(std::map<TProtoStringType, TProtoStringType>* inout_package_to_prefix_map) : prefix_map_(inout_package_to_prefix_map) {} - virtual bool ConsumeLine(const StringPiece& line, TProtoStringType* out_error); + virtual bool ConsumeLine(const StringPiece& line, TProtoStringType* out_error) override; private: std::map<TProtoStringType, TProtoStringType>* prefix_map_; @@ -1070,6 +1206,7 @@ bool ExpectedPrefixesCollector::ConsumeLine( StringPiece prefix = line.substr(offset + 1); TrimWhitespace(&package); TrimWhitespace(&prefix); + MaybeUnQuote(&prefix); // Don't really worry about error checking the package/prefix for // being valid. Assume the file is validated when it is created/edited. (*prefix_map_)[TProtoStringType(package)] = TProtoStringType(prefix); @@ -1092,6 +1229,13 @@ bool ValidateObjCClassPrefix( const FileDescriptor* file, const TProtoStringType& expected_prefixes_path, const std::map<TProtoStringType, TProtoStringType>& expected_package_prefixes, TProtoStringType* out_error) { + // Reminder: An explicit prefix option of "" is valid in case the default + // prefixing is set to use the proto package and a file needs to be generated + // without any prefix at all (for legacy reasons). + + bool has_prefix = file->options().has_objc_class_prefix(); + bool have_expected_prefix_file = !expected_prefixes_path.empty(); + const TProtoStringType prefix = file->options().objc_class_prefix(); const TProtoStringType package = file->package(); @@ -1104,7 +1248,7 @@ bool ValidateObjCClassPrefix( expected_package_prefixes.find(package); if (package_match != expected_package_prefixes.end()) { // There was an entry, and... - if (package_match->second == prefix) { + if (has_prefix && package_match->second == prefix) { // ...it matches. All good, out of here! return true; } else { @@ -1112,7 +1256,7 @@ bool ValidateObjCClassPrefix( *out_error = "error: Expected 'option objc_class_prefix = \"" + package_match->second + "\";' for package '" + package + "' in '" + file->name() + "'"; - if (prefix.length()) { + if (has_prefix) { *out_error += "; but found '" + prefix + "' instead"; } *out_error += "."; @@ -1121,22 +1265,76 @@ bool ValidateObjCClassPrefix( } // If there was no prefix option, we're done at this point. - if (prefix.empty()) { - // No prefix, nothing left to check. + if (!has_prefix) { return true; } + // When the prefix is non empty, check it against the expected entries. + if (!prefix.empty() && have_expected_prefix_file) { + // For a non empty prefix, look for any other package that uses the prefix. + TProtoStringType other_package_for_prefix; + for (std::map<TProtoStringType, TProtoStringType>::const_iterator i = + expected_package_prefixes.begin(); + i != expected_package_prefixes.end(); ++i) { + if (i->second == prefix) { + other_package_for_prefix = i->first; + break; + } + } + + // Check: Warning - If the file does not have a package, check whether the + // prefix was declared is being used by another package or not. This is + // a special case for empty packages. + if (package.empty()) { + // The file does not have a package and ... + if (other_package_for_prefix.empty()) { + // ... no other package has declared that prefix. + std::cerr + << "protoc:0: warning: File '" << file->name() << "' has no " + << "package. Consider adding a new package to the proto and adding '" + << "new.package = " << prefix << "' to the expected prefixes file (" + << expected_prefixes_path << ")." << std::endl; + std::cerr.flush(); + } else { + // ... another package has declared the same prefix. + std::cerr + << "protoc:0: warning: File '" << file->name() << "' has no package " + << "and package '" << other_package_for_prefix << "' already uses '" + << prefix << "' as its prefix. Consider either adding a new package " + << "to the proto, or reusing one of the packages already using this " + << "prefix in the expected prefixes file (" + << expected_prefixes_path << ")." << std::endl; + std::cerr.flush(); + } + return true; + } + + // Check: Error - Make sure the prefix wasn't expected for a different + // package (overlap is allowed, but it has to be listed as an expected + // overlap). + if (!other_package_for_prefix.empty()) { + *out_error = + "error: Found 'option objc_class_prefix = \"" + prefix + + "\";' in '" + file->name() + + "'; that prefix is already used for 'package " + + other_package_for_prefix + ";'. It can only be reused by listing " + + "it in the expected file (" + + expected_prefixes_path + ")."; + return false; // Only report first usage of the prefix. + } + } // !prefix.empty() + // Check: Warning - Make sure the prefix is is a reasonable value according // to Apple's rules (the checks above implicitly whitelist anything that // doesn't meet these rules). - if (!ascii_isupper(prefix[0])) { + if (!prefix.empty() && !ascii_isupper(prefix[0])) { std::cerr << "protoc:0: warning: Invalid 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" << " it should start with a capital letter." << std::endl; std::cerr.flush(); } - if (prefix.length() < 3) { + if (!prefix.empty() && prefix.length() < 3) { // Apple reserves 2 character prefixes for themselves. They do use some // 3 character prefixes, but they haven't updated the rules/docs. std::cerr @@ -1147,60 +1345,9 @@ bool ValidateObjCClassPrefix( std::cerr.flush(); } - // Look for any other package that uses the same prefix. - TProtoStringType other_package_for_prefix; - for (std::map<TProtoStringType, TProtoStringType>::const_iterator i = - expected_package_prefixes.begin(); - i != expected_package_prefixes.end(); ++i) { - if (i->second == prefix) { - other_package_for_prefix = i->first; - break; - } - } - - // Check: Warning - If the file does not have a package, check whether - // the prefix declared is being used by another package or not. - if (package.empty()) { - // The file does not have a package and ... - if (other_package_for_prefix.empty()) { - // ... no other package has declared that prefix. - std::cerr - << "protoc:0: warning: File '" << file->name() << "' has no " - << "package. Consider adding a new package to the proto and adding '" - << "new.package = " << prefix << "' to the expected prefixes file (" - << expected_prefixes_path << ")." << std::endl; - std::cerr.flush(); - } else { - // ... another package has declared the same prefix. - std::cerr - << "protoc:0: warning: File '" << file->name() << "' has no package " - << "and package '" << other_package_for_prefix << "' already uses '" - << prefix << "' as its prefix. Consider either adding a new package " - << "to the proto, or reusing one of the packages already using this " - << "prefix in the expected prefixes file (" - << expected_prefixes_path << ")." << std::endl; - std::cerr.flush(); - } - return true; - } - - // Check: Error - Make sure the prefix wasn't expected for a different - // package (overlap is allowed, but it has to be listed as an expected - // overlap). - if (!other_package_for_prefix.empty()) { - *out_error = - "error: Found 'option objc_class_prefix = \"" + prefix + - "\";' in '" + file->name() + - "'; that prefix is already used for 'package " + - other_package_for_prefix + ";'. It can only be reused by listing " + - "it in the expected file (" + - expected_prefixes_path + ")."; - return false; // Only report first usage of the prefix. - } - // Check: Warning - If the given package/prefix pair wasn't expected, issue a - // warning issue a warning suggesting it gets added to the file. - if (!expected_package_prefixes.empty()) { + // warning suggesting it gets added to the file. + if (have_expected_prefix_file) { std::cerr << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" @@ -1217,6 +1364,12 @@ bool ValidateObjCClassPrefix( bool ValidateObjCClassPrefixes(const std::vector<const FileDescriptor*>& files, const Options& generation_options, TProtoStringType* out_error) { + // Allow a '-' as the path for the expected prefixes to completely disable + // even the most basic of checks. + if (generation_options.expected_prefixes_path == "-") { + return true; + } + // Load the expected package prefixes, if available, to validate against. std::map<TProtoStringType, TProtoStringType> expected_package_prefixes; if (!LoadExpectedPackagePrefixes(generation_options, diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 9fb24936c2..2e291dbd6b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -46,6 +46,19 @@ namespace protobuf { namespace compiler { namespace objectivec { +// Get/Set if the proto package should be used to make the default prefix for +// symbols. This will then impact most of the type naming apis below. It is done +// as a global to not break any other generator reusing the methods since they +// are exported. +bool PROTOC_EXPORT UseProtoPackageAsDefaultPrefix(); +void PROTOC_EXPORT SetUseProtoPackageAsDefaultPrefix(bool on_or_off); +// Get/Set the path to a file to load as exceptions when +// `UseProtoPackageAsDefaultPrefixUseProtoPackageAsDefaultPrefix()` is `true`. +// And empty string means there should be no exceptions loaded. +TProtoStringType PROTOC_EXPORT GetProtoPackagePrefixExceptionList(); +void PROTOC_EXPORT SetProtoPackagePrefixExceptionList( + const TProtoStringType& file_path); + // Generator options (see objectivec_generator.cc for a description of each): struct Options { Options(); @@ -70,7 +83,7 @@ bool PROTOC_EXPORT IsRetainedName(const TProtoStringType& name); // handling under ARC. bool PROTOC_EXPORT IsInitName(const TProtoStringType& name); -// Gets the objc_class_prefix. +// Gets the objc_class_prefix or the prefix made from the proto package. TProtoStringType PROTOC_EXPORT FileClassPrefix(const FileDescriptor* file); // Gets the path of the file we're going to generate (sans the .pb.h @@ -90,7 +103,7 @@ TProtoStringType PROTOC_EXPORT FileClassName(const FileDescriptor* file); // descriptor. TProtoStringType PROTOC_EXPORT ClassName(const Descriptor* descriptor); TProtoStringType PROTOC_EXPORT ClassName(const Descriptor* descriptor, - TProtoStringType* out_suffix_added); + TProtoStringType* out_suffix_added); TProtoStringType PROTOC_EXPORT EnumName(const EnumDescriptor* descriptor); // Returns the fully-qualified name of the enum value corresponding to the @@ -296,7 +309,7 @@ class PROTOC_EXPORT ImportWriter { ProtoFrameworkCollector(std::map<TProtoStringType, TProtoStringType>* inout_proto_file_to_framework_name) : map_(inout_proto_file_to_framework_name) {} - virtual bool ConsumeLine(const StringPiece& line, TProtoStringType* out_error); + virtual bool ConsumeLine(const StringPiece& line, TProtoStringType* out_error) override; private: std::map<TProtoStringType, TProtoStringType>* map_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_map_field.h index 48ff7e9162..fd2b466dcc 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_map_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_map_field.h @@ -45,7 +45,7 @@ class MapFieldGenerator : public RepeatedFieldGenerator { const Options& options); public: - virtual void FinishInitialization(void); + virtual void FinishInitialization(void) override; MapFieldGenerator(const MapFieldGenerator&) = delete; MapFieldGenerator& operator=(const MapFieldGenerator&) = delete; @@ -55,9 +55,9 @@ class MapFieldGenerator : public RepeatedFieldGenerator { virtual ~MapFieldGenerator(); virtual void DetermineObjectiveCClassDefinitions( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; virtual void DetermineForwardDeclarations( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; private: std::unique_ptr<FieldGenerator> value_field_generator_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_message_field.h index ff89f66299..8897c9b7b6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_message_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_message_field.h @@ -55,9 +55,9 @@ class MessageFieldGenerator : public ObjCObjFieldGenerator { public: virtual void DetermineForwardDeclarations( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; virtual void DetermineObjectiveCClassDefinitions( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; }; class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { @@ -74,9 +74,9 @@ class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator { public: virtual void DetermineForwardDeclarations( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; virtual void DetermineObjectiveCClassDefinitions( - std::set<TProtoStringType>* fwd_decls) const; + std::set<TProtoStringType>* fwd_decls) const override; }; } // namespace objectivec diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h index 642f2d6323..a9f30f6419 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h @@ -52,10 +52,10 @@ class PrimitiveFieldGenerator : public SingleFieldGenerator { PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete; PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete; - virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const; + virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const override; - virtual int ExtraRuntimeHasBitsNeeded(void) const; - virtual void SetExtraRuntimeHasBitsBase(int index_base); + virtual int ExtraRuntimeHasBitsNeeded(void) const override; + virtual void SetExtraRuntimeHasBitsBase(int index_base) override; }; class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc index 41d70aa255..fa3dffbdb6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc @@ -97,19 +97,19 @@ TProtoStringType MapEntryName(const TProtoStringType& field_name) { static const char kSuffix[] = "Entry"; result.reserve(field_name.size() + sizeof(kSuffix)); bool cap_next = true; - for (int i = 0; i < field_name.size(); ++i) { - if (field_name[i] == '_') { + for (const char field_name_char : field_name) { + if (field_name_char == '_') { cap_next = true; } else if (cap_next) { // Note: Do not use ctype.h due to locales. - if ('a' <= field_name[i] && field_name[i] <= 'z') { - result.push_back(field_name[i] - 'a' + 'A'); + if ('a' <= field_name_char && field_name_char <= 'z') { + result.push_back(field_name_char - 'a' + 'A'); } else { - result.push_back(field_name[i]); + result.push_back(field_name_char); } cap_next = false; } else { - result.push_back(field_name[i]); + result.push_back(field_name_char); } } result.append(kSuffix); @@ -131,8 +131,8 @@ bool IsUpperCamelCase(const TProtoStringType& name) { return false; } // Must not contains underscore. - for (int i = 1; i < name.length(); i++) { - if (name[i] == '_') { + for (const char c : name) { + if (c == '_') { return false; } } @@ -140,8 +140,7 @@ bool IsUpperCamelCase(const TProtoStringType& name) { } bool IsUpperUnderscore(const TProtoStringType& name) { - for (int i = 0; i < name.length(); i++) { - const char c = name[i]; + for (const char c : name) { if (!IsUppercase(c) && c != '_' && !IsNumber(c)) { return false; } @@ -150,8 +149,7 @@ bool IsUpperUnderscore(const TProtoStringType& name) { } bool IsLowerUnderscore(const TProtoStringType& name) { - for (int i = 0; i < name.length(); i++) { - const char c = name[i]; + for (const char c : name) { if (!IsLowercase(c) && c != '_' && !IsNumber(c)) { return false; } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/php/php_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/php/php_generator.cc index 696e4ceec8..7210b37bcb 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/php/php_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/php/php_generator.cc @@ -50,26 +50,27 @@ const TProtoStringType kDescriptorMetadataFile = const TProtoStringType kDescriptorDirName = "Google/Protobuf/Internal"; const TProtoStringType kDescriptorPackageName = "Google\\Protobuf\\Internal"; const char* const kReservedNames[] = { - "abstract", "and", "array", "as", "break", - "callable", "case", "catch", "class", "clone", - "const", "continue", "declare", "default", "die", - "do", "echo", "else", "elseif", "empty", - "enddeclare", "endfor", "endforeach", "endif", "endswitch", - "endwhile", "eval", "exit", "extends", "final", - "for", "foreach", "function", "global", "goto", - "if", "implements", "include", "include_once", "instanceof", - "insteadof", "interface", "isset", "list", "namespace", - "new", "or", "print", "private", "protected", - "public", "require", "require_once", "return", "static", - "switch", "throw", "trait", "try", "unset", - "use", "var", "while", "xor", "int", - "float", "bool", "string", "true", "false", - "null", "void", "iterable"}; + "abstract", "and", "array", "as", "break", + "callable", "case", "catch", "class", "clone", + "const", "continue", "declare", "default", "die", + "do", "echo", "else", "elseif", "empty", + "enddeclare", "endfor", "endforeach", "endif", "endswitch", + "endwhile", "eval", "exit", "extends", "final", + "finally", "fn", "for", "foreach", "function", + "global", "goto", "if", "implements", "include", + "include_once", "instanceof", "insteadof", "interface", "isset", + "list", "match", "namespace", "new", "or", + "print", "private", "protected", "public", "require", + "require_once", "return", "static", "switch", "throw", + "trait", "try", "unset", "use", "var", + "while", "xor", "yield", "int", "float", + "bool", "string", "true", "false", "null", + "void", "iterable"}; const char* const kValidConstantNames[] = { "int", "float", "bool", "string", "true", "false", "null", "void", "iterable", }; -const int kReservedNamesSize = 73; +const int kReservedNamesSize = 77; const int kValidConstantNamesSize = 9; const int kFieldSetter = 1; const int kFieldGetter = 2; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc index d05aef210a..6ddcb86202 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc @@ -72,14 +72,14 @@ class GeneratorResponseContext : public GeneratorContext { // implements GeneratorContext -------------------------------------- - virtual io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) { + virtual io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) override { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); return new io::StringOutputStream(file->mutable_content()); } virtual io::ZeroCopyOutputStream* OpenForInsert( - const TProtoStringType& filename, const TProtoStringType& insertion_point) { + const TProtoStringType& filename, const TProtoStringType& insertion_point) override { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); file->set_insertion_point(insertion_point); @@ -88,7 +88,7 @@ class GeneratorResponseContext : public GeneratorContext { virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( const TProtoStringType& filename, const TProtoStringType& insertion_point, - const google::protobuf::GeneratedCodeInfo& info) { + const google::protobuf::GeneratedCodeInfo& info) override { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); file->set_insertion_point(insertion_point); @@ -96,11 +96,11 @@ class GeneratorResponseContext : public GeneratorContext { return new io::StringOutputStream(file->mutable_content()); } - void ListParsedFiles(std::vector<const FileDescriptor*>* output) { + void ListParsedFiles(std::vector<const FileDescriptor*>* output) override { *output = parsed_files_; } - void GetCompilerVersion(Version* version) const { + void GetCompilerVersion(Version* version) const override { *version = compiler_version_; } @@ -175,6 +175,7 @@ int PluginMain(int argc, char* argv[], const CodeGenerator* generator) { return 1; } + TProtoStringType error_msg; CodeGeneratorResponse response; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.h b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.h index 13e98f02c3..efbf9e8707 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.h @@ -79,6 +79,7 @@ class CodeGeneratorResponse; PROTOC_EXPORT int PluginMain(int argc, char* argv[], const CodeGenerator* generator); + // Generates code using the given code generator. Returns true if the code // generation is successful. If the code generation fails, error_msg may be // populated to describe the failure cause. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.cc b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.cc index f66f854fe9..d7f4aea2e6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.cc @@ -84,69 +84,73 @@ static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptor static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, major_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, minor_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, patch_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::Version, suffix_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, major_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, minor_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, patch_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, suffix_), 1, 2, 3, 0, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, file_to_generate_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, parameter_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, proto_file_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, compiler_version_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, file_to_generate_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, parameter_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, proto_file_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest, compiler_version_), ~0u, 0, ~0u, 1, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, name_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, insertion_point_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, content_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, generated_code_info_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, name_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, insertion_point_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, content_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File, generated_code_info_), 0, 1, 2, 3, - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _has_bits_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, error_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, supported_features_), - PROTOBUF_FIELD_OFFSET(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, file_), + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, error_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, supported_features_), + PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse, file_), 0, 1, ~0u, }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { - { 0, 9, sizeof(PROTOBUF_NAMESPACE_ID::compiler::Version)}, - { 13, 22, sizeof(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest)}, - { 26, 35, sizeof(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File)}, - { 39, 47, sizeof(PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse)}, + { 0, 10, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::Version)}, + { 14, 24, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest)}, + { 28, 38, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File)}, + { 42, 51, -1, sizeof(::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_File_default_instance_), - reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_File_default_instance_), + reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorResponse_default_instance_), }; const char descriptor_table_protodef_google_2fprotobuf_2fcompiler_2fplugin_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = @@ -316,7 +320,8 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in _Internal::set_has_major(&has_bits); major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 minor = 2; case 2: @@ -324,7 +329,8 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in _Internal::set_has_minor(&has_bits); minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional int32 patch = 3; case 3: @@ -332,7 +338,8 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in _Internal::set_has_patch(&has_bits); patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string suffix = 4; case 4: @@ -343,29 +350,30 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.Version.suffix"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -431,33 +439,21 @@ size_t Version::ByteSizeLong() const { // optional int32 major = 1; if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_major()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_major()); } // optional int32 minor = 2; if (cached_has_bits & 0x00000004u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_minor()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_minor()); } // optional int32 patch = 3; if (cached_has_bits & 0x00000008u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - this->_internal_patch()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_patch()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Version::_class_data_ = { @@ -466,8 +462,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Version::_class_data_ = { }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Version::GetClassData() const { return &_class_data_; } -void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<Version *>(to)->MergeFrom( static_cast<const Version &>(from)); } @@ -511,12 +507,14 @@ bool Version::IsInitialized() const { void Version::InternalSwap(Version* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &suffix_, GetArenaForAllocation(), - &other->suffix_, other->GetArenaForAllocation() + &suffix_, lhs_arena, + &other->suffix_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(Version, patch_) @@ -540,13 +538,13 @@ class CodeGeneratorRequest::_Internal { static void set_has_parameter(HasBits* has_bits) { (*has_bits)[0] |= 1u; } - static const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version(const CodeGeneratorRequest* msg); + static const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version(const CodeGeneratorRequest* msg); static void set_has_compiler_version(HasBits* has_bits) { (*has_bits)[0] |= 2u; } }; -const PROTOBUF_NAMESPACE_ID::compiler::Version& +const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_Internal::compiler_version(const CodeGeneratorRequest* msg) { return *msg->compiler_version_; } @@ -576,7 +574,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) GetArenaForAllocation()); } if (from._internal_has_compiler_version()) { - compiler_version_ = new PROTOBUF_NAMESPACE_ID::compiler::Version(*from.compiler_version_); + compiler_version_ = new ::PROTOBUF_NAMESPACE_ID::compiler::Version(*from.compiler_version_); } else { compiler_version_ = nullptr; } @@ -654,7 +652,8 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string parameter = 2; case 2: @@ -665,14 +664,16 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorRequest.parameter"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.compiler.Version compiler_version = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.FileDescriptorProto proto_file = 15; case 15: @@ -684,29 +685,30 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -801,13 +803,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorRequest::_class_data_ = { @@ -816,8 +812,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorRequest::_class_d }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorRequest::GetClassData() const { return &_class_data_; } -void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<CodeGeneratorRequest *>(to)->MergeFrom( static_cast<const CodeGeneratorRequest &>(from)); } @@ -837,7 +833,7 @@ void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) { _internal_set_parameter(from._internal_parameter()); } if (cached_has_bits & 0x00000002u) { - _internal_mutable_compiler_version()->PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from._internal_compiler_version()); + _internal_mutable_compiler_version()->::PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from._internal_compiler_version()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -857,14 +853,16 @@ bool CodeGeneratorRequest::IsInitialized() const { void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); file_to_generate_.InternalSwap(&other->file_to_generate_); proto_file_.InternalSwap(&other->proto_file_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - ¶meter_, GetArenaForAllocation(), - &other->parameter_, other->GetArenaForAllocation() + ¶meter_, lhs_arena, + &other->parameter_, rhs_arena ); swap(compiler_version_, other->compiler_version_); } @@ -889,13 +887,13 @@ class CodeGeneratorResponse_File::_Internal { static void set_has_content(HasBits* has_bits) { (*has_bits)[0] |= 4u; } - static const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info(const CodeGeneratorResponse_File* msg); + static const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info(const CodeGeneratorResponse_File* msg); static void set_has_generated_code_info(HasBits* has_bits) { (*has_bits)[0] |= 8u; } }; -const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& +const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_Internal::generated_code_info(const CodeGeneratorResponse_File* msg) { return *msg->generated_code_info_; } @@ -932,7 +930,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon GetArenaForAllocation()); } if (from._internal_has_generated_code_info()) { - generated_code_info_ = new PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from.generated_code_info_); + generated_code_info_ = new ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from.generated_code_info_); } else { generated_code_info_ = nullptr; } @@ -1013,7 +1011,8 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.name"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string insertion_point = 2; case 2: @@ -1024,7 +1023,8 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional string content = 15; case 15: @@ -1035,36 +1035,38 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.File.content"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; case 16: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 130)) { ptr = ctx->ParseMessage(_internal_mutable_generated_code_info(), ptr); CHK_(ptr); - } else goto handle_unusual; - continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); + } else + goto handle_unusual; continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1160,13 +1162,7 @@ size_t CodeGeneratorResponse_File::ByteSizeLong() const { } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse_File::_class_data_ = { @@ -1175,8 +1171,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse_File::_c }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse_File::GetClassData() const { return &_class_data_; } -void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<CodeGeneratorResponse_File *>(to)->MergeFrom( static_cast<const CodeGeneratorResponse_File &>(from)); } @@ -1200,7 +1196,7 @@ void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& fro _internal_set_content(from._internal_content()); } if (cached_has_bits & 0x00000008u) { - _internal_mutable_generated_code_info()->PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo::MergeFrom(from._internal_generated_code_info()); + _internal_mutable_generated_code_info()->::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo::MergeFrom(from._internal_generated_code_info()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -1219,22 +1215,24 @@ bool CodeGeneratorResponse_File::IsInitialized() const { void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &name_, GetArenaForAllocation(), - &other->name_, other->GetArenaForAllocation() + &name_, lhs_arena, + &other->name_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &insertion_point_, GetArenaForAllocation(), - &other->insertion_point_, other->GetArenaForAllocation() + &insertion_point_, lhs_arena, + &other->insertion_point_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &content_, GetArenaForAllocation(), - &other->content_, other->GetArenaForAllocation() + &content_, lhs_arena, + &other->content_, rhs_arena ); swap(generated_code_info_, other->generated_code_info_); } @@ -1341,7 +1339,8 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.compiler.CodeGeneratorResponse.error"); #endif // !NDEBUG CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // optional uint64 supported_features = 2; case 2: @@ -1349,7 +1348,8 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA _Internal::set_has_supported_features(&has_bits); supported_features_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); - } else goto handle_unusual; + } else + goto handle_unusual; continue; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; case 15: @@ -1361,29 +1361,30 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr)); - } else goto handle_unusual; + } else + goto handle_unusual; continue; - default: { - handle_unusual: - if ((tag == 0) || ((tag & 7) == 4)) { - CHK_(ptr); - ctx->SetLastTag(tag); - goto success; - } - ptr = UnknownFieldParse(tag, - _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), - ptr, ctx); - CHK_(ptr != nullptr); - continue; - } + default: + goto handle_unusual; } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); } // while -success: +message_done: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; - goto success; + goto message_done; #undef CHK_ } @@ -1452,19 +1453,11 @@ size_t CodeGeneratorResponse::ByteSizeLong() const { // optional uint64 supported_features = 2; if (cached_has_bits & 0x00000002u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( - this->_internal_supported_features()); + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64SizePlusOne(this->_internal_supported_features()); } } - if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { - return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( - _internal_metadata_, total_size, &_cached_size_); - } - int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); - SetCachedSize(cached_size); - return total_size; + return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_); } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse::_class_data_ = { @@ -1473,8 +1466,8 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse::_class_ }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse::GetClassData() const { return &_class_data_; } -void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, - const ::PROTOBUF_NAMESPACE_ID::Message&from) { +void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, + const ::PROTOBUF_NAMESPACE_ID::Message& from) { static_cast<CodeGeneratorResponse *>(to)->MergeFrom( static_cast<const CodeGeneratorResponse &>(from)); } @@ -1513,13 +1506,15 @@ bool CodeGeneratorResponse::IsInitialized() const { void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); file_.InternalSwap(&other->file_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), - &error_, GetArenaForAllocation(), - &other->error_, other->GetArenaForAllocation() + &error_, lhs_arena, + &other->error_, rhs_arena ); swap(supported_features_, other->supported_features_); } @@ -1534,17 +1529,17 @@ void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) { } // namespace compiler PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::Version >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::compiler::Version >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::Version >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::Version >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >(arena); } -template<> PROTOBUF_NOINLINE PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(Arena* arena) { - return Arena::CreateMessageInternal< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(arena); +template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse >(arena); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h index 6da6c31dad..9d0e84637a 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h @@ -8,12 +8,12 @@ #include <string> #include <google/protobuf/port_def.inc> -#if PROTOBUF_VERSION < 3017000 +#if PROTOBUF_VERSION < 3018000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -78,10 +78,10 @@ PROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_; } // namespace compiler PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest>(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse>(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File>(Arena*); -template<> PROTOC_EXPORT PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::Version>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorRequest>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File>(Arena*); +template<> PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::compiler::Version* Arena::CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(Arena*); PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN namespace compiler { @@ -130,7 +130,11 @@ class PROTOC_EXPORT Version final : } inline Version& operator=(Version&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -195,7 +199,7 @@ class PROTOC_EXPORT Version final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const Version& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -331,7 +335,11 @@ class PROTOC_EXPORT CodeGeneratorRequest final : } inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -396,7 +404,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorRequest& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -469,16 +477,16 @@ class PROTOC_EXPORT CodeGeneratorRequest final : int _internal_proto_file_size() const; public: void clear_proto_file(); - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* mutable_proto_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* mutable_proto_file(); private: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& _internal_proto_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _internal_add_proto_file(); public: - const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& + const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& proto_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* add_proto_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& proto_file() const; // optional string parameter = 2; @@ -505,17 +513,17 @@ class PROTOC_EXPORT CodeGeneratorRequest final : bool _internal_has_compiler_version() const; public: void clear_compiler_version(); - const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); - PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); - void set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version(); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version(); + void set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); private: - const PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; - PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); + const ::PROTOBUF_NAMESPACE_ID::compiler::Version& _internal_compiler_version() const; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* _internal_mutable_compiler_version(); public: void unsafe_arena_set_allocated_compiler_version( - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); - PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version(); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version); + ::PROTOBUF_NAMESPACE_ID::compiler::Version* unsafe_arena_release_compiler_version(); // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest) private: @@ -527,9 +535,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<TProtoStringType> file_to_generate_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto > proto_file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto > proto_file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr parameter_; - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- @@ -553,7 +561,11 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : } inline CodeGeneratorResponse_File& operator=(CodeGeneratorResponse_File&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -618,7 +630,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorResponse_File& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -721,17 +733,17 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : bool _internal_has_generated_code_info() const; public: void clear_generated_code_info(); - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const; - PROTOBUF_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info(); - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info(); - void set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const; + PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info(); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info(); + void set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); private: - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info(); + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& _internal_generated_code_info() const; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _internal_mutable_generated_code_info(); public: void unsafe_arena_set_allocated_generated_code_info( - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info); + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* unsafe_arena_release_generated_code_info(); // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File) private: @@ -745,7 +757,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr insertion_point_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr content_; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- @@ -769,7 +781,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final : } inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept { if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena()) { + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { InternalSwap(&from); } else { CopyFrom(from); @@ -834,7 +850,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom(const CodeGeneratorResponse& from); private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from); + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; @@ -914,16 +930,16 @@ class PROTOC_EXPORT CodeGeneratorResponse final : int _internal_file_size() const; public: void clear_file(); - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* mutable_file(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* mutable_file(); private: - const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); + const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& _internal_file(int index) const; + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _internal_add_file(); public: - const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& + const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& file(int index) const; + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* add_file(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& file() const; // optional string error = 1; @@ -966,7 +982,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_; ::PROTOBUF_NAMESPACE_ID::uint64 supported_features_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; @@ -1268,31 +1284,31 @@ inline int CodeGeneratorRequest::_internal_proto_file_size() const { inline int CodeGeneratorRequest::proto_file_size() const { return _internal_proto_file_size(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >* CodeGeneratorRequest::mutable_proto_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return &proto_file_; } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::_internal_proto_file(int index) const { return proto_file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _internal_proto_file(index); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::_internal_add_proto_file() { return proto_file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { - PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file(); +inline ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() { + ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto* _add = _internal_add_proto_file(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FileDescriptorProto >& CodeGeneratorRequest::proto_file() const { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file) return proto_file_; @@ -1311,17 +1327,17 @@ inline void CodeGeneratorRequest::clear_compiler_version() { if (compiler_version_ != nullptr) compiler_version_->Clear(); _has_bits_[0] &= ~0x00000002u; } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { - const PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::compiler::Version&>( - PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::_internal_compiler_version() const { + const ::PROTOBUF_NAMESPACE_ID::compiler::Version* p = compiler_version_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::compiler::Version&>( + ::PROTOBUF_NAMESPACE_ID::compiler::_Version_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::Version& CodeGeneratorRequest::compiler_version() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _internal_compiler_version(); } inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version( - PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { + ::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(compiler_version_); } @@ -1333,9 +1349,9 @@ inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_compiler_version() { _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; compiler_version_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -1348,34 +1364,34 @@ inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::release_c #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::unsafe_arena_release_compiler_version() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) _has_bits_[0] &= ~0x00000002u; - PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; + ::PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_; compiler_version_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() { _has_bits_[0] |= 0x00000002u; if (compiler_version_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation()); compiler_version_ = p; } return compiler_version_; } -inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { - PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version(); +inline ::PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() { + ::PROTOBUF_NAMESPACE_ID::compiler::Version* _msg = _internal_mutable_compiler_version(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version) return _msg; } -inline void CodeGeneratorRequest::set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { +inline void CodeGeneratorRequest::set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete compiler_version_; } if (compiler_version) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version); + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version); if (message_arena != submessage_arena) { compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, compiler_version, submessage_arena); @@ -1575,17 +1591,17 @@ inline bool CodeGeneratorResponse_File::_internal_has_generated_code_info() cons inline bool CodeGeneratorResponse_File::has_generated_code_info() const { return _internal_has_generated_code_info(); } -inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const { - const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_; - return p != nullptr ? *p : reinterpret_cast<const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo&>( - PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_); +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::_internal_generated_code_info() const { + const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* p = generated_code_info_; + return p != nullptr ? *p : reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo&>( + ::PROTOBUF_NAMESPACE_ID::_GeneratedCodeInfo_default_instance_); } -inline const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const { +inline const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& CodeGeneratorResponse_File::generated_code_info() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) return _internal_generated_code_info(); } inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info( - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); } @@ -1597,9 +1613,9 @@ inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_cod } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::release_generated_code_info() { _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; generated_code_info_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); @@ -1612,27 +1628,27 @@ inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::rel #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::unsafe_arena_release_generated_code_info() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) _has_bits_[0] &= ~0x00000008u; - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_; generated_code_info_ = nullptr; return temp; } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() { _has_bits_[0] |= 0x00000008u; if (generated_code_info_ == nullptr) { - auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation()); + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation()); generated_code_info_ = p; } return generated_code_info_; } -inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() { - PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info(); +inline ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::mutable_generated_code_info() { + ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* _msg = _internal_mutable_generated_code_info(); // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info) return _msg; } -inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { +inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_); @@ -1754,31 +1770,31 @@ inline int CodeGeneratorResponse::file_size() const { inline void CodeGeneratorResponse::clear_file() { file_.Clear(); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file) return file_.Mutable(index); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >* CodeGeneratorResponse::mutable_file() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file) return &file_; } -inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::_internal_file(int index) const { return file_.Get(index); } -inline const PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { +inline const ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file) return _internal_file(index); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::_internal_add_file() { return file_.Add(); } -inline PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { - PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file(); +inline ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() { + ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File* _add = _internal_add_file(); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file) return _add; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File >& CodeGeneratorResponse::file() const { // @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file) return file_; @@ -1801,10 +1817,10 @@ PROTOBUF_NAMESPACE_CLOSE PROTOBUF_NAMESPACE_OPEN -template <> struct is_proto_enum< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature> : ::std::true_type {}; +template <> struct is_proto_enum< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature> : ::std::true_type {}; template <> -inline const EnumDescriptor* GetEnumDescriptor< PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() { - return PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor(); +inline const EnumDescriptor* GetEnumDescriptor< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature>() { + return ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_Feature_descriptor(); } PROTOBUF_NAMESPACE_CLOSE diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/ruby/ruby_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/ruby/ruby_generator.cc index 83c941e154..acf806a7e6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -490,41 +490,40 @@ bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file, return false; } -// Ruby doesn't currently support proto2. This causes a failure even for proto3 -// files that import proto2. But in some cases, the proto2 file is only being -// imported to extend another proto2 message. The prime example is declaring -// custom options by extending FileOptions/FieldOptions/etc. -// -// If the proto3 messages don't have any proto2 submessages, it is safe to omit -// the dependency completely. Users won't be able to use any proto2 extensions, -// but they already couldn't because proto2 messages aren't supported. -// -// If/when we add proto2 support, we should remove this. -bool MaybeEmitDependency(const FileDescriptor* import, - const FileDescriptor* from, - io::Printer* printer, - TProtoStringType* error) { - if (from->syntax() == FileDescriptor::SYNTAX_PROTO3 && - import->syntax() == FileDescriptor::SYNTAX_PROTO2) { - for (int i = 0; i < from->message_type_count(); i++) { - if (UsesTypeFromFile(from->message_type(i), import, error)) { - // Error text was already set by UsesTypeFromFile(). - return false; - } +bool GenerateDslDescriptor(const FileDescriptor* file, io::Printer* printer, + TProtoStringType* error) { + printer->Print( + "require 'google/protobuf'\n\n"); + printer->Print("Google::Protobuf::DescriptorPool.generated_pool.build do\n"); + printer->Indent(); + printer->Print("add_file(\"$filename$\", :syntax => :$syntax$) do\n", + "filename", file->name(), "syntax", + StringifySyntax(file->syntax())); + printer->Indent(); + for (int i = 0; i < file->message_type_count(); i++) { + if (!GenerateMessage(file->message_type(i), printer, error)) { + return false; } - - // Ok to omit this proto2 dependency -- so we won't print anything. - GOOGLE_LOG(WARNING) << "Omitting proto2 dependency '" << import->name() - << "' from proto3 output file '" - << GetOutputFilename(from->name()) - << "' because we don't support proto2 and no proto2 " - "types from that file are being used."; - return true; - } else { - printer->Print( - "require '$name$'\n", "name", GetRequireName(import->name())); - return true; } + for (int i = 0; i < file->enum_type_count(); i++) { + GenerateEnum(file->enum_type(i), printer); + } + printer->Outdent(); + printer->Print("end\n"); + printer->Outdent(); + printer->Print( + "end\n\n"); + return true; +} + +bool GenerateBinaryDescriptor(const FileDescriptor* file, io::Printer* printer, + TProtoStringType* error) { + printer->Print( + R"(descriptor_data = File.binread(__FILE__).split("\n__END__\n", 2)[1])"); + printer->Print( + "\nGoogle::Protobuf::DescriptorPool.generated_pool.add_serialized_file(" + "descriptor_data)\n\n"); + return true; } bool GenerateFile(const FileDescriptor* file, io::Printer* printer, @@ -535,13 +534,8 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, "\n", "filename", file->name()); - printer->Print( - "require 'google/protobuf'\n\n"); - for (int i = 0; i < file->dependency_count(); i++) { - if (!MaybeEmitDependency(file->dependency(i), file, printer, error)) { - return false; - } + printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name())); } // TODO: Remove this when ruby supports extensions for proto2 syntax. @@ -550,25 +544,13 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, GOOGLE_LOG(WARNING) << "Extensions are not yet supported for proto2 .proto files."; } - printer->Print("Google::Protobuf::DescriptorPool.generated_pool.build do\n"); - printer->Indent(); - printer->Print("add_file(\"$filename$\", :syntax => :$syntax$) do\n", - "filename", file->name(), "syntax", - StringifySyntax(file->syntax())); - printer->Indent(); - for (int i = 0; i < file->message_type_count(); i++) { - if (!GenerateMessage(file->message_type(i), printer, error)) { - return false; - } - } - for (int i = 0; i < file->enum_type_count(); i++) { - GenerateEnum(file->enum_type(i), printer); + bool use_raw_descriptor = file->name() == "google/protobuf/descriptor.proto"; + + if (use_raw_descriptor) { + GenerateBinaryDescriptor(file, printer, error); + } else { + GenerateDslDescriptor(file, printer, error); } - printer->Outdent(); - printer->Print("end\n"); - printer->Outdent(); - printer->Print( - "end\n\n"); int levels = GeneratePackageModules(file, printer); for (int i = 0; i < file->message_type_count(); i++) { @@ -578,6 +560,15 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, GenerateEnumAssignment("", file->enum_type(i), printer); } EndPackageModules(levels, printer); + + if (use_raw_descriptor) { + printer->Print("\n__END__\n"); + FileDescriptorProto file_proto; + file->CopyTo(&file_proto); + TProtoStringType file_data; + file_proto.SerializeToString(&file_data); + printer->Print("$raw_descriptor$", "raw_descriptor", file_data); + } return true; } diff --git a/contrib/python/protobuf/py3/README.md b/contrib/python/protobuf/py3/README.md index cb8b7e9892..f0c9ce4f44 100644 --- a/contrib/python/protobuf/py3/README.md +++ b/contrib/python/protobuf/py3/README.md @@ -1,8 +1,6 @@ Protocol Buffers - Google's data interchange format =================================================== -[![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python_compatibility.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_compatibility%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/linux-python_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fubuntu%2Fpython_cpp%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython%2Fcontinuous) [![Build status](https://storage.googleapis.com/protobuf-kokoro-results/status-badge/macos-python_cpp.png)](https://fusion.corp.google.com/projectanalysis/current/KOKORO/prod:protobuf%2Fgithub%2Fmaster%2Fmacos%2Fpython_cpp%2Fcontinuous) [![Compat check PyPI](https://python-compatibility-tools.appspot.com/one_badge_image?package=protobuf)](https://python-compatibility-tools.appspot.com/one_badge_target?package=protobuf) - Copyright 2008 Google Inc. This directory contains the Python Protocol Buffers runtime library. @@ -28,7 +26,7 @@ use python c++ implementation. Installation ============ -1) Make sure you have Python 2.7 or newer. If in doubt, run: +1) Make sure you have Python 3.5 or newer. If in doubt, run: $ python -V diff --git a/contrib/python/protobuf/py3/google/protobuf/__init__.py b/contrib/python/protobuf/py3/google/protobuf/__init__.py index 496df6adaf..b8122e82ae 100644 --- a/contrib/python/protobuf/py3/google/protobuf/__init__.py +++ b/contrib/python/protobuf/py3/google/protobuf/__init__.py @@ -30,4 +30,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.17.3' +__version__ = '3.18.1' diff --git a/contrib/python/protobuf/py3/google/protobuf/descriptor.py b/contrib/python/protobuf/py3/google/protobuf/descriptor.py index 70fdae16ff..0f7bd17443 100644 --- a/contrib/python/protobuf/py3/google/protobuf/descriptor.py +++ b/contrib/python/protobuf/py3/google/protobuf/descriptor.py @@ -36,7 +36,6 @@ __author__ = 'robinson@google.com (Will Robinson)' import threading import warnings -import six from google.protobuf.internal import api_implementation @@ -111,7 +110,7 @@ _Deprecated.count = 100 _internal_create_key = object() -class DescriptorBase(six.with_metaclass(DescriptorMetaclass)): +class DescriptorBase(metaclass=DescriptorMetaclass): """Descriptors base class. diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py b/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py index 4cba1d479d..287ba689bf 100755 --- a/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/_parameterized.py @@ -154,8 +154,6 @@ except ImportError: import unittest import uuid -import six - try: # Since python 3 import collections.abc as collections_abc @@ -181,7 +179,7 @@ def _StrClass(cls): def _NonStringIterable(obj): return (isinstance(obj, collections_abc.Iterable) and not - isinstance(obj, six.string_types)) + isinstance(obj, str)) def _FormatParameterList(testcase_params): diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/api_implementation.py b/contrib/python/protobuf/py3/google/protobuf/internal/api_implementation.py index be1af7df6b..a3667318c1 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/api_implementation.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/api_implementation.py @@ -80,8 +80,7 @@ if _api_version < 0: # Still unspecified? # and Python 3 default to `_api_version = 2` (C++ implementation V2). pass -_default_implementation_type = ( - 'python' if _api_version <= 0 else 'cpp') +_default_implementation_type = ('python' if _api_version <= 0 else 'cpp') # This environment variable can be used to switch to a certain implementation # of the Python API, overriding the compile-time constants in the diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/decoder.py b/contrib/python/protobuf/py3/google/protobuf/internal/decoder.py index 6804986b6e..bc1b7b785c 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/decoder.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/decoder.py @@ -80,16 +80,8 @@ we repeatedly read a tag, look up the corresponding decoder, and invoke it. __author__ = 'kenton@google.com (Kenton Varda)' +import math import struct -import sys -import six - -_UCS2_MAXUNICODE = 65535 -if six.PY3: - long = int -else: - import re # pylint: disable=g-import-not-at-top - _SURROGATE_PATTERN = re.compile(six.u(r'[\ud800-\udfff]')) from google.protobuf.internal import containers from google.protobuf.internal import encoder @@ -97,13 +89,6 @@ from google.protobuf.internal import wire_format from google.protobuf import message -# This will overflow and thus become IEEE-754 "infinity". We would use -# "float('inf')" but it doesn't work on Windows pre-Python-2.6. -_POS_INF = 1e10000 -_NEG_INF = -_POS_INF -_NAN = _POS_INF * 0 - - # This is not for optimization, but rather to avoid conflicts with local # variables named "message". _DecodeError = message.DecodeError @@ -123,7 +108,7 @@ def _VarintDecoder(mask, result_type): result = 0 shift = 0 while 1: - b = six.indexbytes(buffer, pos) + b = buffer[pos] result |= ((b & 0x7f) << shift) pos += 1 if not (b & 0x80): @@ -146,7 +131,7 @@ def _SignedVarintDecoder(bits, result_type): result = 0 shift = 0 while 1: - b = six.indexbytes(buffer, pos) + b = buffer[pos] result |= ((b & 0x7f) << shift) pos += 1 if not (b & 0x80): @@ -159,12 +144,9 @@ def _SignedVarintDecoder(bits, result_type): raise _DecodeError('Too many bytes when decoding varint.') return DecodeVarint -# We force 32-bit values to int and 64-bit values to long to make -# alternate implementations where the distinction is more significant -# (e.g. the C++ implementation) simpler. - -_DecodeVarint = _VarintDecoder((1 << 64) - 1, long) -_DecodeSignedVarint = _SignedVarintDecoder(64, long) +# All 32-bit and 64-bit values are represented as int. +_DecodeVarint = _VarintDecoder((1 << 64) - 1, int) +_DecodeSignedVarint = _SignedVarintDecoder(64, int) # Use these versions for values which must be limited to 32 bits. _DecodeVarint32 = _VarintDecoder((1 << 32) - 1, int) @@ -189,7 +171,7 @@ def ReadTag(buffer, pos): Tuple[bytes, int] of the tag data and new position. """ start = pos - while six.indexbytes(buffer, pos) & 0x80: + while buffer[pos] & 0x80: pos += 1 pos += 1 @@ -333,11 +315,11 @@ def _FloatDecoder(): if (float_bytes[3:4] in b'\x7F\xFF' and float_bytes[2:3] >= b'\x80'): # If at least one significand bit is set... if float_bytes[0:3] != b'\x00\x00\x80': - return (_NAN, new_pos) + return (math.nan, new_pos) # If sign bit is set... if float_bytes[3:4] == b'\xFF': - return (_NEG_INF, new_pos) - return (_POS_INF, new_pos) + return (-math.inf, new_pos) + return (math.inf, new_pos) # Note that we expect someone up-stack to catch struct.error and convert # it to _DecodeError -- this way we don't have to set up exception- @@ -377,7 +359,7 @@ def _DoubleDecoder(): if ((double_bytes[7:8] in b'\x7F\xFF') and (double_bytes[6:7] >= b'\xF0') and (double_bytes[0:7] != b'\x00\x00\x00\x00\x00\x00\xF0')): - return (_NAN, new_pos) + return (math.nan, new_pos) # Note that we expect someone up-stack to catch struct.error and convert # it to _DecodeError -- this way we don't have to set up exception- @@ -559,31 +541,21 @@ BoolDecoder = _ModifiedDecoder( def StringDecoder(field_number, is_repeated, is_packed, key, new_default, - is_strict_utf8=False, clear_if_default=False): + clear_if_default=False): """Returns a decoder for a string field.""" local_DecodeVarint = _DecodeVarint - local_unicode = six.text_type def _ConvertToUnicode(memview): """Convert byte to unicode.""" byte_str = memview.tobytes() try: - value = local_unicode(byte_str, 'utf-8') + value = str(byte_str, 'utf-8') except UnicodeDecodeError as e: # add more information to the error message and re-raise it. e.reason = '%s in field: %s' % (e, key.full_name) raise - if is_strict_utf8 and six.PY2 and sys.maxunicode > _UCS2_MAXUNICODE: - # Only do the check for python2 ucs4 when is_strict_utf8 enabled - if _SURROGATE_PATTERN.search(value): - reason = ('String field %s contains invalid UTF-8 data when parsing' - 'a protocol buffer: surrogates not allowed. Use' - 'the bytes type if you intend to send raw bytes.') % ( - key.full_name) - raise message.DecodeError(reason) - return value assert not is_packed diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/encoder.py b/contrib/python/protobuf/py3/google/protobuf/internal/encoder.py index 0c016f3cfa..4b4f652f25 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/encoder.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/encoder.py @@ -68,8 +68,6 @@ __author__ = 'kenton@google.com (Kenton Varda)' import struct -import six - from google.protobuf.internal import wire_format @@ -372,7 +370,8 @@ def MapSizer(field_descriptor, is_message_map): def _VarintEncoder(): """Return an encoder for a basic varint value (does not include tag).""" - local_int2byte = six.int2byte + local_int2byte = struct.Struct('>B').pack + def EncodeVarint(write, value, unused_deterministic=None): bits = value & 0x7f value >>= 7 @@ -389,7 +388,8 @@ def _SignedVarintEncoder(): """Return an encoder for a basic signed varint value (does not include tag).""" - local_int2byte = six.int2byte + local_int2byte = struct.Struct('>B').pack + def EncodeSignedVarint(write, value, unused_deterministic=None): if value < 0: value += (1 << 64) @@ -420,8 +420,7 @@ def _VarintBytes(value): def TagBytes(field_number, wire_type): """Encode the given tag and return the bytes. Only called at startup.""" - return six.binary_type( - _VarintBytes(wire_format.PackTag(field_number, wire_type))) + return bytes(_VarintBytes(wire_format.PackTag(field_number, wire_type))) # -------------------------------------------------------------------- # As with sizers (see above), we have a number of common encoder diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/enum_type_wrapper.py b/contrib/python/protobuf/py3/google/protobuf/internal/enum_type_wrapper.py index 9ae0066584..9a53999a43 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/enum_type_wrapper.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/enum_type_wrapper.py @@ -37,8 +37,6 @@ on proto classes. For usage, see: __author__ = 'rabsatt@google.com (Kevin Rabsatt)' -import six - class EnumTypeWrapper(object): """A utility for finding the names of enum values.""" @@ -57,7 +55,7 @@ class EnumTypeWrapper(object): except KeyError: pass # fall out to break exception chaining - if not isinstance(number, six.integer_types): + if not isinstance(number, int): raise TypeError( 'Enum value for {} must be an int, but got {} {!r}.'.format( self._enum_type.name, type(number), number)) diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/python_message.py b/contrib/python/protobuf/py3/google/protobuf/internal/python_message.py index 99d2f078de..2921d5cb6e 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/python_message.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/python_message.py @@ -55,9 +55,6 @@ import struct import sys import weakref -import six -from six.moves import range - # We use "as" to avoid name collisions with variables. from google.protobuf.internal import api_implementation from google.protobuf.internal import containers @@ -284,13 +281,6 @@ def _IsMessageMapField(field): return value_type.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE -def _IsStrictUtf8Check(field): - if field.containing_type.syntax != 'proto3': - return False - enforce_utf8 = True - return enforce_utf8 - - def _AttachFieldHelpers(cls, field_descriptor): is_repeated = (field_descriptor.label == _FieldDescriptor.LABEL_REPEATED) is_packable = (is_repeated and @@ -348,11 +338,10 @@ def _AttachFieldHelpers(cls, field_descriptor): field_descriptor, _GetInitializeDefaultForMap(field_descriptor), is_message_map) elif decode_type == _FieldDescriptor.TYPE_STRING: - is_strict_utf8_check = _IsStrictUtf8Check(field_descriptor) field_decoder = decoder.StringDecoder( field_descriptor.number, is_repeated, is_packed, field_descriptor, field_descriptor._default_constructor, - is_strict_utf8_check, clear_if_default) + clear_if_default) elif field_descriptor.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: field_decoder = type_checkers.TYPE_TO_DECODER[decode_type]( field_descriptor.number, is_repeated, is_packed, @@ -485,7 +474,7 @@ def _ReraiseTypeErrorWithFieldName(message_name, field_name): exc = TypeError('%s for field %s.%s' % (str(exc), message_name, field_name)) # re-raise possibly-amended exception with original traceback: - six.reraise(type(exc), exc, sys.exc_info()[2]) + raise exc.with_traceback(sys.exc_info()[2]) def _AddInitMethod(message_descriptor, cls): @@ -498,7 +487,7 @@ def _AddInitMethod(message_descriptor, cls): enum_type with the same name. If the value is not a string, it's returned as-is. (No conversion or bounds-checking is done.) """ - if isinstance(value, six.string_types): + if isinstance(value, str): try: return enum_type.values_by_name[value].number except KeyError: @@ -1305,6 +1294,14 @@ def _AddIsInitializedMethod(message_descriptor, cls): cls.FindInitializationErrors = FindInitializationErrors +def _FullyQualifiedClassName(klass): + module = klass.__module__ + name = getattr(klass, '__qualname__', klass.__name__) + if module in (None, 'builtins', '__builtin__'): + return name + return module + '.' + name + + def _AddMergeFromMethod(cls): LABEL_REPEATED = _FieldDescriptor.LABEL_REPEATED CPPTYPE_MESSAGE = _FieldDescriptor.CPPTYPE_MESSAGE @@ -1313,7 +1310,8 @@ def _AddMergeFromMethod(cls): if not isinstance(msg, cls): raise TypeError( 'Parameter to MergeFrom() must be instance of same class: ' - 'expected %s got %s.' % (cls.__name__, msg.__class__.__name__)) + 'expected %s got %s.' % (_FullyQualifiedClassName(cls), + _FullyQualifiedClassName(msg.__class__))) assert msg is not self self._Modified() diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/type_checkers.py b/contrib/python/protobuf/py3/google/protobuf/internal/type_checkers.py index eb66f9f6fb..9b9b859e1e 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/type_checkers.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/type_checkers.py @@ -45,16 +45,8 @@ TYPE_TO_DESERIALIZE_METHOD: A dictionary with field types and deserialization __author__ = 'robinson@google.com (Will Robinson)' -try: - import ctypes -except Exception: # pylint: disable=broad-except - ctypes = None - import struct +import ctypes import numbers -import six - -if six.PY3: - long = int from google.protobuf.internal import api_implementation from google.protobuf.internal import decoder @@ -66,10 +58,7 @@ _FieldDescriptor = descriptor.FieldDescriptor def TruncateToFourByteFloat(original): - if ctypes: - return ctypes.c_float(original).value - else: - return struct.unpack('<f', struct.pack('<f', original))[0] + return ctypes.c_float(original).value def ToShortestFloat(original): @@ -162,14 +151,13 @@ class IntValueChecker(object): def CheckValue(self, proposed_value): if not isinstance(proposed_value, numbers.Integral): message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), six.integer_types)) + (proposed_value, type(proposed_value), (int,))) raise TypeError(message) if not self._MIN <= int(proposed_value) <= self._MAX: raise ValueError('Value out of range: %d' % proposed_value) - # We force 32-bit values to int and 64-bit values to long to make - # alternate implementations where the distinction is more significant - # (e.g. the C++ implementation) simpler. - proposed_value = self._TYPE(proposed_value) + # We force all values to int to make alternate implementations where the + # distinction is more significant (e.g. the C++ implementation) simpler. + proposed_value = int(proposed_value) return proposed_value def DefaultValue(self): @@ -186,7 +174,7 @@ class EnumValueChecker(object): def CheckValue(self, proposed_value): if not isinstance(proposed_value, numbers.Integral): message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), six.integer_types)) + (proposed_value, type(proposed_value), (int,))) raise TypeError(message) if int(proposed_value) not in self._enum_type.values_by_number: raise ValueError('Unknown enum value: %d' % proposed_value) @@ -204,9 +192,9 @@ class UnicodeValueChecker(object): """ def CheckValue(self, proposed_value): - if not isinstance(proposed_value, (bytes, six.text_type)): + if not isinstance(proposed_value, (bytes, str)): message = ('%.1024r has type %s, but expected one of: %s' % - (proposed_value, type(proposed_value), (bytes, six.text_type))) + (proposed_value, type(proposed_value), (bytes, str))) raise TypeError(message) # If the value is of type 'bytes' make sure that it is valid UTF-8 data. @@ -237,25 +225,21 @@ class Int32ValueChecker(IntValueChecker): # efficient. _MIN = -2147483648 _MAX = 2147483647 - _TYPE = int class Uint32ValueChecker(IntValueChecker): _MIN = 0 _MAX = (1 << 32) - 1 - _TYPE = int class Int64ValueChecker(IntValueChecker): _MIN = -(1 << 63) _MAX = (1 << 63) - 1 - _TYPE = long class Uint64ValueChecker(IntValueChecker): _MIN = 0 _MAX = (1 << 64) - 1 - _TYPE = long # The max 4 bytes float is about 3.4028234663852886e+38 diff --git a/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py b/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py index 6f55d6b17b..f14f1527ca 100644 --- a/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py +++ b/contrib/python/protobuf/py3/google/protobuf/internal/well_known_types.py @@ -43,7 +43,6 @@ __author__ = 'jieluo@google.com (Jie Luo)' import calendar from datetime import datetime from datetime import timedelta -import six try: # Since python 3 @@ -143,6 +142,8 @@ class Timestamp(object): Raises: ValueError: On parsing problems. """ + if not isinstance(value, str): + raise ValueError('Timestamp JSON value not a string: {!r}'.format(value)) timezone_offset = value.find('Z') if timezone_offset == -1: timezone_offset = value.find('+') @@ -303,6 +304,8 @@ class Duration(object): Raises: ValueError: On parsing problems. """ + if not isinstance(value, str): + raise ValueError('Duration JSON value not a string: {!r}'.format(value)) if len(value) < 1 or value[-1] != 's': raise ValueError( 'Duration must end with letter "s": {0}.'.format(value)) @@ -428,6 +431,8 @@ class FieldMask(object): def FromJsonString(self, value): """Converts string to FieldMask according to proto3 JSON spec.""" + if not isinstance(value, str): + raise ValueError('FieldMask JSON value not a string: {!r}'.format(value)) self.Clear() if value: for path in value.split(','): @@ -712,9 +717,6 @@ def _AddFieldPaths(node, prefix, field_mask): _AddFieldPaths(node[name], child_path, field_mask) -_INT_OR_FLOAT = six.integer_types + (float,) - - def _SetStructValue(struct_value, value): if value is None: struct_value.null_value = 0 @@ -722,9 +724,9 @@ def _SetStructValue(struct_value, value): # Note: this check must come before the number check because in Python # True and False are also considered numbers. struct_value.bool_value = value - elif isinstance(value, six.string_types): + elif isinstance(value, str): struct_value.string_value = value - elif isinstance(value, _INT_OR_FLOAT): + elif isinstance(value, (int, float)): struct_value.number_value = value elif isinstance(value, (dict, Struct)): struct_value.struct_value.Clear() diff --git a/contrib/python/protobuf/py3/google/protobuf/json_format.py b/contrib/python/protobuf/py3/google/protobuf/json_format.py index 965614d803..b3e85933e9 100644 --- a/contrib/python/protobuf/py3/google/protobuf/json_format.py +++ b/contrib/python/protobuf/py3/google/protobuf/json_format.py @@ -42,24 +42,15 @@ Simple usage example: __author__ = 'jieluo@google.com (Jie Luo)' -# pylint: disable=g-statement-before-imports,g-import-not-at-top -try: - from collections import OrderedDict -except ImportError: - from ordereddict import OrderedDict # PY26 -# pylint: enable=g-statement-before-imports,g-import-not-at-top import base64 +from collections import OrderedDict import json import math - from operator import methodcaller - import re import sys -import six - from google.protobuf.internal import type_checkers from google.protobuf import descriptor from google.protobuf import symbol_database @@ -78,9 +69,8 @@ _INFINITY = 'Infinity' _NEG_INFINITY = '-Infinity' _NAN = 'NaN' -_UNPAIRED_SURROGATE_PATTERN = re.compile(six.u( - r'[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]' -)) +_UNPAIRED_SURROGATE_PATTERN = re.compile( + u'[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]') _VALID_EXTENSION_NAME = re.compile(r'\[[a-zA-Z0-9\._]*\]$') @@ -426,7 +416,8 @@ def Parse(text, message, ignore_unknown_fields=False, descriptor_pool=None): Raises:: ParseError: On JSON parsing problems. """ - if not isinstance(text, six.text_type): text = text.decode('utf-8') + if not isinstance(text, str): + text = text.decode('utf-8') try: js = json.loads(text, object_pairs_hook=_DuplicateChecker) except ValueError as e: @@ -455,7 +446,7 @@ def ParseDict(js_dict, return message -_INT_OR_FLOAT = six.integer_types + (float,) +_INT_OR_FLOAT = (int, float) class _Parser(object): @@ -646,7 +637,7 @@ class _Parser(object): message.null_value = 0 elif isinstance(value, bool): message.bool_value = value - elif isinstance(value, six.string_types): + elif isinstance(value, str): message.string_value = value elif isinstance(value, _INT_OR_FLOAT): message.number_value = value @@ -729,7 +720,7 @@ def _ConvertScalarFieldValue(value, field, require_str=False): return _ConvertBool(value, require_str) elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING: if field.type == descriptor.FieldDescriptor.TYPE_BYTES: - if isinstance(value, six.text_type): + if isinstance(value, str): encoded = value.encode('utf-8') else: encoded = value @@ -776,7 +767,7 @@ def _ConvertInteger(value): if isinstance(value, float) and not value.is_integer(): raise ParseError('Couldn\'t parse integer: {0}.'.format(value)) - if isinstance(value, six.text_type) and value.find(' ') != -1: + if isinstance(value, str) and value.find(' ') != -1: raise ParseError('Couldn\'t parse integer: "{0}".'.format(value)) if isinstance(value, bool): diff --git a/contrib/python/protobuf/py3/google/protobuf/message_factory.py b/contrib/python/protobuf/py3/google/protobuf/message_factory.py index 7dfaec88e1..3656fa6874 100644 --- a/contrib/python/protobuf/py3/google/protobuf/message_factory.py +++ b/contrib/python/protobuf/py3/google/protobuf/message_factory.py @@ -98,8 +98,6 @@ class MessageFactory(object): A class describing the passed in descriptor. """ descriptor_name = descriptor.name - if str is bytes: # PY2 - descriptor_name = descriptor.name.encode('ascii', 'ignore') result_class = _GENERATED_PROTOCOL_MESSAGE_TYPE( descriptor_name, (message.Message,), diff --git a/contrib/python/protobuf/py3/google/protobuf/proto_api.h b/contrib/python/protobuf/py3/google/protobuf/proto_api.h index c869bce058..2e2156a56e 100644 --- a/contrib/python/protobuf/py3/google/protobuf/proto_api.h +++ b/contrib/python/protobuf/py3/google/protobuf/proto_api.h @@ -78,6 +78,18 @@ struct PyProto_API { // With the current implementation, only empty messages are in this case. virtual Message* GetMutableMessagePointer(PyObject* msg) const = 0; + // If the passed object is a Python Message Descriptor, returns its internal + // pointer. + // Otherwise, returns NULL with an exception set. + virtual const Descriptor* MessageDescriptor_AsDescriptor( + PyObject* desc) const = 0; + + // If the passed object is a Python Enum Descriptor, returns its internal + // pointer. + // Otherwise, returns NULL with an exception set. + virtual const EnumDescriptor* EnumDescriptor_AsDescriptor( + PyObject* enum_desc) const = 0; + // Expose the underlying DescriptorPool and MessageFactory to enable C++ code // to create Python-compatible message. virtual const DescriptorPool* GetDefaultDescriptorPool() const = 0; @@ -108,6 +120,15 @@ struct PyProto_API { // python objects referencing the same C++ object. virtual PyObject* NewMessageOwnedExternally( Message* msg, PyObject* py_message_factory) const = 0; + + // Returns a new reference for the given DescriptorPool. + // The returned object does not manage the C++ DescriptorPool: it is the + // responsibility of the caller to keep it alive. + // As long as the returned Python DescriptorPool object is kept alive, + // functions that process C++ descriptors or messages created from this pool + // can work and return their Python counterparts. + virtual PyObject* DescriptorPool_FromPool( + const google::protobuf::DescriptorPool* pool) const = 0; }; inline const char* PyProtoAPICapsuleName() { diff --git a/contrib/python/protobuf/py3/google/protobuf/proto_builder.py b/contrib/python/protobuf/py3/google/protobuf/proto_builder.py index 2b7dddcbd3..a4667ce63e 100644 --- a/contrib/python/protobuf/py3/google/protobuf/proto_builder.py +++ b/contrib/python/protobuf/py3/google/protobuf/proto_builder.py @@ -30,10 +30,7 @@ """Dynamic Protobuf class creator.""" -try: - from collections import OrderedDict -except ImportError: - from ordereddict import OrderedDict #PY26 +from collections import OrderedDict import hashlib import os diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor.cc index de788afa2f..cf18a1cbb4 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor.cc +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor.cc @@ -913,8 +913,9 @@ static int SetContainingType(PyBaseDescriptor *self, PyObject *value, } static PyObject* GetExtensionScope(PyBaseDescriptor *self, void *closure) { + const auto* desc = _GetDescriptor(self); const Descriptor* extension_scope = - _GetDescriptor(self)->extension_scope(); + desc->is_extension() ? desc->extension_scope() : nullptr; if (extension_scope) { return PyMessageDescriptor_FromDescriptor(extension_scope); } else { diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc index a53411e797..741dbfad5b 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.cc @@ -111,6 +111,8 @@ static PyDescriptorPool* _CreateDescriptorPool() { cpool->error_collector = nullptr; cpool->underlay = NULL; cpool->database = NULL; + cpool->is_owned = false; + cpool->is_mutable = false; cpool->descriptor_options = new std::unordered_map<const void*, PyObject*>(); @@ -138,6 +140,8 @@ static PyDescriptorPool* PyDescriptorPool_NewWithUnderlay( return NULL; } cpool->pool = new DescriptorPool(underlay); + cpool->is_owned = true; + cpool->is_mutable = true; cpool->underlay = underlay; if (!descriptor_pool_map->insert( @@ -159,10 +163,13 @@ static PyDescriptorPool* PyDescriptorPool_NewWithDatabase( if (database != NULL) { cpool->error_collector = new BuildFileErrorCollector(); cpool->pool = new DescriptorPool(database, cpool->error_collector); + cpool->is_mutable = false; cpool->database = database; } else { cpool->pool = new DescriptorPool(); + cpool->is_mutable = true; } + cpool->is_owned = true; if (!descriptor_pool_map->insert(std::make_pair(cpool->pool, cpool)).second) { // Should never happen -- would indicate an internal error / bug. @@ -201,7 +208,9 @@ static void Dealloc(PyObject* pself) { } delete self->descriptor_options; delete self->database; - delete self->pool; + if (self->is_owned) { + delete self->pool; + } delete self->error_collector; Py_TYPE(self)->tp_free(pself); } @@ -582,6 +591,12 @@ static PyObject* AddSerializedFile(PyObject* pself, PyObject* serialized_pb) { "Add your file to the underlying database."); return NULL; } + if (!self->is_mutable) { + PyErr_SetString( + PyExc_ValueError, + "This DescriptorPool is not mutable and cannot add new definitions."); + return nullptr; + } if (PyBytes_AsStringAndSize(serialized_pb, &message_type, &message_len) < 0) { return NULL; @@ -606,8 +621,9 @@ static PyObject* AddSerializedFile(PyObject* pself, PyObject* serialized_pb) { BuildFileErrorCollector error_collector; const FileDescriptor* descriptor = - self->pool->BuildFileCollectingErrors(file_proto, - &error_collector); + // Pool is mutable, we can remove the "const". + const_cast<DescriptorPool*>(self->pool) + ->BuildFileCollectingErrors(file_proto, &error_collector); if (descriptor == NULL) { PyErr_Format(PyExc_TypeError, "Couldn't build proto file into descriptor pool!\n%s", @@ -615,6 +631,7 @@ static PyObject* AddSerializedFile(PyObject* pself, PyObject* serialized_pb) { return NULL; } + return PyFileDescriptor_FromDescriptorWithSerializedPb( descriptor, serialized_pb); } @@ -768,6 +785,33 @@ PyDescriptorPool* GetDescriptorPool_FromPool(const DescriptorPool* pool) { return it->second; } +PyObject* PyDescriptorPool_FromPool(const DescriptorPool* pool) { + PyDescriptorPool* existing_pool = GetDescriptorPool_FromPool(pool); + if (existing_pool != nullptr) { + Py_INCREF(existing_pool); + return reinterpret_cast<PyObject*>(existing_pool); + } else { + PyErr_Clear(); + } + + PyDescriptorPool* cpool = cdescriptor_pool::_CreateDescriptorPool(); + if (cpool == nullptr) { + return nullptr; + } + cpool->pool = const_cast<DescriptorPool*>(pool); + cpool->is_owned = false; + cpool->is_mutable = false; + cpool->underlay = nullptr; + + if (!descriptor_pool_map->insert(std::make_pair(cpool->pool, cpool)).second) { + // Should never happen -- We already checked the existence above. + PyErr_SetString(PyExc_ValueError, "DescriptorPool already registered"); + return nullptr; + } + + return reinterpret_cast<PyObject*>(cpool); +} + } // namespace python } // namespace protobuf } // namespace google diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.h b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.h index 2d456f9088..48658d3e88 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.h +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/descriptor_pool.h @@ -54,10 +54,18 @@ struct CMessageClass; // "Methods" that interacts with this DescriptorPool are in the cdescriptor_pool // namespace. typedef struct PyDescriptorPool { - PyObject_HEAD + PyObject_HEAD; // The C++ pool containing Descriptors. - DescriptorPool* pool; + const DescriptorPool* pool; + + // True if we should free the pointer above. + bool is_owned; + + // True if this pool accepts new proto definitions. + // In this case it is allowed to const_cast<DescriptorPool*>(pool). + bool is_mutable; + // The error collector to store error info. Can be NULL. This pointer is // owned. @@ -116,16 +124,20 @@ PyObject* FindOneofByName(PyDescriptorPool* self, PyObject* arg); } // namespace cdescriptor_pool -// Retrieve the global descriptor pool owned by the _message module. +// Retrieves the global descriptor pool owned by the _message module. // This is the one used by pb2.py generated modules. // Returns a *borrowed* reference. // "Default" pool used to register messages from _pb2.py modules. PyDescriptorPool* GetDefaultDescriptorPool(); -// Retrieve the python descriptor pool owning a C++ descriptor pool. +// Retrieves an existing python descriptor pool owning the C++ descriptor pool. // Returns a *borrowed* reference. PyDescriptorPool* GetDescriptorPool_FromPool(const DescriptorPool* pool); +// Wraps a C++ descriptor pool in a Python object, creates it if necessary. +// Returns a new reference. +PyObject* PyDescriptorPool_FromPool(const DescriptorPool* pool); + // Initialize objects used by this module. bool InitDescriptorPool(); diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc index 8b41ca47dd..a9e464d7f9 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc @@ -110,6 +110,10 @@ class MessageReflectionFriend { const std::vector<const FieldDescriptor*>& fields) { lhs->GetReflection()->UnsafeShallowSwapFields(lhs, rhs, fields); } + static bool IsLazyField(const Reflection* reflection, + const FieldDescriptor* field) { + return reflection->IsLazyField(field); + } }; static PyObject* kDESCRIPTOR; @@ -478,6 +482,18 @@ static PyObject* GetAttr(CMessageClass* self, PyObject* name) { } // namespace message_meta +// Protobuf has a 64MB limit built in, this variable will override this. Please +// do not enable this unless you fully understand the implications: protobufs +// must all be kept in memory at the same time, so if they grow too big you may +// get OOM errors. The protobuf APIs do not provide any tools for processing +// protobufs in chunks. If you have protos this big you should break them up if +// it is at all convenient to do so. +#ifdef PROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS +static bool allow_oversize_protos = true; +#else +static bool allow_oversize_protos = false; +#endif + static PyTypeObject _CMessageClass_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) FULL_MODULE_NAME ".MessageMeta", // tp_name @@ -877,6 +893,7 @@ int FixupMessageAfterMerge(CMessage* self) { if (!self->composite_fields) { return 0; } + PyMessageFactory* factory = GetFactoryForMessage(self); for (const auto& item : *self->composite_fields) { const FieldDescriptor* descriptor = item.first; if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && @@ -890,8 +907,8 @@ int FixupMessageAfterMerge(CMessage* self) { if (reflection->HasField(*message, descriptor)) { // Message used to be read_only, but is no longer. Get the new pointer // and record it. - Message* mutable_message = - reflection->MutableMessage(message, descriptor, nullptr); + Message* mutable_message = reflection->MutableMessage( + message, descriptor, factory->message_factory); cmsg->message = mutable_message; cmsg->read_only = false; if (FixupMessageAfterMerge(cmsg) < 0) { @@ -1052,6 +1069,9 @@ int DeleteRepeatedField( } } + Arena* arena = Arena::InternalHelper<Message>::GetArenaForAllocation(message); + GOOGLE_DCHECK_EQ(arena, nullptr) + << "python protobuf is expected to be allocated from heap"; // Remove items, starting from the end. for (; length > to; length--) { if (field_descriptor->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { @@ -1060,7 +1080,18 @@ int DeleteRepeatedField( } // It seems that RemoveLast() is less efficient for sub-messages, and // the memory is not completely released. Prefer ReleaseLast(). - Message* sub_message = reflection->ReleaseLast(message, field_descriptor); + // + // 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). + // + // Note that arena is likely null and GOOGLE_DCHECK and ReleaesLast might be + // redundant. The current approach takes extra cautious path not to disrupt + // production. + Message* sub_message = + (arena == nullptr) + ? reflection->UnsafeArenaReleaseLast(message, field_descriptor) + : reflection->ReleaseLast(message, field_descriptor); // If there is a live weak reference to an item being removed, we "Release" // it, and it takes ownership of the message. if (CMessage* released = self->MaybeReleaseSubMessage(sub_message)) { @@ -1914,18 +1945,6 @@ static PyObject* CopyFrom(CMessage* self, PyObject* arg) { Py_RETURN_NONE; } -// Protobuf has a 64MB limit built in, this variable will override this. Please -// do not enable this unless you fully understand the implications: protobufs -// must all be kept in memory at the same time, so if they grow too big you may -// get OOM errors. The protobuf APIs do not provide any tools for processing -// protobufs in chunks. If you have protos this big you should break them up if -// it is at all convenient to do so. -#ifdef PROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS -static bool allow_oversize_protos = true; -#else -static bool allow_oversize_protos = false; -#endif - // Provide a method in the module to set allow_oversize_protos to a boolean // value. This method returns the newly value of allow_oversize_protos. PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg) { @@ -2265,8 +2284,6 @@ CMessage* InternalGetSubMessage( CMessage* self, const FieldDescriptor* field_descriptor) { const Reflection* reflection = self->message->GetReflection(); PyMessageFactory* factory = GetFactoryForMessage(self); - const Message& sub_message = reflection->GetMessage( - *self->message, field_descriptor, factory->message_factory); CMessageClass* message_class = message_factory::GetOrCreateMessageClass( factory, field_descriptor->message_type()); @@ -2284,7 +2301,20 @@ CMessage* InternalGetSubMessage( Py_INCREF(self); cmsg->parent = self; cmsg->parent_field_descriptor = field_descriptor; - cmsg->read_only = !reflection->HasField(*self->message, field_descriptor); + if (reflection->HasField(*self->message, field_descriptor)) { + // Force triggering MutableMessage to set the lazy message 'Dirty' + if (MessageReflectionFriend::IsLazyField(reflection, field_descriptor)) { + Message* sub_message = reflection->MutableMessage( + self->message, field_descriptor, factory->message_factory); + cmsg->read_only = false; + cmsg->message = sub_message; + return cmsg; + } + } else { + cmsg->read_only = true; + } + const Message& sub_message = reflection->GetMessage( + *self->message, field_descriptor, factory->message_factory); cmsg->message = const_cast<Message*>(&sub_message); return cmsg; } @@ -2867,20 +2897,36 @@ Message* PyMessage_GetMutableMessagePointer(PyObject* msg) { return cmsg->message; } -PyObject* PyMessage_New(const Descriptor* descriptor, - PyObject* py_message_factory) { +// Returns a new reference to the MessageClass to use for message creation. +// - if a PyMessageFactory is passed, use it. +// - Otherwise, if a PyDescriptorPool was created, use its factory. +static CMessageClass* GetMessageClassFromDescriptor( + const Descriptor* descriptor, PyObject* py_message_factory) { PyMessageFactory* factory = nullptr; if (py_message_factory == nullptr) { - factory = GetDescriptorPool_FromPool(descriptor->file()->pool()) - ->py_message_factory; + PyDescriptorPool* pool = + GetDescriptorPool_FromPool(descriptor->file()->pool()); + if (pool == nullptr) { + PyErr_SetString(PyExc_TypeError, + "Unknown descriptor pool; C++ users should call " + "DescriptorPool_FromPool and keep it alive"); + return nullptr; + } + factory = pool->py_message_factory; } else if (PyObject_TypeCheck(py_message_factory, &PyMessageFactory_Type)) { factory = reinterpret_cast<PyMessageFactory*>(py_message_factory); } else { PyErr_SetString(PyExc_TypeError, "Expected a MessageFactory"); return nullptr; } - auto* message_class = - message_factory::GetOrCreateMessageClass(factory, descriptor); + + return message_factory::GetOrCreateMessageClass(factory, descriptor); +} + +PyObject* PyMessage_New(const Descriptor* descriptor, + PyObject* py_message_factory) { + CMessageClass* message_class = + GetMessageClassFromDescriptor(descriptor, py_message_factory); if (message_class == nullptr) { return nullptr; } @@ -2895,20 +2941,8 @@ PyObject* PyMessage_New(const Descriptor* descriptor, PyObject* PyMessage_NewMessageOwnedExternally(Message* message, PyObject* py_message_factory) { - if (py_message_factory) { - PyErr_SetString(PyExc_NotImplementedError, - "Default message_factory=NULL is the only supported value"); - return nullptr; - } - if (message->GetReflection()->GetMessageFactory() != - MessageFactory::generated_factory()) { - PyErr_SetString(PyExc_TypeError, - "Message pointer was not created from the default factory"); - return nullptr; - } - - CMessageClass* message_class = message_factory::GetOrCreateMessageClass( - GetDefaultDescriptorPool()->py_message_factory, message->GetDescriptor()); + CMessageClass* message_class = GetMessageClassFromDescriptor( + message->GetDescriptor(), py_message_factory); if (message_class == nullptr) { return nullptr; } diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message_module.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/message_module.cc index b5975f76c5..4125dd73a1 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/message_module.cc +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message_module.cc @@ -31,6 +31,7 @@ #include <Python.h> #include <google/protobuf/message_lite.h> +#include <google/protobuf/pyext/descriptor.h> #include <google/protobuf/pyext/descriptor_pool.h> #include <google/protobuf/pyext/message.h> #include <google/protobuf/pyext/message_factory.h> @@ -46,6 +47,15 @@ struct ApiImplementation : google::protobuf::python::PyProto_API { google::protobuf::Message* GetMutableMessagePointer(PyObject* msg) const override { return google::protobuf::python::PyMessage_GetMutableMessagePointer(msg); } + const google::protobuf::Descriptor* MessageDescriptor_AsDescriptor( + PyObject* desc) const override { + return google::protobuf::python::PyMessageDescriptor_AsDescriptor(desc); + } + const google::protobuf::EnumDescriptor* EnumDescriptor_AsDescriptor( + PyObject* enum_desc) const override { + return google::protobuf::python::PyEnumDescriptor_AsDescriptor(enum_desc); + } + const google::protobuf::DescriptorPool* GetDefaultDescriptorPool() const override { return google::protobuf::python::GetDefaultDescriptorPool()->pool; } @@ -63,6 +73,10 @@ struct ApiImplementation : google::protobuf::python::PyProto_API { return google::protobuf::python::PyMessage_NewMessageOwnedExternally( msg, py_message_factory); } + PyObject* DescriptorPool_FromPool( + const google::protobuf::DescriptorPool* pool) const override { + return google::protobuf::python::PyDescriptorPool_FromPool(pool); + } }; } // namespace diff --git a/contrib/python/protobuf/py3/google/protobuf/text_encoding.py b/contrib/python/protobuf/py3/google/protobuf/text_encoding.py index 39898765f2..759cf11f62 100644 --- a/contrib/python/protobuf/py3/google/protobuf/text_encoding.py +++ b/contrib/python/protobuf/py3/google/protobuf/text_encoding.py @@ -31,8 +31,6 @@ """Encoding related utilities.""" import re -import six - _cescape_chr_to_symbol_map = {} _cescape_chr_to_symbol_map[9] = r'\t' # optional escape _cescape_chr_to_symbol_map[10] = r'\n' # optional escape @@ -72,14 +70,11 @@ def CEscape(text, as_utf8): # escapes whereas our C++ unescaping function allows hex escapes to be any # length. So, "\0011".encode('string_escape') ends up being "\\x011", which # will be decoded in C++ as a single-character string with char code 0x11. - if six.PY3: - text_is_unicode = isinstance(text, str) - if as_utf8 and text_is_unicode: - # We're already unicode, no processing beyond control char escapes. - return text.translate(_cescape_chr_to_symbol_map) - ord_ = ord if text_is_unicode else lambda x: x # bytes iterate as ints. - else: - ord_ = ord # PY2 + text_is_unicode = isinstance(text, str) + if as_utf8 and text_is_unicode: + # We're already unicode, no processing beyond control char escapes. + return text.translate(_cescape_chr_to_symbol_map) + ord_ = ord if text_is_unicode else lambda x: x # bytes iterate as ints. if as_utf8: return ''.join(_cescape_unicode_to_str[ord_(c)] for c in text) return ''.join(_cescape_byte_to_str[ord_(c)] for c in text) @@ -109,9 +104,7 @@ def CUnescape(text): # allow single-digit hex escapes (like '\xf'). result = _CUNESCAPE_HEX.sub(ReplaceHex, text) - if six.PY2: - return result.decode('string_escape') - return (result.encode('utf-8') # PY3: Make it bytes to allow decode. + return (result.encode('utf-8') # Make it bytes to allow decode. .decode('unicode_escape') # Make it bytes again to return the proper type. .encode('raw_unicode_escape')) diff --git a/contrib/python/protobuf/py3/google/protobuf/text_format.py b/contrib/python/protobuf/py3/google/protobuf/text_format.py index 9c4ca90ee6..412385c26f 100644 --- a/contrib/python/protobuf/py3/google/protobuf/text_format.py +++ b/contrib/python/protobuf/py3/google/protobuf/text_format.py @@ -48,16 +48,12 @@ import encodings.unicode_escape # pylint: disable=unused-import import io import math import re -import six from google.protobuf.internal import decoder from google.protobuf.internal import type_checkers from google.protobuf import descriptor from google.protobuf import text_encoding -if six.PY3: - long = int # pylint: disable=redefined-builtin,invalid-name - # pylint: disable=g-import-not-at-top __all__ = ['MessageToString', 'Parse', 'PrintMessage', 'PrintField', 'PrintFieldValue', 'Merge', 'MessageToBytes'] @@ -102,15 +98,9 @@ class ParseError(Error): class TextWriter(object): def __init__(self, as_utf8): - if six.PY2: - self._writer = io.BytesIO() - else: - self._writer = io.StringIO() + self._writer = io.StringIO() def write(self, val): - if six.PY2: - if isinstance(val, six.text_type): - val = val.encode('utf-8') return self._writer.write(val) def close(self): @@ -562,7 +552,7 @@ class _Printer(object): # Note: this is called only when value has at least one element. self._PrintFieldName(field) self.out.write(' [') - for i in six.moves.range(len(value) - 1): + for i in range(len(value) - 1): self.PrintFieldValue(field, value[i]) self.out.write(', ') self.PrintFieldValue(field, value[-1]) @@ -608,7 +598,7 @@ class _Printer(object): out.write(str(value)) elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING: out.write('\"') - if isinstance(value, six.text_type) and (six.PY2 or not self.as_utf8): + if isinstance(value, str) and not self.as_utf8: out_value = value.encode('utf-8') else: out_value = value @@ -839,12 +829,9 @@ class _Parser(object): ParseError: On text parsing problems. """ # Tokenize expects native str lines. - if six.PY2: - str_lines = (line if isinstance(line, str) else line.encode('utf-8') - for line in lines) - else: - str_lines = (line if isinstance(line, str) else line.decode('utf-8') - for line in lines) + str_lines = ( + line if isinstance(line, str) else line.decode('utf-8') + for line in lines) tokenizer = Tokenizer(str_lines) while not tokenizer.AtEnd(): self._MergeField(tokenizer, message) @@ -1395,17 +1382,14 @@ class Tokenizer(object): def TryConsumeInteger(self): try: - # Note: is_long only affects value type, not whether an error is raised. self.ConsumeInteger() return True except ParseError: return False - def ConsumeInteger(self, is_long=False): + def ConsumeInteger(self): """Consumes an integer number. - Args: - is_long: True if the value should be returned as a long integer. Returns: The integer parsed. @@ -1413,7 +1397,7 @@ class Tokenizer(object): ParseError: If an integer couldn't be consumed. """ try: - result = _ParseAbstractInteger(self.token, is_long=is_long) + result = _ParseAbstractInteger(self.token) except ValueError as e: raise self.ParseError(str(e)) self.NextToken() @@ -1476,7 +1460,7 @@ class Tokenizer(object): """ the_bytes = self.ConsumeByteString() try: - return six.text_type(the_bytes, 'utf-8') + return str(the_bytes, 'utf-8') except UnicodeDecodeError as e: raise self._StringParseError(e) @@ -1650,14 +1634,6 @@ def _ConsumeUint64(tokenizer): return _ConsumeInteger(tokenizer, is_signed=False, is_long=True) -def _TryConsumeInteger(tokenizer, is_signed=False, is_long=False): - try: - _ConsumeInteger(tokenizer, is_signed=is_signed, is_long=is_long) - return True - except ParseError: - return False - - def _ConsumeInteger(tokenizer, is_signed=False, is_long=False): """Consumes an integer number from tokenizer. @@ -1695,7 +1671,7 @@ def ParseInteger(text, is_signed=False, is_long=False): ValueError: Thrown Iff the text is not a valid integer. """ # Do the actual parsing. Exception handling is propagated to caller. - result = _ParseAbstractInteger(text, is_long=is_long) + result = _ParseAbstractInteger(text) # Check if the integer is sane. Exceptions handled by callers. checker = _INTEGER_CHECKERS[2 * int(is_long) + int(is_signed)] @@ -1703,12 +1679,11 @@ def ParseInteger(text, is_signed=False, is_long=False): return result -def _ParseAbstractInteger(text, is_long=False): +def _ParseAbstractInteger(text): """Parses an integer without checking size/signedness. Args: text: The text to parse. - is_long: True if the value should be returned as a long integer. Returns: The integer value. @@ -1724,13 +1699,7 @@ def _ParseAbstractInteger(text, is_long=False): # we always use the '0o' prefix for multi-digit numbers starting with 0. text = c_octal_match.group(1) + '0o' + c_octal_match.group(2) try: - # We force 32-bit values to int and 64-bit values to long to make - # alternate implementations where the distinction is more significant - # (e.g. the C++ implementation) simpler. - if is_long: - return long(text, 0) - else: - return int(text, 0) + return int(text, 0) except ValueError: raise ValueError('Couldn\'t parse integer: %s' % orig_text) |