diff options
author | pg <pg@yandex-team.com> | 2023-02-08 14:47:59 +0300 |
---|---|---|
committer | pg <pg@yandex-team.com> | 2023-02-08 14:47:59 +0300 |
commit | 2999295666a93b51c9226cee88ea70b996d43727 (patch) | |
tree | 6cd1a5290a2653689a33c6269c0eebb7dd05729d | |
parent | e615f3f87f0fc3dcc0d45c304883339ab1eab8c1 (diff) | |
download | ydb-2999295666a93b51c9226cee88ea70b996d43727.tar.gz |
3.19.0
177 files changed, 8550 insertions, 6081 deletions
diff --git a/contrib/libs/protobuf/CHANGES.txt b/contrib/libs/protobuf/CHANGES.txt index b7866d502b..db6194529d 100644 --- a/contrib/libs/protobuf/CHANGES.txt +++ b/contrib/libs/protobuf/CHANGES.txt @@ -1,10 +1,46 @@ -2022-09-13 version 18.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby) +2021-10-15 version 3.19.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) - -2022-01-05 version 3.18.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + C++ + * Make proto2::Message::DiscardUnknownFields() non-virtual + * Separate RepeatedPtrField into its own header file + * For default floating point values of 0, consider all bits significant + * cmake: support `MSVC_RUNTIME_LIBRARY` property (#8851) + * Fix shadowing warnings (#8926) + * Fix for issue #8484, constant initialization doesn't compile in msvc clang-cl environment (#8993) + * Fix build on AIX and SunOS (#8373) (#9065) + * Add Android stlport and default toolchains to BUILD. (#8290) Java - * Improve performance characteristics of UnknownFieldSet parsing (#9371) + * For default floating point values of 0, consider all bits significant + * Annotate `//java/com/google/protobuf/util/...` with nullness annotations + * Use ArrayList copy constructor (#7853) + + Kotlin + * Switch Kotlin proto DSLs to be implemented with inline value classes + + Python + * Proto2 DecodeError now includes message name in error message + * Make MessageToDict convert map keys to strings (#8122) + * Add python-requires in setup.py (#8989) + * Add python 3.10 (#9034) + + JavaScript + * Skip exports if not available by CommonJS (#8856) + * JS: Comply with CSP no-unsafe-eval. (#8864) + + PHP + * Added "object" as a reserved name for PHP (#8962) + + Ruby + * Override Map.clone to use Map's dup method (#7938) + * Ruby: build extensions for arm64-darwin (#8232) + * Add class method Timestamp.from_time to ruby well known types (#8562) + * Adopt pure ruby DSL implementation for JRuby (#9047) + * Add size to Map class (#8068) + + C# + * Correctly set ExtensionRegistry when parsing with MessageParser, but using an already existing CodedInputStream (#7246) + * [C#] Make FieldDescriptor propertyName public (#7642) 2021-10-04 version 3.18.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) @@ -17,6 +53,46 @@ 2021-09-13 version 3.18.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Python + * Removed Python 2.x support. + * Pure python descriptor_pool.AddSerializedFile() will always build the + file and return FileDescriptor which is same with python c++ extension + * type errors thrown by MergeFrom now report fully qualified class names + * Protobuf python generated code are simplified. Some platforms that uses + "is"("is not") to compare the enum or descriptor's label/type may fail, + should use "=="("!=") instead. + + C++ + * Generated code now uses the c++11 standard integer types int{32,64}_t and + uint{32,64}_t + * Reduce memory usage of the DescriptorPool type. + * Moved the zero-argument New() method on messages to the base class (internal + optimization). + * Unused return values marked with `PROTOBUF_MUST_USE_RESULT` are now + correctly attributed. + * Demotes PrintPath log for maps in MessageDifferencer down from WARNING to + INFO. + * Make sure FullMessageName() is always private. + * Fix race condition in EnumDescriptor. + * Remove MessageLite::GetMaybeArenaPointer. + + Java + * Add @deprecated javadoc for set/get/has methods + * correctly decode \? escape sequence in text protos + * Avoid depending on Objects.requireNonNull() until we can verify that no + users are depending on older Android versions. + * disallow null string map values in put and putAll + * Add `@CheckReturnValue` to `ByteString` API. + * Make the `hasPresence` method public in `FieldDescriptor`. + * Report more detailed messages in Duration and Timestamp proto parsing + errors. + * New Timestamps.fromDate utility method that converts a java.util.Date to a + Timestamp proto object. + + Kotlin + * Generated Kotlin code is Explicit API mode compatible + +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) @@ -48,6 +124,7 @@ * 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 + * Reduce memory usage of the DescriptorPool type. Java * Fix errorprone conflict (#8723) @@ -80,7 +157,14 @@ * field_presence.md: fix Go example (#8788) + Kotlin + * Suppress NOTHING_TO_INLINE in Kotlin generated inline functions. + 2021-06-04 version 3.17.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Python + * Note: This is the last release to support Python 2.7. Future releases will + require Python >= 3.5. + C++ * Introduce FieldAccessListener. * Stop emitting boilerplate {Copy/Merge}From in each ProtoBuf class diff --git a/contrib/libs/protobuf/CMakeLists.darwin.txt b/contrib/libs/protobuf/CMakeLists.darwin.txt index 6bc952df1f..f0ac46e99e 100644 --- a/contrib/libs/protobuf/CMakeLists.darwin.txt +++ b/contrib/libs/protobuf/CMakeLists.darwin.txt @@ -44,6 +44,8 @@ target_sources(contrib-libs-protobuf PRIVATE ${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/generated_message_tctable_full.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_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 @@ -64,6 +66,7 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/parse_context.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/service.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc @@ -97,7 +100,6 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc - ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/json_util.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc diff --git a/contrib/libs/protobuf/CMakeLists.linux-aarch64.txt b/contrib/libs/protobuf/CMakeLists.linux-aarch64.txt index 3d69f1017f..85d6338b80 100644 --- a/contrib/libs/protobuf/CMakeLists.linux-aarch64.txt +++ b/contrib/libs/protobuf/CMakeLists.linux-aarch64.txt @@ -45,6 +45,8 @@ target_sources(contrib-libs-protobuf PRIVATE ${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/generated_message_tctable_full.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_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 @@ -65,6 +67,7 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/parse_context.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/service.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc @@ -98,7 +101,6 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc - ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/json_util.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc diff --git a/contrib/libs/protobuf/CMakeLists.linux.txt b/contrib/libs/protobuf/CMakeLists.linux.txt index 3d69f1017f..85d6338b80 100644 --- a/contrib/libs/protobuf/CMakeLists.linux.txt +++ b/contrib/libs/protobuf/CMakeLists.linux.txt @@ -45,6 +45,8 @@ target_sources(contrib-libs-protobuf PRIVATE ${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/generated_message_tctable_full.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_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 @@ -65,6 +67,7 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/parse_context.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/service.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc @@ -98,7 +101,6 @@ target_sources(contrib-libs-protobuf PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc - ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/internal/utility.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/json_util.cc ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc diff --git a/contrib/libs/protobuf/CONTRIBUTING.md b/contrib/libs/protobuf/CONTRIBUTING.md index db1ff31cac..8ef5dd29c8 100644 --- a/contrib/libs/protobuf/CONTRIBUTING.md +++ b/contrib/libs/protobuf/CONTRIBUTING.md @@ -1,9 +1,31 @@ # Contributing to Protocol Buffers -We welcome your contributions to protocol buffers. This doc describes the +We welcome some types of contributions to protocol buffers. This doc describes the process to contribute patches to protobuf and the general guidelines we expect contributors to follow. +## What We Accept + +* Bug fixes with unit tests demonstrating the problem are very welcome. + We also appreciate bug reports, even when they don't come with a patch. + Bug fixes without tests are usually not accepted. +* New APIs and features with adequate test coverage and documentation + may be accepted if they do not compromise backwards + compatibility. However there's a fairly high bar of usefulness a new public + method must clear before it will be accepted. Features that are fine in + isolation are often rejected because they don't have enough impact to justify the + conceptual burden and ongoing maintenance cost. It's best to file an issue + and get agreement from maintainers on the value of a new feature before + working on a PR. +* Performance optimizations may be accepted if they have convincing benchmarks that demonstrate + an improvement and they do not significantly increase complexity. +* Changes to existing APIs are almost never accepted. Stability and + backwards compatibility are paramount. In the unlikely event a breaking change + is required, it must usually be implemented in google3 first. +* Changes to the wire and text formats are never accepted. Any breaking change + to these formats would have to be implemented as a completely new format. + We cannot begin generating protos that cannot be parsed by existing code. + ## Before You Start We accept patches in the form of github pull requests. If you are new to @@ -58,7 +80,7 @@ the final release. * Create small PRs that are narrowly focused on addressing a single concern. We often receive PRs that are trying to fix several things at a time, but if only one fix is considered acceptable, nothing gets merged and both author's - & review's time is wasted. Create more PRs to address different concerns and + & reviewer's time is wasted. Create more PRs to address different concerns and everyone will be happy. * For speculative changes, consider opening an issue and discussing it first. If you are suggesting a behavioral or API change, make sure you get explicit diff --git a/contrib/libs/protobuf/src/README.md b/contrib/libs/protobuf/src/README.md index 51d9e2fe38..9db40fdde4 100644 --- a/contrib/libs/protobuf/src/README.md +++ b/contrib/libs/protobuf/src/README.md @@ -19,7 +19,7 @@ To build protobuf from source, the following tools are needed: On Ubuntu/Debian, you can install them with: - $ sudo apt-get install autoconf automake libtool curl make g++ unzip + sudo apt-get install autoconf automake libtool curl make g++ unzip On other platforms, please use the corresponding package managing tool to install them before proceeding. diff --git a/contrib/libs/protobuf/src/google/protobuf/any.cc b/contrib/libs/protobuf/src/google/protobuf/any.cc index 955dd80b5b..73c002f604 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any.cc +++ b/contrib/libs/protobuf/src/google/protobuf/any.cc @@ -45,13 +45,11 @@ bool AnyMetadata::PackFrom(Arena* arena, const Message& message) { return PackFrom(arena, message, kTypeGoogleApisComPrefix); } -bool AnyMetadata::PackFrom(Arena* arena, - const Message& message, +bool AnyMetadata::PackFrom(Arena* arena, const Message& message, StringPiece type_url_prefix) { type_url_->Set( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString(), - GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), - arena); + GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena); return message.SerializeToString( value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena)); } @@ -72,9 +70,9 @@ bool GetAnyFieldDescriptors(const Message& message, } *type_url_field = descriptor->FindFieldByNumber(1); *value_field = descriptor->FindFieldByNumber(2); - return (*type_url_field != NULL && + return (*type_url_field != nullptr && (*type_url_field)->type() == FieldDescriptor::TYPE_STRING && - *value_field != NULL && + *value_field != nullptr && (*value_field)->type() == FieldDescriptor::TYPE_BYTES); } diff --git a/contrib/libs/protobuf/src/google/protobuf/any.h b/contrib/libs/protobuf/src/google/protobuf/any.h index 555d5136a9..3b9e81d2ff 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any.h +++ b/contrib/libs/protobuf/src/google/protobuf/any.h @@ -82,11 +82,14 @@ class PROTOBUF_EXPORT AnyMetadata { // URL: "type.googleapis.com/<message_full_name>". // Returns false if serializing the message failed. template <typename T> - bool PackFrom(Arena* arena, const T& message, StringPiece type_url_prefix) { - return InternalPackFrom(arena, message, type_url_prefix, T::FullMessageName()); + bool PackFrom(Arena* arena, const T& message, + StringPiece type_url_prefix) { + return InternalPackFrom(arena, message, type_url_prefix, + T::FullMessageName()); } - bool PackFrom(Arena* arena, const Message& message, StringPiece type_url_prefix); + bool PackFrom(Arena* arena, const Message& message, + StringPiece type_url_prefix); // Unpacks the payload into the given message. Returns false if the message's // type doesn't match the type specified in the type URL (i.e., the full @@ -108,8 +111,7 @@ class PROTOBUF_EXPORT AnyMetadata { } private: - bool InternalPackFrom(Arena* arena, - const MessageLite& message, + bool InternalPackFrom(Arena* arena, const MessageLite& message, StringPiece type_url_prefix, StringPiece type_name); bool InternalUnpackTo(StringPiece type_name, diff --git a/contrib/libs/protobuf/src/google/protobuf/any.pb.cc b/contrib/libs/protobuf/src/google/protobuf/any.pb.cc index 0bef6281b4..eb5dac86cc 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/any.pb.cc @@ -36,7 +36,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_), ~0u, // no _extensions_ @@ -112,11 +112,17 @@ Any::Any(const Any& from) _any_metadata_(&type_url_, &value_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_type_url().empty()) { type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(), GetArenaForAllocation()); } value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_value().empty()) { value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), GetArenaForAllocation()); @@ -124,9 +130,15 @@ Any::Any(const Any& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) } -void Any::SharedCtor() { +inline void Any::SharedCtor() { type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } Any::~Any() { @@ -154,7 +166,7 @@ void Any::SetCachedSize(int size) const { void Any::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Any) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -166,12 +178,12 @@ void Any::Clear() { const char* Any::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string type_url = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_type_url(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url")); @@ -181,7 +193,7 @@ const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern continue; // bytes value = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); @@ -211,10 +223,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Any::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Any::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string type_url = 1; @@ -245,7 +257,7 @@ size_t Any::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -282,7 +294,7 @@ void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Any::MergeFrom(const Any& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_type_url().empty()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/any.pb.h b/contrib/libs/protobuf/src/google/protobuf/any.pb.h index ab1d1dae11..833596f47e 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -153,7 +153,12 @@ class PROTOBUF_EXPORT Any final : } inline void Swap(Any* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -167,11 +172,7 @@ class PROTOBUF_EXPORT Any final : // implements Message ---------------------------------------------- - inline Any* New() const final { - return new Any(); - } - - Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Any>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -186,8 +187,8 @@ class PROTOBUF_EXPORT Any 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -195,6 +196,8 @@ class PROTOBUF_EXPORT Any final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Any* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Any"; @@ -226,7 +229,7 @@ class PROTOBUF_EXPORT Any final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_type_url(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_type_url(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_type_url(); + PROTOBUF_NODISCARD TProtoStringType* release_type_url(); void set_allocated_type_url(TProtoStringType* type_url); private: const TProtoStringType& _internal_type_url() const; @@ -240,7 +243,7 @@ class PROTOBUF_EXPORT Any final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_value(); + PROTOBUF_NODISCARD TProtoStringType* release_value(); void set_allocated_value(TProtoStringType* value); private: const TProtoStringType& _internal_value() const; @@ -315,6 +318,11 @@ inline void Any::set_allocated_type_url(TProtoStringType* type_url) { } type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url) } @@ -361,6 +369,11 @@ inline void Any::set_allocated_value(TProtoStringType* value) { } value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value) } diff --git a/contrib/libs/protobuf/src/google/protobuf/any_lite.cc b/contrib/libs/protobuf/src/google/protobuf/any_lite.cc index c96862d5ea..5be2d7c401 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/any_lite.cc @@ -53,8 +53,7 @@ const char kAnyFullTypeName[] = "google.protobuf.Any"; const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/"; const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/"; -bool AnyMetadata::InternalPackFrom(Arena* arena, - const MessageLite& message, +bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message, StringPiece type_url_prefix, StringPiece type_name) { type_url_->Set(&::google::protobuf::internal::GetEmptyString(), diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.cc b/contrib/libs/protobuf/src/google/protobuf/api.pb.cc index 5cca2f161d..bdaaa52ae1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/api.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/api.pb.cc @@ -73,7 +73,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_), ~0u, // no _extensions_ @@ -200,11 +200,17 @@ Api::Api(const Api& from) mixins_(from.mixins_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_version().empty()) { version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(), GetArenaForAllocation()); @@ -218,9 +224,15 @@ Api::Api(const Api& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Api) } -void Api::SharedCtor() { +inline void Api::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) - @@ -253,7 +265,7 @@ void Api::SetCachedSize(int size) const { void Api::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Api) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -273,12 +285,12 @@ void Api::Clear() { const char* Api::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.name")); @@ -288,7 +300,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern continue; // repeated .google.protobuf.Method methods = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -301,7 +313,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern continue; // repeated .google.protobuf.Option options = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -314,7 +326,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern continue; // string version = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { auto str = _internal_mutable_version(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.version")); @@ -324,7 +336,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern continue; // .google.protobuf.SourceContext source_context = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); } else @@ -332,7 +344,7 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern continue; // repeated .google.protobuf.Mixin mixins = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -345,8 +357,8 @@ const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::intern 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); } else @@ -375,10 +387,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Api::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -452,7 +464,7 @@ size_t Api::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -523,7 +535,7 @@ void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Api::MergeFrom(const Api& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; methods_.MergeFrom(from.methods_); @@ -611,16 +623,25 @@ Method::Method(const Method& from) options_(from.options_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_request_type_url().empty()) { request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(), GetArenaForAllocation()); } response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_response_type_url().empty()) { response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(), GetArenaForAllocation()); @@ -631,10 +652,19 @@ Method::Method(const Method& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) } -void Method::SharedCtor() { +inline void Method::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&request_streaming_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) - @@ -667,7 +697,7 @@ void Method::SetCachedSize(int size) const { void Method::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Method) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -684,12 +714,12 @@ void Method::Clear() { const char* Method::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.name")); @@ -699,7 +729,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int continue; // string request_type_url = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_request_type_url(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.request_type_url")); @@ -709,7 +739,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int continue; // bool request_streaming = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -717,7 +747,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int continue; // string response_type_url = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { auto str = _internal_mutable_response_type_url(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.response_type_url")); @@ -727,7 +757,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int continue; // bool response_streaming = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -735,7 +765,7 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int continue; // repeated .google.protobuf.Option options = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -748,8 +778,8 @@ const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); } else @@ -778,10 +808,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Method::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -853,7 +883,7 @@ size_t Method::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -920,7 +950,7 @@ void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Method::MergeFrom(const Method& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; options_.MergeFrom(from.options_); @@ -1010,11 +1040,17 @@ Mixin::Mixin(const Mixin& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_root().empty()) { root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(), GetArenaForAllocation()); @@ -1022,9 +1058,15 @@ Mixin::Mixin(const Mixin& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin) } -void Mixin::SharedCtor() { +inline void Mixin::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } Mixin::~Mixin() { @@ -1052,7 +1094,7 @@ void Mixin::SetCachedSize(int size) const { void Mixin::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1064,12 +1106,12 @@ void Mixin::Clear() { const char* Mixin::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.name")); @@ -1079,7 +1121,7 @@ const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // string root = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_root(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.root")); @@ -1110,10 +1152,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Mixin::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -1148,7 +1190,7 @@ size_t Mixin::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1185,7 +1227,7 @@ void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Mixin::MergeFrom(const Mixin& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_name().empty()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.h b/contrib/libs/protobuf/src/google/protobuf/api.pb.h index a17787abcc..85e5252b82 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -52,7 +52,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -130,7 +130,12 @@ class PROTOBUF_EXPORT Api final : } inline void Swap(Api* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -144,11 +149,7 @@ class PROTOBUF_EXPORT Api final : // implements Message ---------------------------------------------- - inline Api* New() const final { - return new Api(); - } - - Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Api>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -163,8 +164,8 @@ class PROTOBUF_EXPORT Api 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -172,6 +173,8 @@ class PROTOBUF_EXPORT Api final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Api* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Api"; @@ -262,7 +265,7 @@ class PROTOBUF_EXPORT Api final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -276,7 +279,7 @@ class PROTOBUF_EXPORT Api final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_version(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_version(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_version(); + PROTOBUF_NODISCARD TProtoStringType* release_version(); void set_allocated_version(TProtoStringType* version); private: const TProtoStringType& _internal_version() const; @@ -291,7 +294,7 @@ class PROTOBUF_EXPORT Api final : 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_NODISCARD ::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: @@ -385,7 +388,12 @@ class PROTOBUF_EXPORT Method final : } inline void Swap(Method* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -399,11 +407,7 @@ class PROTOBUF_EXPORT Method final : // implements Message ---------------------------------------------- - inline Method* New() const final { - return new Method(); - } - - Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Method>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -418,8 +422,8 @@ class PROTOBUF_EXPORT Method 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -427,6 +431,8 @@ class PROTOBUF_EXPORT Method final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Method* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Method"; @@ -481,7 +487,7 @@ class PROTOBUF_EXPORT Method final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -495,7 +501,7 @@ class PROTOBUF_EXPORT Method final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_request_type_url(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_request_type_url(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_request_type_url(); + PROTOBUF_NODISCARD TProtoStringType* release_request_type_url(); void set_allocated_request_type_url(TProtoStringType* request_type_url); private: const TProtoStringType& _internal_request_type_url() const; @@ -509,7 +515,7 @@ class PROTOBUF_EXPORT Method final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_response_type_url(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_response_type_url(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_response_type_url(); + PROTOBUF_NODISCARD TProtoStringType* release_response_type_url(); void set_allocated_response_type_url(TProtoStringType* response_type_url); private: const TProtoStringType& _internal_response_type_url() const; @@ -618,7 +624,12 @@ class PROTOBUF_EXPORT Mixin final : } inline void Swap(Mixin* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -632,11 +643,7 @@ class PROTOBUF_EXPORT Mixin final : // implements Message ---------------------------------------------- - inline Mixin* New() const final { - return new Mixin(); - } - - Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Mixin>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -651,8 +658,8 @@ class PROTOBUF_EXPORT Mixin 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -660,6 +667,8 @@ class PROTOBUF_EXPORT Mixin final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Mixin* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Mixin"; @@ -691,7 +700,7 @@ class PROTOBUF_EXPORT Mixin final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -705,7 +714,7 @@ class PROTOBUF_EXPORT Mixin final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_root(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_root(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_root(); + PROTOBUF_NODISCARD TProtoStringType* release_root(); void set_allocated_root(TProtoStringType* root); private: const TProtoStringType& _internal_root() const; @@ -779,6 +788,11 @@ inline void Api::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name) } @@ -902,6 +916,11 @@ inline void Api::set_allocated_version(TProtoStringType* version) { } version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version) } @@ -1098,6 +1117,11 @@ inline void Method::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name) } @@ -1144,6 +1168,11 @@ inline void Method::set_allocated_request_type_url(TProtoStringType* request_typ } request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (request_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url) } @@ -1210,6 +1239,11 @@ inline void Method::set_allocated_response_type_url(TProtoStringType* response_t } response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (response_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url) } @@ -1337,6 +1371,11 @@ inline void Mixin::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name) } @@ -1383,6 +1422,11 @@ inline void Mixin::set_allocated_root(TProtoStringType* root) { } root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (root_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root) } diff --git a/contrib/libs/protobuf/src/google/protobuf/arena.cc b/contrib/libs/protobuf/src/google/protobuf/arena.cc index 5fbead99d8..e3047f9669 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena.cc +++ b/contrib/libs/protobuf/src/google/protobuf/arena.cc @@ -216,31 +216,54 @@ PROTOBUF_THREAD_LOCAL ThreadSafeArena::ThreadCache void ThreadSafeArena::InitializeFrom(void* mem, size_t size) { GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) & 7, 0u); - Init(false); + GOOGLE_DCHECK(!AllocPolicy()); // Reset should call InitializeWithPolicy instead. + Init(); // Ignore initial block if it is too small. if (mem != nullptr && size >= kBlockHeaderSize + kSerialArenaSize) { - alloc_policy_ |= kUserOwnedInitialBlock; + alloc_policy_.set_is_user_owned_initial_block(true); SetInitialBlock(mem, size); } } void ThreadSafeArena::InitializeWithPolicy(void* mem, size_t size, - bool record_allocs, AllocationPolicy policy) { +#ifndef NDEBUG + const arc_ui64 old_alloc_policy = alloc_policy_.get_raw(); + // If there was a policy (e.g., in Reset()), make sure flags were preserved. +#define GOOGLE_DCHECK_POLICY_FLAGS_() \ + if (old_alloc_policy > 3) \ + GOOGLE_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3) +#else +#define GOOGLE_DCHECK_POLICY_FLAGS_() +#endif // NDEBUG + + if (policy.IsDefault()) { + // Legacy code doesn't use the API above, but provides the initial block + // through ArenaOptions. I suspect most do not touch the allocation + // policy parameters. + InitializeFrom(mem, size); + GOOGLE_DCHECK_POLICY_FLAGS_(); + return; + } GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) & 7, 0u); - - Init(record_allocs); + Init(); // Ignore initial block if it is too small. We include an optional // AllocationPolicy in this check, so that this can be allocated on the // first block. constexpr size_t kAPSize = internal::AlignUpTo8(sizeof(AllocationPolicy)); constexpr size_t kMinimumSize = kBlockHeaderSize + kSerialArenaSize + kAPSize; + + // The value for alloc_policy_ stores whether or not allocations should be + // recorded. + alloc_policy_.set_should_record_allocs( + policy.metrics_collector != nullptr && + policy.metrics_collector->RecordAllocs()); + // Make sure we have an initial block to store the AllocationPolicy. if (mem != nullptr && size >= kMinimumSize) { - alloc_policy_ = kUserOwnedInitialBlock; + alloc_policy_.set_is_user_owned_initial_block(true); } else { - alloc_policy_ = 0; auto tmp = AllocateMemory(&policy, 0, kMinimumSize); mem = tmp.ptr; size = tmp.size; @@ -255,10 +278,18 @@ void ThreadSafeArena::InitializeWithPolicy(void* mem, size_t size, return; } new (p) AllocationPolicy{policy}; - alloc_policy_ |= reinterpret_cast<intptr_t>(p); + // Low bits store flags, so they mustn't be overwritten. + GOOGLE_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3); + alloc_policy_.set_policy(reinterpret_cast<AllocationPolicy*>(p)); + GOOGLE_DCHECK_POLICY_FLAGS_(); + +#undef GOOGLE_DCHECK_POLICY_FLAGS_ } -void ThreadSafeArena::Init(bool record_allocs) { +void ThreadSafeArena::Init() { +#ifndef NDEBUG + const bool was_message_owned = IsMessageOwned(); +#endif // NDEBUG ThreadCache& tc = thread_cache(); auto id = tc.next_lifecycle_id; // We increment lifecycle_id's by multiples of two so we can use bit 0 as @@ -273,9 +304,14 @@ void ThreadSafeArena::Init(bool record_allocs) { id = lifecycle_id_generator_.id.fetch_add(1, relaxed) * kInc; } tc.next_lifecycle_id = id + kDelta; - tag_and_id_ = id | (record_allocs ? kRecordAllocs : 0); + // Message ownership is stored in tag_and_id_, and is set in the constructor. + // This flag bit must be preserved, even across calls to Reset(). + tag_and_id_ = id | (tag_and_id_ & kMessageOwnedArena); hint_.store(nullptr, std::memory_order_relaxed); threads_.store(nullptr, std::memory_order_relaxed); +#ifndef NDEBUG + GOOGLE_CHECK_EQ(was_message_owned, IsMessageOwned()); +#endif // NDEBUG } void ThreadSafeArena::SetInitialBlock(void* mem, size_t size) { @@ -294,13 +330,13 @@ ThreadSafeArena::~ThreadSafeArena() { auto mem = Free(&space_allocated); // Policy is about to get deleted. - auto p = AllocPolicy(); + auto* p = alloc_policy_.get(); ArenaMetricsCollector* collector = p ? p->metrics_collector : nullptr; - if (alloc_policy_ & kUserOwnedInitialBlock) { + if (alloc_policy_.is_user_owned_initial_block()) { space_allocated += mem.size; } else { - GetDeallocator(AllocPolicy(), &space_allocated)(mem); + GetDeallocator(alloc_policy_.get(), &space_allocated)(mem); } if (collector) collector->OnDestroy(space_allocated); @@ -308,7 +344,7 @@ ThreadSafeArena::~ThreadSafeArena() { SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) { SerialArena::Memory mem = {nullptr, 0}; - auto deallocator = GetDeallocator(AllocPolicy(), space_allocated); + auto deallocator = GetDeallocator(alloc_policy_.get(), space_allocated); PerSerialArena([deallocator, &mem](SerialArena* a) { if (mem.ptr) deallocator(mem); mem = a->Free(deallocator); @@ -325,26 +361,28 @@ arc_ui64 ThreadSafeArena::Reset() { size_t space_allocated = 0; auto mem = Free(&space_allocated); - if (AllocPolicy()) { - auto saved_policy = *AllocPolicy(); - if (alloc_policy_ & kUserOwnedInitialBlock) { + AllocationPolicy* policy = alloc_policy_.get(); + if (policy) { + auto saved_policy = *policy; + if (alloc_policy_.is_user_owned_initial_block()) { space_allocated += mem.size; } else { - GetDeallocator(AllocPolicy(), &space_allocated)(mem); + GetDeallocator(alloc_policy_.get(), &space_allocated)(mem); mem.ptr = nullptr; mem.size = 0; } ArenaMetricsCollector* collector = saved_policy.metrics_collector; if (collector) collector->OnReset(space_allocated); - InitializeWithPolicy(mem.ptr, mem.size, ShouldRecordAlloc(), saved_policy); + InitializeWithPolicy(mem.ptr, mem.size, saved_policy); } else { + GOOGLE_DCHECK(!alloc_policy_.should_record_allocs()); // Nullptr policy - if (alloc_policy_ & kUserOwnedInitialBlock) { + if (alloc_policy_.is_user_owned_initial_block()) { space_allocated += mem.size; InitializeFrom(mem.ptr, mem.size); } else { - GetDeallocator(AllocPolicy(), &space_allocated)(mem); - Init(false); + GetDeallocator(alloc_policy_.get(), &space_allocated)(mem); + Init(); } } @@ -355,8 +393,9 @@ std::pair<void*, SerialArena::CleanupNode*> ThreadSafeArena::AllocateAlignedWithCleanup(size_t n, const std::type_info* type) { SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(tag_and_id_, &arena))) { - return arena->AllocateAlignedWithCleanup(n, AllocPolicy()); + if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && + GetSerialArenaFast(&arena))) { + return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get()); } else { return AllocateAlignedWithCleanupFallback(n, type); } @@ -364,46 +403,39 @@ ThreadSafeArena::AllocateAlignedWithCleanup(size_t n, void ThreadSafeArena::AddCleanup(void* elem, void (*cleanup)(void*)) { SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(LifeCycleId(), &arena))) { - arena->AddCleanup(elem, cleanup, AllocPolicy()); - } else { - return AddCleanupFallback(elem, cleanup); + if (PROTOBUF_PREDICT_FALSE(!GetSerialArenaFast(&arena))) { + arena = GetSerialArenaFallback(&thread_cache()); } + arena->AddCleanup(elem, cleanup, AllocPolicy()); } PROTOBUF_NOINLINE void* ThreadSafeArena::AllocateAlignedFallback(size_t n, const std::type_info* type) { - if (ShouldRecordAlloc()) { - RecordAlloc(type, n); + if (alloc_policy_.should_record_allocs()) { + alloc_policy_.RecordAlloc(type, n); SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(LifeCycleId(), &arena))) { - return arena->AllocateAligned(n, AllocPolicy()); + if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) { + return arena->AllocateAligned(n, alloc_policy_.get()); } } return GetSerialArenaFallback(&thread_cache()) - ->AllocateAligned(n, AllocPolicy()); + ->AllocateAligned(n, alloc_policy_.get()); } PROTOBUF_NOINLINE std::pair<void*, SerialArena::CleanupNode*> ThreadSafeArena::AllocateAlignedWithCleanupFallback( size_t n, const std::type_info* type) { - if (ShouldRecordAlloc()) { - RecordAlloc(type, n); + if (alloc_policy_.should_record_allocs()) { + alloc_policy_.RecordAlloc(type, n); SerialArena* arena; - if (GetSerialArenaFast(LifeCycleId(), &arena)) { - return arena->AllocateAlignedWithCleanup(n, AllocPolicy()); + if (GetSerialArenaFast(&arena)) { + return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get()); } } return GetSerialArenaFallback(&thread_cache()) - ->AllocateAlignedWithCleanup(n, AllocPolicy()); -} - -PROTOBUF_NOINLINE -void ThreadSafeArena::AddCleanupFallback(void* elem, void (*cleanup)(void*)) { - GetSerialArenaFallback(&thread_cache()) - ->AddCleanup(elem, cleanup, AllocPolicy()); + ->AllocateAlignedWithCleanup(n, alloc_policy_.get()); } arc_ui64 ThreadSafeArena::SpaceAllocated() const { @@ -421,7 +453,7 @@ arc_ui64 ThreadSafeArena::SpaceUsed() const { for (; serial; serial = serial->next()) { space_used += serial->SpaceUsed(); } - return space_used - (AllocPolicy() ? sizeof(AllocationPolicy) : 0); + return space_used - (alloc_policy_.get() ? sizeof(AllocationPolicy) : 0); } void ThreadSafeArena::CleanupList() { @@ -442,7 +474,7 @@ SerialArena* ThreadSafeArena::GetSerialArenaFallback(void* me) { // This thread doesn't have any SerialArena, which also means it doesn't // have any blocks yet. So we'll allocate its first block now. serial = SerialArena::New( - AllocateMemory(AllocPolicy(), 0, kSerialArenaSize), me); + AllocateMemory(alloc_policy_.get(), 0, kSerialArenaSize), me); SerialArena* head = threads_.load(std::memory_order_relaxed); do { diff --git a/contrib/libs/protobuf/src/google/protobuf/arena.h b/contrib/libs/protobuf/src/google/protobuf/arena.h index a47d6741a1..7763d7aa5f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena.h +++ b/contrib/libs/protobuf/src/google/protobuf/arena.h @@ -65,13 +65,6 @@ namespace google { namespace protobuf { struct ArenaOptions; // defined below - -} // namespace protobuf -} // namespace google - -namespace google { -namespace protobuf { - class Arena; // defined below class Message; // defined in message.h class MessageLite; @@ -414,6 +407,16 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { p, std::is_convertible<T*, MessageLite*>()); } + // Creates message-owned arena. + static Arena* CreateMessageOwnedArena() { + return new Arena(internal::MessageOwned{}); + } + + // Checks whether the given arena is message-owned. + static bool IsMessageOwnedArena(Arena* arena) { + return arena->IsMessageOwned(); + } + private: static Arena* GetArenaForAllocationInternal( const T* p, std::true_type /*is_derived_from<MessageLite>*/) { @@ -487,7 +490,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { return new (ptr) T(static_cast<Args&&>(args)...); } - static T* New() { + static inline PROTOBUF_ALWAYS_INLINE T* New() { return new T(nullptr); } @@ -521,6 +524,14 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena { template <typename T> struct has_get_arena : InternalHelper<T>::has_get_arena {}; + // Constructor solely used by message-owned arena. + inline Arena(internal::MessageOwned) : impl_(internal::MessageOwned{}) {} + + // Checks whether this arena is message-owned. + PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const { + return impl_.IsMessageOwned(); + } + template <typename T, typename... Args> PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena, Args&&... args) { diff --git a/contrib/libs/protobuf/src/google/protobuf/arena_impl.h b/contrib/libs/protobuf/src/google/protobuf/arena_impl.h index 49e2142a67..76aa3bb045 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arena_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/arena_impl.h @@ -108,6 +108,75 @@ struct AllocationPolicy { } }; +// Tagged pointer to an AllocationPolicy. +class TaggedAllocationPolicyPtr { + public: + constexpr TaggedAllocationPolicyPtr() : policy_(0) {} + + explicit TaggedAllocationPolicyPtr(AllocationPolicy* policy) + : policy_(reinterpret_cast<uintptr_t>(policy)) {} + + void set_policy(AllocationPolicy* policy) { + auto bits = policy_ & kTagsMask; + policy_ = reinterpret_cast<uintptr_t>(policy) | bits; + } + + AllocationPolicy* get() { + return reinterpret_cast<AllocationPolicy*>(policy_ & kPtrMask); + } + const AllocationPolicy* get() const { + return reinterpret_cast<const AllocationPolicy*>(policy_ & kPtrMask); + } + + AllocationPolicy& operator*() { return *get(); } + const AllocationPolicy& operator*() const { return *get(); } + + AllocationPolicy* operator->() { return get(); } + const AllocationPolicy* operator->() const { return get(); } + + bool is_user_owned_initial_block() const { + return static_cast<bool>(get_mask<kUserOwnedInitialBlock>()); + } + void set_is_user_owned_initial_block(bool v) { + set_mask<kUserOwnedInitialBlock>(v); + } + + bool should_record_allocs() const { + return static_cast<bool>(get_mask<kRecordAllocs>()); + } + void set_should_record_allocs(bool v) { set_mask<kRecordAllocs>(v); } + + uintptr_t get_raw() const { return policy_; } + + inline void RecordAlloc(const std::type_info* allocated_type, + size_t n) const { + get()->metrics_collector->OnAlloc(allocated_type, n); + } + + private: + enum : uintptr_t { + kUserOwnedInitialBlock = 1, + kRecordAllocs = 2, + }; + + static constexpr uintptr_t kTagsMask = 7; + static constexpr uintptr_t kPtrMask = ~kTagsMask; + + template <uintptr_t kMask> + uintptr_t get_mask() const { + return policy_ & kMask; + } + template <uintptr_t kMask> + void set_mask(bool v) { + if (v) { + policy_ |= kMask; + } else { + policy_ &= ~kMask; + } + } + uintptr_t policy_; +}; + // A simple arena allocator. Calls to allocate functions must be properly // serialized by the caller, hence this class cannot be used as a general // purpose allocator in a multi-threaded program. It serves as a building block @@ -133,13 +202,6 @@ class PROTOBUF_EXPORT SerialArena { void (*cleanup)(void*); // Function pointer to the destructor or deleter. }; - // Creates a new SerialArena inside mem using the remaining memory as for - // future allocations. - static SerialArena* New(SerialArena::Memory mem, void* owner); - // Free SerialArena returning the memory passed in to New - template <typename Deallocator> - Memory Free(Deallocator deallocator); - void CleanupList(); arc_ui64 SpaceAllocated() const { return space_allocated_.load(std::memory_order_relaxed); @@ -179,6 +241,7 @@ class PROTOBUF_EXPORT SerialArena { std::pair<void*, CleanupNode*> AllocateAlignedWithCleanup( size_t n, const AllocationPolicy* policy) { + GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned. if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) { return AllocateAlignedWithCleanupFallback(n, policy); } @@ -211,6 +274,16 @@ class PROTOBUF_EXPORT SerialArena { void set_next(SerialArena* next) { next_ = next; } private: + friend class ThreadSafeArena; + friend class ArenaBenchmark; + + // Creates a new SerialArena inside mem using the remaining memory as for + // future allocations. + static SerialArena* New(SerialArena::Memory mem, void* owner); + // Free SerialArena returning the memory passed in to New + template <typename Deallocator> + Memory Free(Deallocator deallocator); + // Blocks are variable length malloc-ed objects. The following structure // describes the common header for all blocks. struct Block { @@ -255,6 +328,13 @@ class PROTOBUF_EXPORT SerialArena { static constexpr size_t kCleanupSize = AlignUpTo8(sizeof(CleanupNode)); }; +// Tag type used to invoke the constructor of message-owned arena. +// Only message-owned arenas use this constructor for creation. +// Such constructors are internal implementation details of the library. +struct MessageOwned { + explicit MessageOwned() = default; +}; + // This class provides the core Arena memory allocation library. Different // implementations only need to implement the public interface below. // Arena is not a template type as that would only be useful if all protos @@ -263,22 +343,18 @@ class PROTOBUF_EXPORT SerialArena { // use #ifdef the select the best implementation based on hardware / OS. class PROTOBUF_EXPORT ThreadSafeArena { public: - ThreadSafeArena() { Init(false); } + ThreadSafeArena() { Init(); } + + // Constructor solely used by message-owned arena. + ThreadSafeArena(internal::MessageOwned) : tag_and_id_(kMessageOwnedArena) { + Init(); + } ThreadSafeArena(char* mem, size_t size) { InitializeFrom(mem, size); } explicit ThreadSafeArena(void* mem, size_t size, const AllocationPolicy& policy) { - if (policy.IsDefault()) { - // Legacy code doesn't use the API above, but provides the initial block - // through ArenaOptions. I suspect most do not touch the allocation - // policy parameters. - InitializeFrom(mem, size); - } else { - auto collector = policy.metrics_collector; - bool record_allocs = collector && collector->RecordAllocs(); - InitializeWithPolicy(mem, size, record_allocs, policy); - } + InitializeWithPolicy(mem, size, policy); } // Destructor deletes all owned heap allocated objects, and destructs objects @@ -294,7 +370,8 @@ class PROTOBUF_EXPORT ThreadSafeArena { void* AllocateAligned(size_t n, const std::type_info* type) { SerialArena* arena; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(tag_and_id_, &arena))) { + if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && + GetSerialArenaFast(&arena))) { return arena->AllocateAligned(n, AllocPolicy()); } else { return AllocateAlignedFallback(n, type); @@ -308,7 +385,8 @@ class PROTOBUF_EXPORT ThreadSafeArena { // code for the happy path. PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned(size_t n, void** out) { SerialArena* a; - if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFromThreadCache(tag_and_id_, &a))) { + if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() && + GetSerialArenaFromThreadCache(&a))) { return a->MaybeAllocateAligned(n, out); } return false; @@ -320,51 +398,43 @@ class PROTOBUF_EXPORT ThreadSafeArena { // Add object pointer and cleanup function pointer to the list. void AddCleanup(void* elem, void (*cleanup)(void*)); + // Checks whether this arena is message-owned. + PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const { + return tag_and_id_ & kMessageOwnedArena; + } + private: // Unique for each arena. Changes on Reset(). - arc_ui64 tag_and_id_; - // The LSB of tag_and_id_ indicates if allocs in this arena are recorded. - enum { kRecordAllocs = 1 }; + arc_ui64 tag_and_id_ = 0; + // The LSB of tag_and_id_ indicates if the arena is message-owned. + enum : arc_ui64 { kMessageOwnedArena = 1 }; - intptr_t alloc_policy_ = 0; // Tagged pointer to AllocPolicy. - // The LSB of alloc_policy_ indicates if the user owns the initial block. - enum { kUserOwnedInitialBlock = 1 }; + TaggedAllocationPolicyPtr alloc_policy_; // Tagged pointer to AllocPolicy. // Pointer to a linked list of SerialArena. std::atomic<SerialArena*> threads_; std::atomic<SerialArena*> hint_; // Fast thread-local block access - const AllocationPolicy* AllocPolicy() const { - return reinterpret_cast<const AllocationPolicy*>(alloc_policy_ & -8); - } + const AllocationPolicy* AllocPolicy() const { return alloc_policy_.get(); } void InitializeFrom(void* mem, size_t size); - void InitializeWithPolicy(void* mem, size_t size, bool record_allocs, - AllocationPolicy policy); + void InitializeWithPolicy(void* mem, size_t size, AllocationPolicy policy); void* AllocateAlignedFallback(size_t n, const std::type_info* type); std::pair<void*, SerialArena::CleanupNode*> AllocateAlignedWithCleanupFallback(size_t n, const std::type_info* type); - void AddCleanupFallback(void* elem, void (*cleanup)(void*)); - void Init(bool record_allocs); + void Init(); void SetInitialBlock(void* mem, size_t size); // Delete or Destruct all objects owned by the arena. void CleanupList(); - inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; } - inline arc_ui64 LifeCycleId() const { - return tag_and_id_ & (-kRecordAllocs - 1); - } - - inline void RecordAlloc(const std::type_info* allocated_type, - size_t n) const { - AllocPolicy()->metrics_collector->OnAlloc(allocated_type, n); + return tag_and_id_ & ~kMessageOwnedArena; } inline void CacheSerialArena(SerialArena* serial) { thread_cache().last_serial_arena = serial; - thread_cache().last_lifecycle_id_seen = LifeCycleId(); + thread_cache().last_lifecycle_id_seen = tag_and_id_; // TODO(haberman): evaluate whether we would gain efficiency by getting rid // of hint_. It's the only write we do to ThreadSafeArena in the allocation // path, which will dirty the cache line. @@ -372,10 +442,8 @@ class PROTOBUF_EXPORT ThreadSafeArena { hint_.store(serial, std::memory_order_release); } - PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(arc_ui64 lifecycle_id, - SerialArena** arena) { - if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true; - if (lifecycle_id & kRecordAllocs) return false; + PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(SerialArena** arena) { + if (GetSerialArenaFromThreadCache(arena)) return true; // Check whether we own the last accessed SerialArena on this arena. This // fast path optimizes the case where a single thread uses multiple arenas. @@ -389,12 +457,12 @@ class PROTOBUF_EXPORT ThreadSafeArena { } PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache( - arc_ui64 lifecycle_id, SerialArena** arena) { + SerialArena** arena) { // If this thread already owns a block in this arena then try to use that. // This fast path optimizes the case where multiple threads allocate from // the same arena. ThreadCache* tc = &thread_cache(); - if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == lifecycle_id)) { + if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) { *arena = tc->last_serial_arena; return true; } @@ -455,9 +523,8 @@ class PROTOBUF_EXPORT ThreadSafeArena { }; static CacheAlignedLifecycleIdGenerator lifecycle_id_generator_; #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) - // Android ndk does not support __thread keyword so we use a custom thread - // local storage class we implemented. - // iOS also does not support the __thread keyword. + // iOS does not support __thread keyword so we use a custom thread local + // storage class we implemented. static ThreadCache& thread_cache(); #elif defined(PROTOBUF_USE_DLLS) // Thread local variables cannot be exposed through DLL interface but we can diff --git a/contrib/libs/protobuf/src/google/protobuf/arenastring.cc b/contrib/libs/protobuf/src/google/protobuf/arenastring.cc index f522e136b1..c64864e4b1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arenastring.cc +++ b/contrib/libs/protobuf/src/google/protobuf/arenastring.cc @@ -256,6 +256,12 @@ void ArenaStringPtr::ClearToDefault(const LazyString& default_value, } } +inline void SetStrWithHeapBuffer(TProtoStringType* str, ArenaStringPtr* s) { + TaggedPtr<TProtoStringType> res; + res.Set(str); + s->UnsafeSetTaggedPointer(res); +} + const char* EpsCopyInputStream::ReadArenaString(const char* ptr, ArenaStringPtr* s, Arena* arena) { @@ -264,13 +270,11 @@ const char* EpsCopyInputStream::ReadArenaString(const char* ptr, int size = ReadSize(&ptr); if (!ptr) return nullptr; - auto str = Arena::Create<TProtoStringType>(arena); + auto* str = Arena::Create<TProtoStringType>(arena); ptr = ReadString(ptr, size, str); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - TaggedPtr<TProtoStringType> res; - res.Set(str); - s->UnsafeSetTaggedPointer(res); + SetStrWithHeapBuffer(str, s); return ptr; } diff --git a/contrib/libs/protobuf/src/google/protobuf/arenastring.h b/contrib/libs/protobuf/src/google/protobuf/arenastring.h index 9e76dda5ed..f9e65a9fc8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/arenastring.h +++ b/contrib/libs/protobuf/src/google/protobuf/arenastring.h @@ -142,7 +142,7 @@ static_assert(std::is_trivial<TaggedPtr<TProtoStringType>>::value, // free()/destructor-call list) as appropriate. // // - Pointer set to 'DonatedString' tag (LSB is 1): points to a TProtoStringType -// instance with a buffer on the arena (arena != NULL, always, in this case). +// instance with a buffer on the arena (arena is never nullptr in this case). // // For fields with a non-empty string default value, there are three distinct // states: @@ -158,7 +158,7 @@ static_assert(std::is_trivial<TaggedPtr<TProtoStringType>>::value, // free()/destructor-call list) as appropriate. // // - Pointer set to 'DonatedString' tag (LSB is 1): points to a TProtoStringType -// instance with a buffer on the arena (arena != NULL, always, in this case). +// instance with a buffer on the arena (arena is never nullptr in this case). // // Generated code and reflection code both ensure that ptr_ is never null for // fields with an empty default. @@ -240,12 +240,12 @@ struct PROTOBUF_EXPORT ArenaStringPtr { TProtoStringType* Mutable(const LazyString& default_value, ::google::protobuf::Arena* arena); // 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 + // Own()'d by any arena. If the field is not set, this returns nullptr. The + // caller retains ownership. Clears this field back to nullptr state. Used to // implement release_<field>() methods on generated classes. - PROTOBUF_MUST_USE_RESULT TProtoStringType* Release( - const TProtoStringType* default_value, ::google::protobuf::Arena* arena); - PROTOBUF_MUST_USE_RESULT TProtoStringType* ReleaseNonDefault( + PROTOBUF_NODISCARD TProtoStringType* Release(const TProtoStringType* default_value, + ::google::protobuf::Arena* arena); + PROTOBUF_NODISCARD TProtoStringType* ReleaseNonDefault( const TProtoStringType* default_value, ::google::protobuf::Arena* arena); // Takes a TProtoStringType that is heap-allocated, and takes ownership. The @@ -276,9 +276,9 @@ struct PROTOBUF_EXPORT ArenaStringPtr { // string default. void ClearNonDefaultToEmpty(); - // 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|. + // Clears content, but keeps allocated TProtoStringType if arena != nullptr, 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, ::google::protobuf::Arena* arena); // Called from generated code / reflection runtime only. Resets value to point diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc index d693c4c960..abf1bf02dd 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc @@ -52,6 +52,7 @@ #include <google/protobuf/stubs/strutil.h> #include <google/protobuf/any.h> #include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/stubs/once.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/tokenizer.h> #include <google/protobuf/io/zero_copy_stream_impl.h> @@ -155,6 +156,7 @@ class Symbol { struct QueryKey : internal::SymbolBase { StringPiece name; const void* parent; + int field_number; }; DEFINE_MEMBERS(QueryKey, QUERY_KEY, query_key); #undef DEFINE_MEMBERS @@ -219,7 +221,7 @@ class Symbol { return ""; } - std::pair<const void*, StringPiece> parent_key() const { + std::pair<const void*, StringPiece> parent_name_key() const { const auto or_file = [&](const void* p) { return p ? p : GetFile(); }; switch (type()) { case MESSAGE: @@ -254,6 +256,22 @@ class Symbol { return {}; } + std::pair<const void*, int> parent_number_key() const { + switch (type()) { + case FIELD: + return {field_descriptor()->containing_type(), + field_descriptor()->number()}; + case ENUM_VALUE: + return {enum_value_descriptor()->type(), + enum_value_descriptor()->number()}; + case QUERY_KEY: + return {query_key()->parent, query_key()->field_number}; + default: + GOOGLE_CHECK(false); + } + return {}; + } + private: const internal::SymbolBase* ptr_; }; @@ -343,7 +361,7 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) { static const char* const kNonLinkedWeakMessageReplacementName = "google.protobuf.Empty"; -#if !defined(_MSC_VER) || _MSC_VER >= 1900 +#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912) const int FieldDescriptor::kMaxNumber; const int FieldDescriptor::kFirstReservedNumber; const int FieldDescriptor::kLastReservedNumber; @@ -498,7 +516,6 @@ class PrefixRemover { typedef std::pair<const void*, StringPiece> PointerStringPair; typedef std::pair<const Descriptor*, int> DescriptorIntPair; -typedef std::pair<const EnumDescriptor*, int> EnumIntPair; #define HASH_MAP std::unordered_map #define HASH_SET std::unordered_set @@ -558,12 +575,12 @@ using SymbolsByNameSet = struct SymbolByParentHash { size_t operator()(Symbol s) const { - return PointerStringPairHash{}(s.parent_key()); + return PointerStringPairHash{}(s.parent_name_key()); } }; struct SymbolByParentEq { bool operator()(Symbol a, Symbol b) const { - return a.parent_key() == b.parent_key(); + return a.parent_name_key() == b.parent_name_key(); } }; using SymbolsByParentSet = @@ -577,15 +594,21 @@ typedef HASH_MAP<PointerStringPair, const FieldDescriptor*, PointerStringPairHash> FieldsByNameMap; -typedef HASH_MAP<DescriptorIntPair, const FieldDescriptor*, - PointerIntegerPairHash<DescriptorIntPair>, - std::equal_to<DescriptorIntPair>> - FieldsByNumberMap; +struct FieldsByNumberHash { + size_t operator()(Symbol s) const { + return PointerIntegerPairHash<std::pair<const void*, int>>{}( + s.parent_number_key()); + } +}; +struct FieldsByNumberEq { + bool operator()(Symbol a, Symbol b) const { + return a.parent_number_key() == b.parent_number_key(); + } +}; +using FieldsByNumberSet = + HASH_SET<Symbol, FieldsByNumberHash, FieldsByNumberEq>; +using EnumValuesByNumberSet = FieldsByNumberSet; -typedef HASH_MAP<EnumIntPair, const EnumValueDescriptor*, - PointerIntegerPairHash<EnumIntPair>, - std::equal_to<EnumIntPair>> - EnumValuesByNumberMap; // This is a map rather than a hash-map, since we use it to iterate // through all the extensions that extend a given Descriptor, and an // ordered data structure that implements lower_bound is convenient @@ -792,7 +815,7 @@ class TableArena { size = RoundUp(size); Block* to_relocate = nullptr; - Block* to_use; + Block* to_use = nullptr; for (size_t i = 0; i < kSmallSizes.size(); ++i) { if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) { @@ -991,12 +1014,12 @@ class TableArena { 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)}}; + 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 { @@ -1146,6 +1169,10 @@ class DescriptorPool::Tables { // The string is initialized to the given value for convenience. const TProtoStringType* AllocateString(StringPiece value); + // Copy the input into a NUL terminated string whose lifetime is managed by + // the pool. + const char* Strdup(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> @@ -1166,9 +1193,11 @@ class DescriptorPool::Tables { const TProtoStringType& scope, const TProtoStringType* opt_json_name); - // Allocate a LazyInitData which will be destroyed when the pool is - // destroyed. - internal::LazyInitData* AllocateLazyInit(); + // Create an object that will be deleted when the pool is destroyed. + // The object is value initialized, and its destructor will be called if + // non-trivial. + template <typename Type> + Type* Create(); // Allocate a protocol message object. Some older versions of GCC have // trouble understanding explicit template instantiations in some cases, so @@ -1259,8 +1288,8 @@ class FileDescriptorTables { // as it will be used as a key in the symbols_by_parent_ map without copying. bool AddAliasUnderParent(const void* parent, const TProtoStringType& name, Symbol symbol); - bool AddFieldByNumber(const FieldDescriptor* field); - bool AddEnumValueByNumber(const EnumValueDescriptor* value); + bool AddFieldByNumber(FieldDescriptor* field); + bool AddEnumValueByNumber(EnumValueDescriptor* value); // Adds the field to the lowercase_name and camelcase_name maps. Never // fails because we allow duplicates; the first field by the name wins. @@ -1298,9 +1327,9 @@ class FileDescriptorTables { mutable FieldsByNameMap fields_by_camelcase_name_; std::unique_ptr<FieldsByNameMap> fields_by_camelcase_name_tmp_; mutable internal::once_flag fields_by_camelcase_name_once_; - FieldsByNumberMap fields_by_number_; // Not including extensions. - EnumValuesByNumberMap enum_values_by_number_; - mutable EnumValuesByNumberMap unknown_enum_values_by_number_ + FieldsByNumberSet fields_by_number_; // Not including extensions. + EnumValuesByNumberSet enum_values_by_number_; + mutable EnumValuesByNumberSet unknown_enum_values_by_number_ PROTOBUF_GUARDED_BY(unknown_enum_values_mu_); // Populated on first request to save space, hence constness games. @@ -1450,7 +1479,19 @@ inline const FileDescriptor* DescriptorPool::Tables::FindFile( inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber( const Descriptor* parent, int number) const { - return FindPtrOrNull(fields_by_number_, std::make_pair(parent, number)); + // If `number` is within the sequential range, just index into the parent + // without doing a table lookup. + if (parent != nullptr && // + 1 <= number && number <= parent->sequential_field_limit_) { + return parent->field(number - 1); + } + + Symbol::QueryKey query; + query.parent = parent; + query.field_number = number; + + auto it = fields_by_number_.find(Symbol(&query)); + return it == fields_by_number_.end() ? nullptr : it->field_descriptor(); } const void* FileDescriptorTables::FindParentForFieldsByMap( @@ -1472,12 +1513,12 @@ void FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic( } void FileDescriptorTables::FieldsByLowercaseNamesLazyInitInternal() const { - for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin(); - it != fields_by_number_.end(); it++) { - PointerStringPair lowercase_key(FindParentForFieldsByMap(it->second), - it->second->lowercase_name().c_str()); - InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, - it->second); + for (Symbol symbol : symbols_by_parent_) { + const FieldDescriptor* field = symbol.field_descriptor(); + if (!field) continue; + PointerStringPair lowercase_key(FindParentForFieldsByMap(field), + field->lowercase_name().c_str()); + InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field); } } @@ -1496,12 +1537,12 @@ void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic( } void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitInternal() const { - for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin(); - it != fields_by_number_.end(); it++) { - PointerStringPair camelcase_key(FindParentForFieldsByMap(it->second), - it->second->camelcase_name().c_str()); - InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, - it->second); + for (Symbol symbol : symbols_by_parent_) { + const FieldDescriptor* field = symbol.field_descriptor(); + if (!field) continue; + PointerStringPair camelcase_key(FindParentForFieldsByMap(field), + field->camelcase_name().c_str()); + InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field); } } @@ -1516,8 +1557,21 @@ inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName( inline const EnumValueDescriptor* FileDescriptorTables::FindEnumValueByNumber( const EnumDescriptor* parent, int number) const { - return FindPtrOrNull(enum_values_by_number_, - std::make_pair(parent, number)); + // If `number` is within the sequential range, just index into the parent + // without doing a table lookup. + const int base = parent->value(0)->number(); + if (base <= number && + number <= static_cast<arc_i64>(base) + parent->sequential_value_limit_) { + return parent->value(number - base); + } + + Symbol::QueryKey query; + query.parent = parent; + query.field_number = number; + + auto it = enum_values_by_number_.find(Symbol(&query)); + return it == enum_values_by_number_.end() ? nullptr + : it->enum_value_descriptor(); } inline const EnumValueDescriptor* @@ -1525,29 +1579,33 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown( const EnumDescriptor* parent, int number) const { // First try, with map of compiled-in values. { - const EnumValueDescriptor* desc = FindPtrOrNull( - enum_values_by_number_, std::make_pair(parent, number)); - if (desc != nullptr) { - return desc; + const auto* value = FindEnumValueByNumber(parent, number); + if (value != nullptr) { + return value; } } + + Symbol::QueryKey query; + query.parent = parent; + query.field_number = number; + // Second try, with reader lock held on unknown enum values: common case. { ReaderMutexLock l(&unknown_enum_values_mu_); - const EnumValueDescriptor* desc = FindPtrOrNull( - unknown_enum_values_by_number_, std::make_pair(parent, number)); - if (desc != nullptr) { - return desc; + auto it = unknown_enum_values_by_number_.find(Symbol(&query)); + if (it != unknown_enum_values_by_number_.end() && + it->enum_value_descriptor() != nullptr) { + return it->enum_value_descriptor(); } } // If not found, try again with writer lock held, and create new descriptor if // necessary. { WriterMutexLock l(&unknown_enum_values_mu_); - const EnumValueDescriptor* desc = FindPtrOrNull( - unknown_enum_values_by_number_, std::make_pair(parent, number)); - if (desc != nullptr) { - return desc; + auto it = unknown_enum_values_by_number_.find(Symbol(&query)); + if (it != unknown_enum_values_by_number_.end() && + it->enum_value_descriptor() != nullptr) { + return it->enum_value_descriptor(); } // Create an EnumValueDescriptor dynamically. We don't insert it into the @@ -1556,17 +1614,21 @@ FileDescriptorTables::FindEnumValueByNumberCreatingIfUnknown( // later. TProtoStringType enum_value_name = StringPrintf("UNKNOWN_ENUM_VALUE_%s_%d", parent->name().c_str(), number); - DescriptorPool::Tables* tables = const_cast<DescriptorPool::Tables*>( - DescriptorPool::generated_pool()->tables_.get()); - EnumValueDescriptor* result = tables->Allocate<EnumValueDescriptor>(); - result->all_names_ = tables->AllocateStringArray( - enum_value_name, - StrCat(parent->full_name(), ".", enum_value_name)); + auto* pool = DescriptorPool::generated_pool(); + auto* tables = const_cast<DescriptorPool::Tables*>(pool->tables_.get()); + EnumValueDescriptor* result; + { + // Must lock the pool because we will do allocations in the shared arena. + MutexLockMaybe l2(pool->mutex_); + result = tables->Allocate<EnumValueDescriptor>(); + 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(); - InsertIfNotPresent(&unknown_enum_values_by_number_, - std::make_pair(parent, number), result); + unknown_enum_values_by_number_.insert(Symbol::EnumValue(result, 0)); return result; } } @@ -1602,8 +1664,8 @@ bool DescriptorPool::Tables::AddSymbol(const TProtoStringType& full_name, bool FileDescriptorTables::AddAliasUnderParent(const void* parent, const TProtoStringType& name, Symbol symbol) { - GOOGLE_DCHECK_EQ(name, symbol.parent_key().second); - GOOGLE_DCHECK_EQ(parent, symbol.parent_key().first); + GOOGLE_DCHECK_EQ(name, symbol.parent_name_key().second); + GOOGLE_DCHECK_EQ(parent, symbol.parent_name_key().first); return symbols_by_parent_.insert(symbol).second; } @@ -1650,15 +1712,30 @@ void FileDescriptorTables::AddFieldByStylizedNames( } } -bool FileDescriptorTables::AddFieldByNumber(const FieldDescriptor* field) { - DescriptorIntPair key(field->containing_type(), field->number()); - return InsertIfNotPresent(&fields_by_number_, key, field); +bool FileDescriptorTables::AddFieldByNumber(FieldDescriptor* field) { + // Skip fields that are at the start of the sequence. + if (field->containing_type() != nullptr && field->number() >= 1 && + field->number() <= field->containing_type()->sequential_field_limit_) { + if (field->is_extension()) { + // Conflicts with the field that already exists in the sequential range. + return false; + } + // Only return true if the field at that index matches. Otherwise it + // conflicts with the existing field in the sequential range. + return field->containing_type()->field(field->number() - 1) == field; + } + + return fields_by_number_.insert(Symbol(field)).second; } -bool FileDescriptorTables::AddEnumValueByNumber( - const EnumValueDescriptor* value) { - EnumIntPair key(value->type(), value->number()); - return InsertIfNotPresent(&enum_values_by_number_, key, value); +bool FileDescriptorTables::AddEnumValueByNumber(EnumValueDescriptor* value) { + // Skip values that are at the start of the sequence. + const int base = value->type()->value(0)->number(); + if (base <= value->number() && + value->number() <= + static_cast<arc_i64>(base) + value->type()->sequential_value_limit_) + return true; + return enum_values_by_number_.insert(Symbol::EnumValue(value, 0)).second; } bool DescriptorPool::Tables::AddExtension(const FieldDescriptor* field) { @@ -1688,6 +1765,13 @@ const TProtoStringType* DescriptorPool::Tables::AllocateString( return arena_.Create<TProtoStringType>(value); } +const char* DescriptorPool::Tables::Strdup(StringPiece value) { + char* p = AllocateArray<char>(static_cast<int>(value.size() + 1)); + memcpy(p, value.data(), value.size()); + p[value.size()] = 0; + return p; +} + template <typename... In> const TProtoStringType* DescriptorPool::Tables::AllocateStringArray(In&&... values) { auto& array = *arena_.Create<std::array<TProtoStringType, sizeof...(In)>>(); @@ -1718,7 +1802,7 @@ DescriptorPool::Tables::AllocateFieldNames(const TProtoStringType& 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; + FieldNamesResult result{nullptr, 0, 0, 0}; // We use std::array to allow handling of the destruction of the strings. switch (total_count) { case 2: @@ -1768,8 +1852,9 @@ DescriptorPool::Tables::AllocateFieldNames(const TProtoStringType& name, return result; } -internal::LazyInitData* DescriptorPool::Tables::AllocateLazyInit() { - return arena_.Create<internal::LazyInitData>(); +template <typename Type> +Type* DescriptorPool::Tables::Create() { + return arena_.Create<Type>(); } template <typename Type> @@ -2472,25 +2557,18 @@ TProtoStringType FieldDescriptor::DefaultValueAsString( switch (cpp_type()) { case CPPTYPE_INT32: return StrCat(default_value_arc_i32()); - break; case CPPTYPE_INT64: return StrCat(default_value_arc_i64()); - break; case CPPTYPE_UINT32: return StrCat(default_value_arc_ui32()); - break; case CPPTYPE_UINT64: return StrCat(default_value_arc_ui64()); - break; case CPPTYPE_FLOAT: return SimpleFtoa(default_value_float()); - break; case CPPTYPE_DOUBLE: return SimpleDtoa(default_value_double()); - break; case CPPTYPE_BOOL: return default_value_bool() ? "true" : "false"; - break; case CPPTYPE_STRING: if (quote_string_type) { return "\"" + CEscape(default_value_string()) + "\""; @@ -2501,10 +2579,8 @@ TProtoStringType FieldDescriptor::DefaultValueAsString( return default_value_string(); } } - break; case CPPTYPE_ENUM: return default_value_enum()->name(); - break; case CPPTYPE_MESSAGE: GOOGLE_LOG(DFATAL) << "Messages can't have default values!"; break; @@ -2824,7 +2900,12 @@ bool RetrieveOptions(int depth, const Message& options, DynamicMessageFactory factory; std::unique_ptr<Message> dynamic_options( factory.GetPrototype(option_descriptor)->New()); - if (dynamic_options->ParseFromString(options.SerializeAsString())) { + TProtoStringType serialized = options.SerializeAsString(); + io::CodedInputStream input( + reinterpret_cast<const uint8_t*>(serialized.c_str()), + serialized.size()); + input.SetExtensionRegistry(pool, &factory); + if (dynamic_options->ParseFromCodedStream(&input)) { return RetrieveOptionsAssumingRightPool(depth, *dynamic_options, option_entries); } else { @@ -4435,6 +4516,8 @@ Symbol DescriptorPool::NewPlaceholderWithMutexHeld( // Enums must have at least one value. placeholder_enum->value_count_ = 1; placeholder_enum->values_ = tables_->AllocateArray<EnumValueDescriptor>(1); + // Disable fast-path lookup for this enum. + placeholder_enum->sequential_value_limit_ = -1; EnumValueDescriptor* placeholder_value = &placeholder_enum->values_[0]; memset(static_cast<void*>(placeholder_value), 0, @@ -4952,17 +5035,18 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependencies_[i] = dependency; if (pool_->lazily_build_dependencies_ && !dependency) { if (result->dependencies_once_ == nullptr) { - result->dependencies_once_ = tables_->AllocateLazyInit(); - result->dependencies_once_->file.dependencies_names = - tables_->AllocateArray<const TProtoStringType*>(proto.dependency_size()); + result->dependencies_once_ = + tables_->Create<FileDescriptor::LazyInitData>(); + result->dependencies_once_->dependencies_names = + tables_->AllocateArray<const char*>(proto.dependency_size()); if (proto.dependency_size() > 0) { - std::fill_n(result->dependencies_once_->file.dependencies_names, + std::fill_n(result->dependencies_once_->dependencies_names, proto.dependency_size(), nullptr); } } - result->dependencies_once_->file.dependencies_names[i] = - tables_->AllocateString(proto.dependency(i)); + result->dependencies_once_->dependencies_names[i] = + tables_->Strdup(proto.dependency(i)); } } @@ -5108,6 +5192,19 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto, result->well_known_type_ = it->second; } + // Calculate the continuous sequence of fields. + // These can be fast-path'd during lookup and don't need to be added to the + // tables. + // We use uint16_t to save space for sequential_field_limit_, so stop before + // overflowing it. Worst case, we are not taking full advantage on huge + // messages, but it is unlikely. + result->sequential_field_limit_ = 0; + for (int i = 0; i < std::numeric_limits<uint16_t>::max() && + i < proto.field_size() && proto.field(i).number() == i + 1; + ++i) { + result->sequential_field_limit_ = i + 1; + } + // Build oneofs first so that fields and extension ranges can refer to them. BUILD_ARRAY(proto, result, oneof_decl, BuildOneof, result); BUILD_ARRAY(proto, result, field, BuildField, result); @@ -5670,6 +5767,21 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto, "Enums must contain at least one value."); } + // Calculate the continuous sequence of the labels. + // These can be fast-path'd during lookup and don't need to be added to the + // tables. + // We use uint16_t to save space for sequential_value_limit_, so stop before + // overflowing it. Worst case, we are not taking full advantage on huge + // enums, but it is unlikely. + for (int i = 0; + i < std::numeric_limits<uint16_t>::max() && i < proto.value_size() && + // We do the math in arc_i64 to avoid overflows. + proto.value(i).number() == + static_cast<arc_i64>(i) + proto.value(0).number(); + ++i) { + result->sequential_value_limit_ = i; + } + BUILD_ARRAY(proto, result, value, BuildEnumValue, result); BUILD_ARRAY(proto, result, reserved_range, BuildReservedRange, result); @@ -5940,11 +6052,23 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message, } // Must go through oneof_decls_ array to get a non-const version of the // OneofDescriptor. - ++message->oneof_decls_[oneof_decl->index()].field_count_; + auto& out_oneof_decl = message->oneof_decls_[oneof_decl->index()]; + if (out_oneof_decl.field_count_ == 0) { + out_oneof_decl.fields_ = message->field(i); + } + + if (!had_errors_) { + // Verify that they are contiguous. + // This is assumed by OneofDescriptor::field(i). + // But only if there are no errors. + GOOGLE_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_, + message->field(i)); + } + ++out_oneof_decl.field_count_; } } - // Then allocate the arrays. + // Then verify the sizes. for (int i = 0; i < message->oneof_decl_count(); i++) { OneofDescriptor* oneof_decl = &message->oneof_decls_[i]; @@ -5954,27 +6078,11 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message, "Oneof must have at least one field."); } - oneof_decl->fields_ = tables_->AllocateArray<const FieldDescriptor*>( - oneof_decl->field_count_); - oneof_decl->field_count_ = 0; - if (oneof_decl->options_ == nullptr) { oneof_decl->options_ = &OneofOptions::default_instance(); } } - // Then fill them in. - for (int i = 0; i < message->field_count(); i++) { - const OneofDescriptor* oneof_decl = message->field(i)->containing_oneof(); - if (oneof_decl != nullptr) { - OneofDescriptor* mutable_oneof_decl = - &message->oneof_decls_[oneof_decl->index()]; - message->fields_[i].index_in_oneof_ = mutable_oneof_decl->field_count_; - mutable_oneof_decl->fields_[mutable_oneof_decl->field_count_++] = - message->field(i); - } - } - for (int i = 0; i < message->field_count(); i++) { const FieldDescriptor* field = message->field(i); if (field->proto3_optional_) { @@ -6014,7 +6122,7 @@ void DescriptorBuilder::CrossLinkMessage(Descriptor* message, void DescriptorBuilder::CrossLinkExtensionRange( Descriptor::ExtensionRange* range, - const DescriptorProto::ExtensionRange& proto) { + const DescriptorProto::ExtensionRange& /*proto*/) { if (range->options_ == nullptr) { range->options_ = &ExtensionRangeOptions::default_instance(); } @@ -6105,12 +6213,12 @@ 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_->AllocateLazyInit(); - field->type_once_->field.type_name = tables_->AllocateString(name); - if (proto.has_default_value()) { - field->type_once_->field.default_value_enum_name = - tables_->AllocateString(proto.default_value()); - } + field->type_once_ = tables_->Create<internal::once_flag>(); + field->type_descriptor_.lazy_type_name = tables_->Strdup(name); + field->lazy_default_value_enum_name_ = + proto.has_default_value() ? tables_->Strdup(proto.default_value()) + : nullptr; + // AddFieldByNumber and AddExtension are done later in this function, // and can/must be done if the field type was not found. The related // error checking is not necessary when in lazily_build_dependencies_ @@ -6527,7 +6635,7 @@ void DescriptorBuilder::ValidateMessageOptions(Descriptor* message, const arc_i64 max_extension_range = static_cast<arc_i64>(message->options().message_set_wire_format() - ? kint32max + ? std::numeric_limits<arc_i32>::max() : FieldDescriptor::kMaxNumber); for (int i = 0; i < message->extension_range_count(); ++i) { if (message->extension_range(i)->end > max_extension_range + 1) { @@ -6658,6 +6766,8 @@ void DescriptorBuilder::ValidateEnumValueOptions( void DescriptorBuilder::ValidateExtensionRangeOptions( const TProtoStringType& full_name, Descriptor::ExtensionRange* extension_range, const DescriptorProto_ExtensionRange& proto) { + (void)full_name; // Parameter is used by Google-internal code. + (void)extension_range; // Parameter is used by Google-internal code. } void DescriptorBuilder::ValidateServiceOptions( @@ -7317,7 +7427,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT32: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast<arc_ui64>(kint32max)) { + static_cast<arc_ui64>(std::numeric_limits<arc_i32>::max())) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -7327,7 +7437,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( } } else if (uninterpreted_option_->has_negative_int_value()) { if (uninterpreted_option_->negative_int_value() < - static_cast<arc_i64>(kint32min)) { + static_cast<arc_i64>(std::numeric_limits<arc_i32>::min())) { return AddValueError("Value out of range for int32 option \"" + option_field->full_name() + "\"."); } else { @@ -7344,7 +7454,7 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_INT64: if (uninterpreted_option_->has_positive_int_value()) { if (uninterpreted_option_->positive_int_value() > - static_cast<arc_ui64>(kint64max)) { + static_cast<arc_ui64>(std::numeric_limits<arc_i64>::max())) { return AddValueError("Value out of range for int64 option \"" + option_field->full_name() + "\"."); } else { @@ -7364,7 +7474,8 @@ bool DescriptorBuilder::OptionInterpreter::SetOptionValue( case FieldDescriptor::CPPTYPE_UINT32: if (uninterpreted_option_->has_positive_int_value()) { - if (uninterpreted_option_->positive_int_value() > kuint32max) { + if (uninterpreted_option_->positive_int_value() > + std::numeric_limits<arc_ui32>::max()) { return AddValueError("Value out of range for uint32 option \"" + option_field->name() + "\"."); } else { @@ -7534,7 +7645,7 @@ class DescriptorBuilder::OptionInterpreter::AggregateOptionFinder public: DescriptorBuilder* builder_; - const Descriptor* FindAnyType(const Message& message, + const Descriptor* FindAnyType(const Message& /*message*/, const TProtoStringType& prefix, const TProtoStringType& name) const override { if (prefix != internal::kTypeGoogleApisComPrefix && @@ -7728,6 +7839,7 @@ void DescriptorBuilder::OptionInterpreter::SetUInt64( void DescriptorBuilder::LogUnusedDependency(const FileDescriptorProto& proto, const FileDescriptor* result) { + (void)result; // Parameter is used by Google-internal code. if (!unused_dependency_.empty()) { auto itr = pool_->unused_import_track_files_.find(proto.name()); @@ -7750,6 +7862,7 @@ void DescriptorBuilder::LogUnusedDependency(const FileDescriptorProto& proto, Symbol DescriptorPool::CrossLinkOnDemandHelper(StringPiece name, bool expecting_enum) const { + (void)expecting_enum; // Parameter is used by Google-internal code. auto lookup_name = TProtoStringType(name); if (!lookup_name.empty() && lookup_name[0] == '.') { lookup_name = lookup_name.substr(1); @@ -7765,32 +7878,32 @@ Symbol DescriptorPool::CrossLinkOnDemandHelper(StringPiece name, void FieldDescriptor::InternalTypeOnceInit() const { GOOGLE_CHECK(file()->finished_building_ == true); const EnumDescriptor* enum_type = nullptr; - if (type_once_->field.type_name) { - Symbol result = file()->pool()->CrossLinkOnDemandHelper( - *type_once_->field.type_name, type_ == FieldDescriptor::TYPE_ENUM); - if (result.type() == Symbol::MESSAGE) { - type_ = FieldDescriptor::TYPE_MESSAGE; - type_descriptor_.message_type = result.descriptor(); - } else if (result.type() == Symbol::ENUM) { - type_ = FieldDescriptor::TYPE_ENUM; - enum_type = type_descriptor_.enum_type = result.enum_descriptor(); - } - } - if (enum_type && !default_value_enum_) { - if (type_once_->field.default_value_enum_name) { + Symbol result = file()->pool()->CrossLinkOnDemandHelper( + type_descriptor_.lazy_type_name, type_ == FieldDescriptor::TYPE_ENUM); + if (result.type() == Symbol::MESSAGE) { + type_ = FieldDescriptor::TYPE_MESSAGE; + type_descriptor_.message_type = result.descriptor(); + } else if (result.type() == Symbol::ENUM) { + type_ = FieldDescriptor::TYPE_ENUM; + enum_type = type_descriptor_.enum_type = result.enum_descriptor(); + } + + if (enum_type) { + if (lazy_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(); // 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) + "." + - *type_once_->field.default_value_enum_name; + name = name.substr(0, last_dot) + "." + lazy_default_value_enum_name_; } else { - name = *type_once_->field.default_value_enum_name; + name = lazy_default_value_enum_name_; } Symbol result = file()->pool()->CrossLinkOnDemandHelper(name, true); default_value_enum_ = result.enum_value_descriptor(); + } else { + default_value_enum_ = nullptr; } if (!default_value_enum_) { // We use the first defined value as the default @@ -7810,7 +7923,7 @@ 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_->once, FieldDescriptor::TypeOnceInit, this); + internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); } return type_ == TYPE_MESSAGE || type_ == TYPE_GROUP ? type_descriptor_.message_type @@ -7819,14 +7932,14 @@ const Descriptor* FieldDescriptor::message_type() const { const EnumDescriptor* FieldDescriptor::enum_type() const { if (type_once_) { - internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this); + internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); } return type_ == TYPE_ENUM ? type_descriptor_.enum_type : nullptr; } const EnumValueDescriptor* FieldDescriptor::default_value_enum() const { if (type_once_) { - internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this); + internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this); } return default_value_enum_; } @@ -7842,10 +7955,10 @@ const TProtoStringType& FieldDescriptor::PrintableNameForExtension() const { void FileDescriptor::InternalDependenciesOnceInit() const { GOOGLE_CHECK(finished_building_ == true); - auto* names = dependencies_once_->file.dependencies_names; + auto* names = dependencies_once_->dependencies_names; for (int i = 0; i < dependency_count(); i++) { if (names[i]) { - dependencies_[i] = pool_->FindFileByName(*names[i]); + dependencies_[i] = pool_->FindFileByName(names[i]); } } } @@ -7865,11 +7978,11 @@ const FileDescriptor* FileDescriptor::dependency(int index) const { } const Descriptor* MethodDescriptor::input_type() const { - return input_type_.Get(); + return input_type_.Get(service()); } const Descriptor* MethodDescriptor::output_type() const { - return output_type_.Get(); + return output_type_.Get(service()); } @@ -7887,31 +8000,21 @@ void LazyDescriptor::SetLazy(StringPiece name, GOOGLE_CHECK(file && file->pool_); GOOGLE_CHECK(file->pool_->lazily_build_dependencies_); GOOGLE_CHECK(!file->finished_building_); - once_ = file->pool_->tables_->AllocateLazyInit(); - once_->descriptor.file = file; - once_->descriptor.name = file->pool_->tables_->AllocateString(name); + once_ = file->pool_->tables_->Create<internal::once_flag>(); + lazy_name_ = file->pool_->tables_->Strdup(name); } -void LazyDescriptor::Once() { +void LazyDescriptor::Once(const ServiceDescriptor* service) { if (once_) { - internal::call_once(once_->once, LazyDescriptor::OnceStatic, this); + internal::call_once(*once_, [&] { + auto* file = service->file(); + GOOGLE_CHECK(file->finished_building_); + descriptor_ = + file->pool_->CrossLinkOnDemandHelper(lazy_name_, false).descriptor(); + }); } } -void LazyDescriptor::OnceStatic(LazyDescriptor* lazy) { lazy->OnceInternal(); } - -void LazyDescriptor::OnceInternal() { - 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; - } - } -} } // namespace internal } // namespace protobuf diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.h index 2756f1a533..10dcc1eab0 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.h @@ -184,29 +184,6 @@ struct DebugStringOptions { // 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 @@ -232,18 +209,19 @@ class PROTOBUF_EXPORT LazyDescriptor { // Returns the current value of the descriptor, thread-safe. If SetLazy(...) // has been called, will do a one-time cross link of the type specified, // building the descriptor file that contains the type if necessary. - inline const Descriptor* Get() { - Once(); + inline const Descriptor* Get(const ServiceDescriptor* service) { + Once(service); return descriptor_; } private: - static void OnceStatic(LazyDescriptor* lazy); - void OnceInternal(); - void Once(); + void Once(const ServiceDescriptor* service); - const Descriptor* descriptor_; - LazyInitData* once_; + union { + const Descriptor* descriptor_; + const char* lazy_name_; + }; + internal::once_flag* once_; }; class PROTOBUF_EXPORT SymbolBase { @@ -564,8 +542,18 @@ class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase { 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_; + // Well known type. Stored like this to conserve space. + uint8_t well_known_type_ : 5; + + // This points to the last field _number_ that is part of the sequence + // starting at 1, where + // `desc->field(i)->number() == i + 1` + // A value of `0` means no field matches. That is, there are no fields or the + // first field is not field `1`. + // Uses 16-bit to avoid extra padding. Unlikely to have more than 2^16 + // sequentially numbered fields in a message. + uint16_t sequential_field_limit_; + int field_count_; // all_names_ = [name, full_name] @@ -603,6 +591,7 @@ class PROTOBUF_EXPORT Descriptor : private internal::SymbolBase { friend class DescriptorPool; friend class EnumDescriptor; friend class FieldDescriptor; + friend class FileDescriptorTables; friend class OneofDescriptor; friend class MethodDescriptor; friend class FileDescriptor; @@ -905,19 +894,19 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { // Returns true if this is a map message type. bool is_map_message_type() const; - bool has_default_value_; - bool proto3_optional_; + bool has_default_value_ : 1; + bool proto3_optional_ : 1; // Whether the user has specified the json_name field option in the .proto // file. - bool has_json_name_; - bool is_extension_; + bool has_json_name_ : 1; + bool is_extension_ : 1; + bool is_oneof_ : 1; - // 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_; + uint8_t label_ : 2; - bool is_oneof_ : 1; + // Actually a `Type`, but stored as uint8_t to save space. + mutable uint8_t type_; // Logically: // all_names_ = [name, full_name, lower, camel, json] @@ -929,14 +918,15 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { uint8_t lowercase_name_index_ : 2; uint8_t camelcase_name_index_ : 2; uint8_t json_name_index_ : 3; + // Sadly, `number_` located here to reduce padding. Unrelated to all_names_ + // and its indices above. + int number_; const TProtoStringType* all_names_; const FileDescriptor* file_; - internal::LazyInitData* type_once_; + internal::once_flag* type_once_; static void TypeOnceInit(const FieldDescriptor* to_init); void InternalTypeOnceInit() const; - int number_; - int index_in_oneof_; const Descriptor* containing_type_; union { const OneofDescriptor* containing_oneof; @@ -945,6 +935,7 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { union { mutable const Descriptor* message_type; mutable const EnumDescriptor* enum_type; + const char* lazy_type_name; } type_descriptor_; const FieldOptions* options_; // IMPORTANT: If you add a new field, make sure to search for all instances @@ -961,6 +952,7 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase { bool default_value_bool_; mutable const EnumValueDescriptor* default_value_enum_; + const char* lazy_default_value_enum_name_; const TProtoStringType* default_value_string_; mutable std::atomic<const Message*> default_generated_instance_; }; @@ -1048,8 +1040,8 @@ class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase { // all_names_ = [name, full_name] const TProtoStringType* all_names_; const Descriptor* containing_type_; - const FieldDescriptor** fields_; const OneofOptions* options_; + const FieldDescriptor* fields_; // IMPORTANT: If you add a new field, make sure to search for all instances // of Allocate<OneofDescriptor>() and AllocateArray<OneofDescriptor>() @@ -1164,6 +1156,9 @@ class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { friend class io::Printer; friend class compiler::cpp::Formatter; + // Allow access to FindValueByNumberCreatingIfUnknown. + friend class descriptor_unittest::DescriptorTest; + // Looks up a value by number. If the value does not exist, dynamically // creates a new EnumValueDescriptor for that value, assuming that it was // unknown. If a new descriptor is created, this is done in a thread-safe way, @@ -1184,9 +1179,18 @@ class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { void GetLocationPath(std::vector<int>* output) const; // True if this is a placeholder for an unknown type. - bool is_placeholder_; + bool is_placeholder_ : 1; // True if this is a placeholder and the type name wasn't fully-qualified. - bool is_unqualified_placeholder_; + bool is_unqualified_placeholder_ : 1; + + // This points to the last value _index_ that is part of the sequence starting + // with the first label, where + // `enum->value(i)->number() == enum->value(0)->number() + i` + // We measure relative to the first label to adapt to enum labels starting at + // 0 or 1. + // Uses 16-bit to avoid extra padding. Unlikely to have more than 2^15 + // sequentially numbered labels in an enum. + int16_t sequential_value_limit_; int value_count_; @@ -1211,6 +1215,7 @@ class PROTOBUF_EXPORT EnumDescriptor : private internal::SymbolBase { friend class DescriptorBuilder; friend class Descriptor; friend class FieldDescriptor; + friend class FileDescriptorTables; friend class EnumValueDescriptor; friend class FileDescriptor; friend class DescriptorPool; @@ -1615,7 +1620,16 @@ class PROTOBUF_EXPORT FileDescriptor { const TProtoStringType* name_; const TProtoStringType* package_; const DescriptorPool* pool_; - internal::LazyInitData* dependencies_once_; + + // Data required to do lazy initialization. + struct PROTOBUF_EXPORT LazyInitData { +#ifndef SWIG + internal::once_flag once; +#endif + const char** dependencies_names; + }; + + LazyInitData* dependencies_once_; static void DependenciesOnceInit(const FileDescriptor* to_init); void InternalDependenciesOnceInit() const; @@ -2096,7 +2110,6 @@ PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, file, const FileDescriptor*) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*) -PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool) PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool) @@ -2112,6 +2125,7 @@ PROTOBUF_DEFINE_STRING_ACCESSOR(FieldDescriptor, default_value_string) PROTOBUF_DEFINE_NAME_ACCESSOR(OneofDescriptor) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*) PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int) +PROTOBUF_DEFINE_ARRAY_ACCESSOR(OneofDescriptor, field, const FieldDescriptor*) PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions) PROTOBUF_DEFINE_NAME_ACCESSOR(EnumDescriptor) @@ -2233,6 +2247,11 @@ inline const OneofDescriptor* FieldDescriptor::containing_oneof() const { return is_oneof_ ? scope_.containing_oneof : nullptr; } +inline int FieldDescriptor::index_in_oneof() const { + GOOGLE_DCHECK(is_oneof_); + return static_cast<int>(this - scope_.containing_oneof->field(0)); +} + inline const Descriptor* FieldDescriptor::extension_scope() const { GOOGLE_CHECK(is_extension_); return scope_.extension_scope; @@ -2244,7 +2263,7 @@ inline FieldDescriptor::Label FieldDescriptor::label() const { inline FieldDescriptor::Type FieldDescriptor::type() const { if (type_once_) { - internal::call_once(type_once_->once, &FieldDescriptor::TypeOnceInit, this); + internal::call_once(*type_once_, &FieldDescriptor::TypeOnceInit, this); } return static_cast<Type>(type_); } @@ -2390,12 +2409,6 @@ 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. -inline const FieldDescriptor* OneofDescriptor::field(int index) const { - return fields_[index]; -} - } // namespace protobuf } // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc index 939e523c79..928223de68 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.cc @@ -453,7 +453,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[6]; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fdescriptor_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet, _internal_metadata_), ~0u, // no _extensions_ @@ -1120,7 +1120,7 @@ bool FieldDescriptorProto_Type_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_DOUBLE; constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FLOAT; constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT64; @@ -1142,7 +1142,7 @@ constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_SINT64; constexpr FieldDescriptorProto_Type FieldDescriptorProto::Type_MIN; constexpr FieldDescriptorProto_Type FieldDescriptorProto::Type_MAX; constexpr int FieldDescriptorProto::Type_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldDescriptorProto_Label_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[1]; @@ -1158,14 +1158,14 @@ bool FieldDescriptorProto_Label_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_OPTIONAL; constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED; constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REPEATED; constexpr FieldDescriptorProto_Label FieldDescriptorProto::Label_MIN; constexpr FieldDescriptorProto_Label FieldDescriptorProto::Label_MAX; constexpr int FieldDescriptorProto::Label_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FileOptions_OptimizeMode_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[2]; @@ -1181,14 +1181,14 @@ bool FileOptions_OptimizeMode_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr FileOptions_OptimizeMode FileOptions::SPEED; constexpr FileOptions_OptimizeMode FileOptions::CODE_SIZE; constexpr FileOptions_OptimizeMode FileOptions::LITE_RUNTIME; constexpr FileOptions_OptimizeMode FileOptions::OptimizeMode_MIN; constexpr FileOptions_OptimizeMode FileOptions::OptimizeMode_MAX; constexpr int FileOptions::OptimizeMode_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldOptions_CType_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[3]; @@ -1204,14 +1204,14 @@ bool FieldOptions_CType_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr FieldOptions_CType FieldOptions::STRING; constexpr FieldOptions_CType FieldOptions::CORD; constexpr FieldOptions_CType FieldOptions::STRING_PIECE; constexpr FieldOptions_CType FieldOptions::CType_MIN; constexpr FieldOptions_CType FieldOptions::CType_MAX; constexpr int FieldOptions::CType_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldOptions_JSType_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[4]; @@ -1227,14 +1227,14 @@ bool FieldOptions_JSType_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr FieldOptions_JSType FieldOptions::JS_NORMAL; constexpr FieldOptions_JSType FieldOptions::JS_STRING; constexpr FieldOptions_JSType FieldOptions::JS_NUMBER; constexpr FieldOptions_JSType FieldOptions::JSType_MIN; constexpr FieldOptions_JSType FieldOptions::JSType_MAX; constexpr int FieldOptions::JSType_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* MethodOptions_IdempotencyLevel_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[5]; @@ -1250,14 +1250,14 @@ bool MethodOptions_IdempotencyLevel_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr MethodOptions_IdempotencyLevel MethodOptions::IDEMPOTENCY_UNKNOWN; constexpr MethodOptions_IdempotencyLevel MethodOptions::NO_SIDE_EFFECTS; constexpr MethodOptions_IdempotencyLevel MethodOptions::IDEMPOTENT; constexpr MethodOptions_IdempotencyLevel MethodOptions::IdempotencyLevel_MIN; constexpr MethodOptions_IdempotencyLevel MethodOptions::IdempotencyLevel_MAX; constexpr int MethodOptions::IdempotencyLevel_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // =================================================================== @@ -1282,7 +1282,7 @@ FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet) } -void FileDescriptorSet::SharedCtor() { +inline void FileDescriptorSet::SharedCtor() { } FileDescriptorSet::~FileDescriptorSet() { @@ -1308,7 +1308,7 @@ void FileDescriptorSet::SetCachedSize(int size) const { void FileDescriptorSet::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1319,12 +1319,12 @@ void FileDescriptorSet::Clear() { const char* FileDescriptorSet::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.FileDescriptorProto file = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -1358,10 +1358,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorSet::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FileDescriptorSet::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorSet) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.FileDescriptorProto file = 1; @@ -1384,7 +1384,7 @@ size_t FileDescriptorSet::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorSet) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1414,7 +1414,7 @@ void FileDescriptorSet::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FileDescriptorSet::MergeFrom(const FileDescriptorSet& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorSet) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; file_.MergeFrom(from.file_); @@ -1429,7 +1429,8 @@ void FileDescriptorSet::CopyFrom(const FileDescriptorSet& from) { } bool FileDescriptorSet::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(file_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(file_)) + return false; return true; } @@ -1505,16 +1506,25 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) weak_dependency_(from.weak_dependency_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_package()) { package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package(), GetArenaForAllocation()); } syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_syntax()) { syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_syntax(), GetArenaForAllocation()); @@ -1532,10 +1542,19 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto) } -void FileDescriptorProto::SharedCtor() { +inline void FileDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&source_code_info_) - @@ -1570,7 +1589,7 @@ void FileDescriptorProto::SetCachedSize(int size) const { void FileDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1609,12 +1628,12 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1626,7 +1645,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional string package = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_package(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1638,7 +1657,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated string dependency = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -1655,7 +1674,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated .google.protobuf.DescriptorProto message_type = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { ptr -= 1; do { ptr += 1; @@ -1668,7 +1687,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { ptr -= 1; do { ptr += 1; @@ -1681,7 +1700,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated .google.protobuf.ServiceDescriptorProto service = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -1694,7 +1713,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated .google.protobuf.FieldDescriptorProto extension = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 1; do { ptr += 1; @@ -1707,7 +1726,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional .google.protobuf.FileOptions options = 8; case 8: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -1715,7 +1734,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional .google.protobuf.SourceCodeInfo source_code_info = 9; case 9: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) { ptr = ctx->ParseMessage(_internal_mutable_source_code_info(), ptr); CHK_(ptr); } else @@ -1723,15 +1742,15 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated int32 public_dependency = 10; case 10: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) { ptr -= 1; do { ptr += 1; - _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr)); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<80>(ptr)); - } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82) { + } else if (static_cast<uint8_t>(tag) == 82) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_public_dependency(), ptr, ctx); CHK_(ptr); } else @@ -1739,15 +1758,15 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated int32 weak_dependency = 11; case 11: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 88)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 88)) { ptr -= 1; do { ptr += 1; - _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr)); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<88>(ptr)); - } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90) { + } else if (static_cast<uint8_t>(tag) == 90) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_weak_dependency(), ptr, ctx); CHK_(ptr); } else @@ -1755,7 +1774,7 @@ const char* FileDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional string syntax = 12; case 12: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) { auto str = _internal_mutable_syntax(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1789,10 +1808,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FileDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -1908,7 +1927,7 @@ size_t FileDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2023,7 +2042,7 @@ void FileDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; dependency_.MergeFrom(from.dependency_); @@ -2062,10 +2081,14 @@ void FileDescriptorProto::CopyFrom(const FileDescriptorProto& from) { } bool FileDescriptorProto::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(message_type_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(service_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(message_type_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(service_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_)) + return false; if (_internal_has_options()) { if (!options_->IsInitialized()) return false; } @@ -2159,7 +2182,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange) } -void DescriptorProto_ExtensionRange::SharedCtor() { +inline void DescriptorProto_ExtensionRange::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&end_) - @@ -2190,7 +2213,7 @@ void DescriptorProto_ExtensionRange::SetCachedSize(int size) const { void DescriptorProto_ExtensionRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2212,30 +2235,30 @@ const char* DescriptorProto_ExtensionRange::_InternalParse(const char* ptr, ::PR #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional int32 start = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_start(&has_bits); - start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 end = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_end(&has_bits); - end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } 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)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -2265,10 +2288,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ExtensionRange::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* DescriptorProto_ExtensionRange::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ExtensionRange) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -2304,7 +2327,7 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ExtensionRange) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2347,7 +2370,7 @@ void DescriptorProto_ExtensionRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRange& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ExtensionRange) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -2430,7 +2453,7 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange) } -void DescriptorProto_ReservedRange::SharedCtor() { +inline void DescriptorProto_ReservedRange::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&end_) - @@ -2460,7 +2483,7 @@ void DescriptorProto_ReservedRange::SetCachedSize(int size) const { void DescriptorProto_ReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2478,23 +2501,23 @@ const char* DescriptorProto_ReservedRange::_InternalParse(const char* ptr, ::PRO #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional int32 start = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_start(&has_bits); - start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 end = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_end(&has_bits); - end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -2523,10 +2546,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ReservedRange::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* DescriptorProto_ReservedRange::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ReservedRange) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -2554,7 +2577,7 @@ size_t DescriptorProto_ReservedRange::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ReservedRange) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2590,7 +2613,7 @@ void DescriptorProto_ReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* void DescriptorProto_ReservedRange::MergeFrom(const DescriptorProto_ReservedRange& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ReservedRange) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -2683,6 +2706,9 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from) reserved_name_(from.reserved_name_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -2695,8 +2721,11 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto) } -void DescriptorProto::SharedCtor() { +inline void DescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING options_ = nullptr; } @@ -2725,7 +2754,7 @@ void DescriptorProto::SetCachedSize(int size) const { void DescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2755,12 +2784,12 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -2772,7 +2801,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.FieldDescriptorProto field = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -2785,7 +2814,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.DescriptorProto nested_type = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -2798,7 +2827,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { ptr -= 1; do { ptr += 1; @@ -2811,7 +2840,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { ptr -= 1; do { ptr += 1; @@ -2824,7 +2853,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.FieldDescriptorProto extension = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -2837,7 +2866,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // optional .google.protobuf.MessageOptions options = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -2845,7 +2874,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; case 8: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) { ptr -= 1; do { ptr += 1; @@ -2858,7 +2887,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; case 9: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) { ptr -= 1; do { ptr += 1; @@ -2871,7 +2900,7 @@ const char* DescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPAC continue; // repeated string reserved_name = 10; case 10: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) { ptr -= 1; do { ptr += 1; @@ -2910,10 +2939,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* DescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -3013,7 +3042,7 @@ size_t DescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -3110,7 +3139,7 @@ void DescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void DescriptorProto::MergeFrom(const DescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; field_.MergeFrom(from.field_); @@ -3141,12 +3170,18 @@ void DescriptorProto::CopyFrom(const DescriptorProto& from) { } bool DescriptorProto::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(field_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(nested_type_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_range_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_)) return false; - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(oneof_decl_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(field_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(nested_type_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_range_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_)) + return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(oneof_decl_)) + return false; if (_internal_has_options()) { if (!options_->IsInitialized()) return false; } @@ -3202,11 +3237,11 @@ ExtensionRangeOptions::ExtensionRangeOptions(const ExtensionRangeOptions& from) : ::PROTOBUF_NAMESPACE_ID::Message(), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); // @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions) } -void ExtensionRangeOptions::SharedCtor() { +inline void ExtensionRangeOptions::SharedCtor() { } ExtensionRangeOptions::~ExtensionRangeOptions() { @@ -3232,7 +3267,7 @@ void ExtensionRangeOptions::SetCachedSize(int size) const { void ExtensionRangeOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -3244,12 +3279,12 @@ void ExtensionRangeOptions::Clear() { const char* ExtensionRangeOptions::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -3288,10 +3323,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* ExtensionRangeOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* ExtensionRangeOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; @@ -3320,7 +3355,7 @@ size_t ExtensionRangeOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -3350,11 +3385,11 @@ void ExtensionRangeOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void ExtensionRangeOptions::MergeFrom(const ExtensionRangeOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ExtensionRangeOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -3370,7 +3405,8 @@ bool ExtensionRangeOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -3446,26 +3482,41 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_extendee()) { extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_extendee(), GetArenaForAllocation()); } type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_type_name()) { type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_name(), GetArenaForAllocation()); } default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_default_value()) { default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(), GetArenaForAllocation()); } json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_json_name()) { json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(), GetArenaForAllocation()); @@ -3481,12 +3532,27 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto) } -void FieldDescriptorProto::SharedCtor() { +inline void FieldDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&proto3_optional_) - @@ -3524,7 +3590,7 @@ void FieldDescriptorProto::SetCachedSize(int size) const { void FieldDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -3568,12 +3634,12 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -3585,7 +3651,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional string extendee = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_extendee(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -3597,17 +3663,17 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional int32 number = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { _Internal::set_has_number(&has_bits); - number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { + arc_ui64 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)); @@ -3619,8 +3685,8 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { + arc_ui64 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)); @@ -3632,7 +3698,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional string type_name = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { auto str = _internal_mutable_type_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -3644,7 +3710,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional string default_value = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { auto str = _internal_mutable_default_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -3656,7 +3722,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional .google.protobuf.FieldOptions options = 8; case 8: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -3664,16 +3730,16 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional int32 oneof_index = 9; case 9: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) { _Internal::set_has_oneof_index(&has_bits); - oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional string json_name = 10; case 10: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) { auto str = _internal_mutable_json_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -3685,7 +3751,7 @@ const char* FieldDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional bool proto3_optional = 17; case 17: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 136)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 136)) { _Internal::set_has_proto3_optional(&has_bits); proto3_optional_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -3716,10 +3782,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FieldDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FieldDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -3825,7 +3891,7 @@ size_t FieldDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -3922,7 +3988,7 @@ void FieldDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -4061,6 +4127,9 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -4073,8 +4142,11 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto) } -void OneofDescriptorProto::SharedCtor() { +inline void OneofDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING options_ = nullptr; } @@ -4103,7 +4175,7 @@ void OneofDescriptorProto::SetCachedSize(int size) const { void OneofDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -4125,12 +4197,12 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -4142,7 +4214,7 @@ const char* OneofDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional .google.protobuf.OneofOptions options = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -4172,10 +4244,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* OneofDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* OneofDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -4209,7 +4281,7 @@ size_t OneofDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -4249,7 +4321,7 @@ void OneofDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -4330,7 +4402,7 @@ EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(con // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange) } -void EnumDescriptorProto_EnumReservedRange::SharedCtor() { +inline void EnumDescriptorProto_EnumReservedRange::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&end_) - @@ -4360,7 +4432,7 @@ void EnumDescriptorProto_EnumReservedRange::SetCachedSize(int size) const { void EnumDescriptorProto_EnumReservedRange::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -4378,23 +4450,23 @@ const char* EnumDescriptorProto_EnumReservedRange::_InternalParse(const char* pt #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional int32 start = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_start(&has_bits); - start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 end = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_end(&has_bits); - end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -4423,10 +4495,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto_EnumReservedRange::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* EnumDescriptorProto_EnumReservedRange::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -4454,7 +4526,7 @@ size_t EnumDescriptorProto_EnumReservedRange::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -4490,7 +4562,7 @@ void EnumDescriptorProto_EnumReservedRange::MergeImpl(::PROTOBUF_NAMESPACE_ID::M void EnumDescriptorProto_EnumReservedRange::MergeFrom(const EnumDescriptorProto_EnumReservedRange& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -4573,6 +4645,9 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) reserved_name_(from.reserved_name_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -4585,8 +4660,11 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto) } -void EnumDescriptorProto::SharedCtor() { +inline void EnumDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING options_ = nullptr; } @@ -4615,7 +4693,7 @@ void EnumDescriptorProto::SetCachedSize(int size) const { void EnumDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -4640,12 +4718,12 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -4657,7 +4735,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated .google.protobuf.EnumValueDescriptorProto value = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -4670,7 +4748,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional .google.protobuf.EnumOptions options = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -4678,7 +4756,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { ptr -= 1; do { ptr += 1; @@ -4691,7 +4769,7 @@ const char* EnumDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // repeated string reserved_name = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { ptr -= 1; do { ptr += 1; @@ -4730,10 +4808,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* EnumDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -4793,7 +4871,7 @@ size_t EnumDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -4855,7 +4933,7 @@ void EnumDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; value_.MergeFrom(from.value_); @@ -4881,7 +4959,8 @@ void EnumDescriptorProto::CopyFrom(const EnumDescriptorProto& from) { } bool EnumDescriptorProto::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(value_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(value_)) + return false; if (_internal_has_options()) { if (!options_->IsInitialized()) return false; } @@ -4946,6 +5025,9 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -4959,8 +5041,11 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto) } -void EnumValueDescriptorProto::SharedCtor() { +inline void EnumValueDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&number_) - @@ -4992,7 +5077,7 @@ void EnumValueDescriptorProto::SetCachedSize(int size) const { void EnumValueDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -5015,12 +5100,12 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -5032,16 +5117,16 @@ const char* EnumValueDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF continue; // optional int32 number = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_number(&has_bits); - number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } 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)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -5071,10 +5156,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* EnumValueDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* EnumValueDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -5114,7 +5199,7 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -5159,7 +5244,7 @@ void EnumValueDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -5251,6 +5336,9 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro method_(from.method_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -5263,8 +5351,11 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto) } -void ServiceDescriptorProto::SharedCtor() { +inline void ServiceDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING options_ = nullptr; } @@ -5293,7 +5384,7 @@ void ServiceDescriptorProto::SetCachedSize(int size) const { void ServiceDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -5316,12 +5407,12 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -5333,7 +5424,7 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N continue; // repeated .google.protobuf.MethodDescriptorProto method = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -5346,7 +5437,7 @@ const char* ServiceDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_N continue; // optional .google.protobuf.ServiceOptions options = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -5376,10 +5467,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* ServiceDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* ServiceDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -5421,7 +5512,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -5468,7 +5559,7 @@ void ServiceDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; method_.MergeFrom(from.method_); @@ -5492,7 +5583,8 @@ void ServiceDescriptorProto::CopyFrom(const ServiceDescriptorProto& from) { } bool ServiceDescriptorProto::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(method_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(method_)) + return false; if (_internal_has_options()) { if (!options_->IsInitialized()) return false; } @@ -5564,16 +5656,25 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_input_type()) { input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_input_type(), GetArenaForAllocation()); } output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_output_type()) { output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_output_type(), GetArenaForAllocation()); @@ -5589,10 +5690,19 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto) } -void MethodDescriptorProto::SharedCtor() { +inline void MethodDescriptorProto::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&server_streaming_) - @@ -5626,7 +5736,7 @@ void MethodDescriptorProto::SetCachedSize(int size) const { void MethodDescriptorProto::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -5657,12 +5767,12 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -5674,7 +5784,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // optional string input_type = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_input_type(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -5686,7 +5796,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // optional string output_type = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { auto str = _internal_mutable_output_type(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -5698,7 +5808,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // optional .google.protobuf.MethodOptions options = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { ptr = ctx->ParseMessage(_internal_mutable_options(), ptr); CHK_(ptr); } else @@ -5706,7 +5816,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // optional bool client_streaming = 5 [default = false]; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { _Internal::set_has_client_streaming(&has_bits); client_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -5715,7 +5825,7 @@ const char* MethodDescriptorProto::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // optional bool server_streaming = 6 [default = false]; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) { _Internal::set_has_server_streaming(&has_bits); server_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -5746,10 +5856,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* MethodDescriptorProto::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* MethodDescriptorProto::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodDescriptorProto) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -5815,7 +5925,7 @@ size_t MethodDescriptorProto::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodDescriptorProto) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -5879,7 +5989,7 @@ void MethodDescriptorProto::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodDescriptorProto) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -6039,53 +6149,83 @@ FileOptions::FileOptions(const FileOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_java_package()) { java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_package(), GetArenaForAllocation()); } java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_java_outer_classname()) { java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_outer_classname(), GetArenaForAllocation()); } go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_go_package()) { go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_go_package(), GetArenaForAllocation()); } objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_objc_class_prefix()) { objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_objc_class_prefix(), GetArenaForAllocation()); } csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_csharp_namespace()) { csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_csharp_namespace(), GetArenaForAllocation()); } swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_swift_prefix()) { swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_swift_prefix(), GetArenaForAllocation()); } php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_php_class_prefix()) { php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_class_prefix(), GetArenaForAllocation()); } php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_php_namespace()) { php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_namespace(), GetArenaForAllocation()); } php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_php_metadata_namespace()) { php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_metadata_namespace(), GetArenaForAllocation()); } ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_ruby_package()) { ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_ruby_package(), GetArenaForAllocation()); @@ -6096,17 +6236,47 @@ FileOptions::FileOptions(const FileOptions& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions) } -void FileOptions::SharedCtor() { +inline void FileOptions::SharedCtor() { java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&java_multiple_files_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) - @@ -6148,7 +6318,7 @@ void FileOptions::SetCachedSize(int size) const { void FileOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -6209,12 +6379,12 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string java_package = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_java_package(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6226,7 +6396,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string java_outer_classname = 8; case 8: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) { auto str = _internal_mutable_java_outer_classname(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6238,8 +6408,8 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) { + arc_ui64 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)); @@ -6251,7 +6421,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool java_multiple_files = 10 [default = false]; case 10: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) { _Internal::set_has_java_multiple_files(&has_bits); java_multiple_files_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6260,7 +6430,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string go_package = 11; case 11: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) { auto str = _internal_mutable_go_package(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6272,7 +6442,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool cc_generic_services = 16 [default = false]; case 16: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 128)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 128)) { _Internal::set_has_cc_generic_services(&has_bits); cc_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6281,7 +6451,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool java_generic_services = 17 [default = false]; case 17: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 136)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 136)) { _Internal::set_has_java_generic_services(&has_bits); java_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6290,7 +6460,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool py_generic_services = 18 [default = false]; case 18: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 144)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 144)) { _Internal::set_has_py_generic_services(&has_bits); py_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6299,7 +6469,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool java_generate_equals_and_hash = 20 [deprecated = true]; case 20: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 160)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 160)) { _Internal::set_has_java_generate_equals_and_hash(&has_bits); java_generate_equals_and_hash_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6308,7 +6478,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool deprecated = 23 [default = false]; case 23: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 184)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 184)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6317,7 +6487,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool java_string_check_utf8 = 27 [default = false]; case 27: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 216)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 216)) { _Internal::set_has_java_string_check_utf8(&has_bits); java_string_check_utf8_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6326,7 +6496,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool cc_enable_arenas = 31 [default = true]; case 31: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 248)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 248)) { _Internal::set_has_cc_enable_arenas(&has_bits); cc_enable_arenas_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6335,7 +6505,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string objc_class_prefix = 36; case 36: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { auto str = _internal_mutable_objc_class_prefix(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6347,7 +6517,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string csharp_namespace = 37; case 37: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { auto str = _internal_mutable_csharp_namespace(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6359,7 +6529,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string swift_prefix = 39; case 39: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { auto str = _internal_mutable_swift_prefix(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6371,7 +6541,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string php_class_prefix = 40; case 40: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) { auto str = _internal_mutable_php_class_prefix(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6383,7 +6553,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string php_namespace = 41; case 41: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) { auto str = _internal_mutable_php_namespace(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6395,7 +6565,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool php_generic_services = 42 [default = false]; case 42: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) { _Internal::set_has_php_generic_services(&has_bits); php_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -6404,7 +6574,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string php_metadata_namespace = 44; case 44: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) { auto str = _internal_mutable_php_metadata_namespace(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6416,7 +6586,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional string ruby_package = 45; case 45: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 106)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 106)) { auto str = _internal_mutable_ruby_package(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -6428,7 +6598,7 @@ const char* FileOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -6468,10 +6638,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FileOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FileOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -6662,7 +6832,7 @@ size_t FileOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -6820,7 +6990,7 @@ void FileOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FileOptions::MergeFrom(const FileOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); @@ -6893,7 +7063,7 @@ void FileOptions::MergeFrom(const FileOptions& from) { } _has_bits_[0] |= cached_has_bits; } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -6909,7 +7079,8 @@ bool FileOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -7022,14 +7193,14 @@ MessageOptions::MessageOptions(const MessageOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); ::memcpy(&message_set_wire_format_, &from.message_set_wire_format_, static_cast<size_t>(reinterpret_cast<char*>(&map_entry_) - reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions) } -void MessageOptions::SharedCtor() { +inline void MessageOptions::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&message_set_wire_format_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&map_entry_) - @@ -7059,7 +7230,7 @@ void MessageOptions::SetCachedSize(int size) const { void MessageOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -7076,12 +7247,12 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional bool message_set_wire_format = 1 [default = false]; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_message_set_wire_format(&has_bits); message_set_wire_format_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7090,7 +7261,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE continue; // optional bool no_standard_descriptor_accessor = 2 [default = false]; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_no_standard_descriptor_accessor(&has_bits); no_standard_descriptor_accessor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7099,7 +7270,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE continue; // optional bool deprecated = 3 [default = false]; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7108,7 +7279,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE continue; // optional bool map_entry = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) { _Internal::set_has_map_entry(&has_bits); map_entry_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7117,7 +7288,7 @@ const char* MessageOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -7157,10 +7328,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* MessageOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* MessageOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MessageOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -7214,7 +7385,7 @@ size_t MessageOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -7267,7 +7438,7 @@ void MessageOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void MessageOptions::MergeFrom(const MessageOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MessageOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); @@ -7287,7 +7458,7 @@ void MessageOptions::MergeFrom(const MessageOptions& from) { } _has_bits_[0] |= cached_has_bits; } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -7303,7 +7474,8 @@ bool MessageOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -7368,14 +7540,14 @@ FieldOptions::FieldOptions(const FieldOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); ::memcpy(&ctype_, &from.ctype_, static_cast<size_t>(reinterpret_cast<char*>(&jstype_) - reinterpret_cast<char*>(&ctype_)) + sizeof(jstype_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions) } -void FieldOptions::SharedCtor() { +inline void FieldOptions::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&ctype_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&jstype_) - @@ -7405,7 +7577,7 @@ void FieldOptions::SetCachedSize(int size) const { void FieldOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -7425,13 +7597,13 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + arc_ui64 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)); @@ -7443,7 +7615,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I continue; // optional bool packed = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_packed(&has_bits); packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7452,7 +7624,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I continue; // optional bool deprecated = 3 [default = false]; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7461,7 +7633,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I continue; // optional bool lazy = 5 [default = false]; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { _Internal::set_has_lazy(&has_bits); lazy_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7470,8 +7642,8 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) { + arc_ui64 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)); @@ -7483,7 +7655,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I continue; // optional bool weak = 10 [default = false]; case 10: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) { _Internal::set_has_weak(&has_bits); weak_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -7492,7 +7664,7 @@ const char* FieldOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_I continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -7532,10 +7704,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FieldOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FieldOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -7603,7 +7775,7 @@ size_t FieldOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -7668,7 +7840,7 @@ void FieldOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FieldOptions::MergeFrom(const FieldOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); @@ -7694,7 +7866,7 @@ void FieldOptions::MergeFrom(const FieldOptions& from) { } _has_bits_[0] |= cached_has_bits; } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -7710,7 +7882,8 @@ bool FieldOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -7755,11 +7928,11 @@ OneofOptions::OneofOptions(const OneofOptions& from) : ::PROTOBUF_NAMESPACE_ID::Message(), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions) } -void OneofOptions::SharedCtor() { +inline void OneofOptions::SharedCtor() { } OneofOptions::~OneofOptions() { @@ -7785,7 +7958,7 @@ void OneofOptions::SetCachedSize(int size) const { void OneofOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -7797,12 +7970,12 @@ void OneofOptions::Clear() { const char* OneofOptions::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -7841,10 +8014,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* OneofOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* OneofOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; @@ -7873,7 +8046,7 @@ size_t OneofOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -7903,11 +8076,11 @@ void OneofOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void OneofOptions::MergeFrom(const OneofOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -7923,7 +8096,8 @@ bool OneofOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -7969,14 +8143,14 @@ EnumOptions::EnumOptions(const EnumOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); ::memcpy(&allow_alias_, &from.allow_alias_, static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) - reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions) } -void EnumOptions::SharedCtor() { +inline void EnumOptions::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&allow_alias_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) - @@ -8006,7 +8180,7 @@ void EnumOptions::SetCachedSize(int size) const { void EnumOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8023,12 +8197,12 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional bool allow_alias = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_allow_alias(&has_bits); allow_alias_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -8037,7 +8211,7 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // optional bool deprecated = 3 [default = false]; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -8046,7 +8220,7 @@ const char* EnumOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -8086,10 +8260,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* EnumOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* EnumOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -8131,7 +8305,7 @@ size_t EnumOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8174,7 +8348,7 @@ void EnumOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void EnumOptions::MergeFrom(const EnumOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); @@ -8188,7 +8362,7 @@ void EnumOptions::MergeFrom(const EnumOptions& from) { } _has_bits_[0] |= cached_has_bits; } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -8204,7 +8378,8 @@ bool EnumOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -8254,12 +8429,12 @@ EnumValueOptions::EnumValueOptions(const EnumValueOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); deprecated_ = from.deprecated_; // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueOptions) } -void EnumValueOptions::SharedCtor() { +inline void EnumValueOptions::SharedCtor() { deprecated_ = false; } @@ -8286,7 +8461,7 @@ void EnumValueOptions::SetCachedSize(int size) const { void EnumValueOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8301,12 +8476,12 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional bool deprecated = 1 [default = false]; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -8315,7 +8490,7 @@ const char* EnumValueOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPA continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -8355,10 +8530,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* EnumValueOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* EnumValueOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -8394,7 +8569,7 @@ size_t EnumValueOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8430,14 +8605,14 @@ void EnumValueOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void EnumValueOptions::MergeFrom(const EnumValueOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); if (from._internal_has_deprecated()) { _internal_set_deprecated(from._internal_deprecated()); } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -8453,7 +8628,8 @@ bool EnumValueOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -8498,12 +8674,12 @@ ServiceOptions::ServiceOptions(const ServiceOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); deprecated_ = from.deprecated_; // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions) } -void ServiceOptions::SharedCtor() { +inline void ServiceOptions::SharedCtor() { deprecated_ = false; } @@ -8530,7 +8706,7 @@ void ServiceOptions::SetCachedSize(int size) const { void ServiceOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8545,12 +8721,12 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional bool deprecated = 33 [default = false]; case 33: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -8559,7 +8735,7 @@ const char* ServiceOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -8599,10 +8775,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* ServiceOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* ServiceOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -8638,7 +8814,7 @@ size_t ServiceOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8674,14 +8850,14 @@ void ServiceOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void ServiceOptions::MergeFrom(const ServiceOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); if (from._internal_has_deprecated()) { _internal_set_deprecated(from._internal_deprecated()); } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -8697,7 +8873,8 @@ bool ServiceOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -8745,14 +8922,14 @@ MethodOptions::MethodOptions(const MethodOptions& from) _has_bits_(from._has_bits_), uninterpreted_option_(from.uninterpreted_option_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); ::memcpy(&deprecated_, &from.deprecated_, static_cast<size_t>(reinterpret_cast<char*>(&idempotency_level_) - reinterpret_cast<char*>(&deprecated_)) + sizeof(idempotency_level_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions) } -void MethodOptions::SharedCtor() { +inline void MethodOptions::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&deprecated_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&idempotency_level_) - @@ -8782,7 +8959,7 @@ void MethodOptions::SetCachedSize(int size) const { void MethodOptions::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8802,12 +8979,12 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional bool deprecated = 33 [default = false]; case 33: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_deprecated(&has_bits); deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -8816,8 +8993,8 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + arc_ui64 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)); @@ -8829,7 +9006,7 @@ const char* MethodOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ continue; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; case 999: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { ptr -= 2; do { ptr += 2; @@ -8869,10 +9046,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* MethodOptions::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* MethodOptions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodOptions) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -8915,7 +9092,7 @@ size_t MethodOptions::ByteSizeLong() const { total_size += _extensions_.ByteSize(); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -8959,7 +9136,7 @@ void MethodOptions::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void MethodOptions::MergeFrom(const MethodOptions& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodOptions) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; uninterpreted_option_.MergeFrom(from.uninterpreted_option_); @@ -8973,7 +9150,7 @@ void MethodOptions::MergeFrom(const MethodOptions& from) { } _has_bits_[0] |= cached_has_bits; } - _extensions_.MergeFrom(from._extensions_); + _extensions_.MergeFrom(internal_default_instance(), from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -8989,7 +9166,8 @@ bool MethodOptions::IsInitialized() const { return false; } - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) + return false; return true; } @@ -9043,6 +9221,9 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name_part()) { name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name_part(), GetArenaForAllocation()); @@ -9051,8 +9232,11 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart) } -void UninterpretedOption_NamePart::SharedCtor() { +inline void UninterpretedOption_NamePart::SharedCtor() { name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING is_extension_ = false; } @@ -9080,7 +9264,7 @@ void UninterpretedOption_NamePart::SetCachedSize(int size) const { void UninterpretedOption_NamePart::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -9097,12 +9281,12 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // required string name_part = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name_part(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -9114,7 +9298,7 @@ const char* UninterpretedOption_NamePart::_InternalParse(const char* ptr, ::PROT continue; // required bool is_extension = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_is_extension(&has_bits); is_extension_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -9145,10 +9329,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption_NamePart::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* UninterpretedOption_NamePart::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption.NamePart) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -9210,7 +9394,7 @@ size_t UninterpretedOption_NamePart::ByteSizeLong() const { } else { total_size += RequiredFieldsByteSizeFallback(); } - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -9233,7 +9417,7 @@ void UninterpretedOption_NamePart::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* t void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption.NamePart) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -9322,16 +9506,25 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) name_(from.name_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_identifier_value()) { identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_identifier_value(), GetArenaForAllocation()); } string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_string_value()) { string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_string_value(), GetArenaForAllocation()); } aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_aggregate_value()) { aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aggregate_value(), GetArenaForAllocation()); @@ -9342,10 +9535,19 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption) } -void UninterpretedOption::SharedCtor() { +inline void UninterpretedOption::SharedCtor() { identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&positive_int_value_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&double_value_) - @@ -9378,7 +9580,7 @@ void UninterpretedOption::SetCachedSize(int size) const { void UninterpretedOption::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -9408,12 +9610,12 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -9426,7 +9628,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional string identifier_value = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { auto str = _internal_mutable_identifier_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -9438,7 +9640,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional uint64 positive_int_value = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { _Internal::set_has_positive_int_value(&has_bits); positive_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -9447,7 +9649,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional int64 negative_int_value = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { _Internal::set_has_negative_int_value(&has_bits); negative_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -9456,7 +9658,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional double double_value = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 49)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 49)) { _Internal::set_has_double_value(&has_bits); double_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); @@ -9465,7 +9667,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional bytes string_value = 7; case 7: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) { auto str = _internal_mutable_string_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); @@ -9474,7 +9676,7 @@ const char* UninterpretedOption::_InternalParse(const char* ptr, ::PROTOBUF_NAME continue; // optional string aggregate_value = 8; case 8: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) { auto str = _internal_mutable_aggregate_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -9508,10 +9710,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* UninterpretedOption::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.UninterpretedOption.NamePart name = 2; @@ -9579,7 +9781,7 @@ size_t UninterpretedOption::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -9648,7 +9850,7 @@ void UninterpretedOption::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void UninterpretedOption::MergeFrom(const UninterpretedOption& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; name_.MergeFrom(from.name_); @@ -9685,7 +9887,8 @@ void UninterpretedOption::CopyFrom(const UninterpretedOption& from) { } bool UninterpretedOption::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(name_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(name_)) + return false; return true; } @@ -9758,11 +9961,17 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& leading_detached_comments_(from.leading_detached_comments_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_leading_comments()) { leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_leading_comments(), GetArenaForAllocation()); } trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_trailing_comments()) { trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_trailing_comments(), GetArenaForAllocation()); @@ -9770,9 +9979,15 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location& // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location) } -void SourceCodeInfo_Location::SharedCtor() { +inline void SourceCodeInfo_Location::SharedCtor() { leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } SourceCodeInfo_Location::~SourceCodeInfo_Location() { @@ -9800,7 +10015,7 @@ void SourceCodeInfo_Location::SetCachedSize(int size) const { void SourceCodeInfo_Location::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -9824,34 +10039,34 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated int32 path = 1 [packed = true]; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx); CHK_(ptr); - } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { - _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + } else if (static_cast<uint8_t>(tag) == 8) { + _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; // repeated int32 span = 2 [packed = true]; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_span(), ptr, ctx); CHK_(ptr); - } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) { - _internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + } else if (static_cast<uint8_t>(tag) == 16) { + _internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; // optional string leading_comments = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { auto str = _internal_mutable_leading_comments(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -9863,7 +10078,7 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ continue; // optional string trailing_comments = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { auto str = _internal_mutable_trailing_comments(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -9875,7 +10090,7 @@ const char* SourceCodeInfo_Location::_InternalParse(const char* ptr, ::PROTOBUF_ continue; // repeated string leading_detached_comments = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { ptr -= 1; do { ptr += 1; @@ -9914,10 +10129,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo_Location::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* SourceCodeInfo_Location::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo.Location) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated int32 path = 1 [packed = true]; @@ -9981,7 +10196,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo.Location) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -9992,7 +10207,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + static_cast<arc_i32>(data_size)); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); _path_cached_byte_size_.store(cached_size, @@ -10007,7 +10222,7 @@ size_t SourceCodeInfo_Location::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + static_cast<arc_i32>(data_size)); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); _span_cached_byte_size_.store(cached_size, @@ -10059,7 +10274,7 @@ void SourceCodeInfo_Location::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo.Location) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; path_.MergeFrom(from.path_); @@ -10138,7 +10353,7 @@ SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo) } -void SourceCodeInfo::SharedCtor() { +inline void SourceCodeInfo::SharedCtor() { } SourceCodeInfo::~SourceCodeInfo() { @@ -10164,7 +10379,7 @@ void SourceCodeInfo::SetCachedSize(int size) const { void SourceCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -10175,12 +10390,12 @@ void SourceCodeInfo::Clear() { const char* SourceCodeInfo::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.SourceCodeInfo.Location location = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -10214,10 +10429,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* SourceCodeInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.SourceCodeInfo.Location location = 1; @@ -10240,7 +10455,7 @@ size_t SourceCodeInfo::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -10270,7 +10485,7 @@ void SourceCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void SourceCodeInfo::MergeFrom(const SourceCodeInfo& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; location_.MergeFrom(from.location_); @@ -10332,6 +10547,9 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn path_(from.path_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_source_file()) { source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_source_file(), GetArenaForAllocation()); @@ -10342,8 +10560,11 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation) } -void GeneratedCodeInfo_Annotation::SharedCtor() { +inline void GeneratedCodeInfo_Annotation::SharedCtor() { source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&begin_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&end_) - @@ -10374,7 +10595,7 @@ void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const { void GeneratedCodeInfo_Annotation::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -10396,23 +10617,23 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated int32 path = 1 [packed = true]; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx); CHK_(ptr); - } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) { - _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); + } else if (static_cast<uint8_t>(tag) == 8) { + _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr)); CHK_(ptr); } else goto handle_unusual; continue; // optional string source_file = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_source_file(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -10424,18 +10645,18 @@ const char* GeneratedCodeInfo_Annotation::_InternalParse(const char* ptr, ::PROT continue; // optional int32 begin = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { _Internal::set_has_begin(&has_bits); - begin_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + begin_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 end = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { _Internal::set_has_end(&has_bits); - end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -10464,10 +10685,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* GeneratedCodeInfo_Annotation::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* GeneratedCodeInfo_Annotation::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated int32 path = 1 [packed = true]; @@ -10514,7 +10735,7 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo.Annotation) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -10525,7 +10746,7 @@ size_t GeneratedCodeInfo_Annotation::ByteSizeLong() const { if (data_size > 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( - static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size)); + static_cast<arc_i32>(data_size)); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); _path_cached_byte_size_.store(cached_size, @@ -10572,7 +10793,7 @@ void GeneratedCodeInfo_Annotation::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* t void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo.Annotation) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; path_.MergeFrom(from.path_); @@ -10652,7 +10873,7 @@ GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo) } -void GeneratedCodeInfo::SharedCtor() { +inline void GeneratedCodeInfo::SharedCtor() { } GeneratedCodeInfo::~GeneratedCodeInfo() { @@ -10678,7 +10899,7 @@ void GeneratedCodeInfo::SetCachedSize(int size) const { void GeneratedCodeInfo::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -10689,12 +10910,12 @@ void GeneratedCodeInfo::Clear() { const char* GeneratedCodeInfo::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -10728,10 +10949,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* GeneratedCodeInfo::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* GeneratedCodeInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; @@ -10754,7 +10975,7 @@ size_t GeneratedCodeInfo::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -10784,7 +11005,7 @@ void GeneratedCodeInfo::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void GeneratedCodeInfo::MergeFrom(const GeneratedCodeInfo& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; annotation_.MergeFrom(from.annotation_); diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h index 4b3af196eb..ecf3a8af07 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -51,7 +51,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fdescriptor_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -391,7 +391,12 @@ class PROTOBUF_EXPORT FileDescriptorSet final : } inline void Swap(FileDescriptorSet* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -405,11 +410,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : // implements Message ---------------------------------------------- - inline FileDescriptorSet* New() const final { - return new FileDescriptorSet(); - } - - FileDescriptorSet* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FileDescriptorSet* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FileDescriptorSet>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -424,8 +425,8 @@ class PROTOBUF_EXPORT FileDescriptorSet 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -433,6 +434,8 @@ class PROTOBUF_EXPORT FileDescriptorSet final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FileDescriptorSet* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FileDescriptorSet"; @@ -550,7 +553,12 @@ class PROTOBUF_EXPORT FileDescriptorProto final : } inline void Swap(FileDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -564,11 +572,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : // implements Message ---------------------------------------------- - inline FileDescriptorProto* New() const final { - return new FileDescriptorProto(); - } - - FileDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FileDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FileDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -583,8 +587,8 @@ class PROTOBUF_EXPORT FileDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -592,6 +596,8 @@ class PROTOBUF_EXPORT FileDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FileDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FileDescriptorProto"; @@ -730,19 +736,19 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public: void clear_public_dependency(); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_public_dependency(int index) const; - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 _internal_public_dependency(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& _internal_public_dependency() const; - void _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + void _internal_add_public_dependency(arc_i32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* _internal_mutable_public_dependency(); public: - ::PROTOBUF_NAMESPACE_ID::int32 public_dependency(int index) const; - void set_public_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); - void add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 public_dependency(int index) const; + void set_public_dependency(int index, arc_i32 value); + void add_public_dependency(arc_i32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& public_dependency() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* mutable_public_dependency(); // repeated int32 weak_dependency = 11; @@ -752,19 +758,19 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public: void clear_weak_dependency(); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_weak_dependency(int index) const; - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 _internal_weak_dependency(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& _internal_weak_dependency() const; - void _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + void _internal_add_weak_dependency(arc_i32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* _internal_mutable_weak_dependency(); public: - ::PROTOBUF_NAMESPACE_ID::int32 weak_dependency(int index) const; - void set_weak_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); - void add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 weak_dependency(int index) const; + void set_weak_dependency(int index, arc_i32 value); + void add_weak_dependency(arc_i32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& weak_dependency() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* mutable_weak_dependency(); // optional string name = 1; @@ -777,7 +783,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -795,7 +801,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_package(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_package(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_package(); + PROTOBUF_NODISCARD TProtoStringType* release_package(); void set_allocated_package(TProtoStringType* package); private: const TProtoStringType& _internal_package() const; @@ -813,7 +819,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_syntax(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_syntax(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_syntax(); + PROTOBUF_NODISCARD TProtoStringType* release_syntax(); void set_allocated_syntax(TProtoStringType* syntax); private: const TProtoStringType& _internal_syntax() const; @@ -828,7 +834,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::FileOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::FileOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::FileOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::FileOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::FileOptions* options); private: @@ -846,7 +852,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : 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_NODISCARD ::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: @@ -871,8 +877,8 @@ class PROTOBUF_EXPORT FileDescriptorProto final : ::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::RepeatedField< arc_i32 > public_dependency_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 > weak_dependency_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr package_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr syntax_; @@ -944,7 +950,12 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : } inline void Swap(DescriptorProto_ExtensionRange* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -958,11 +969,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : // implements Message ---------------------------------------------- - inline DescriptorProto_ExtensionRange* New() const final { - return new DescriptorProto_ExtensionRange(); - } - - DescriptorProto_ExtensionRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + DescriptorProto_ExtensionRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<DescriptorProto_ExtensionRange>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -977,8 +984,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -986,6 +993,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(DescriptorProto_ExtensionRange* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.DescriptorProto.ExtensionRange"; @@ -1019,7 +1028,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options); private: @@ -1036,11 +1045,11 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : bool _internal_has_start() const; public: void clear_start(); - ::PROTOBUF_NAMESPACE_ID::int32 start() const; - void set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 start() const; + void set_start(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const; - void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_start() const; + void _internal_set_start(arc_i32 value); public: // optional int32 end = 2; @@ -1049,11 +1058,11 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : bool _internal_has_end() const; public: void clear_end(); - ::PROTOBUF_NAMESPACE_ID::int32 end() const; - void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 end() const; + void set_end(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; - void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_end() const; + void _internal_set_end(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ExtensionRange) @@ -1066,8 +1075,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options_; - ::PROTOBUF_NAMESPACE_ID::int32 start_; - ::PROTOBUF_NAMESPACE_ID::int32 end_; + arc_i32 start_; + arc_i32 end_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -1134,7 +1143,12 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : } inline void Swap(DescriptorProto_ReservedRange* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1148,11 +1162,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : // implements Message ---------------------------------------------- - inline DescriptorProto_ReservedRange* New() const final { - return new DescriptorProto_ReservedRange(); - } - - DescriptorProto_ReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + DescriptorProto_ReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<DescriptorProto_ReservedRange>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1167,8 +1177,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1176,6 +1186,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(DescriptorProto_ReservedRange* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.DescriptorProto.ReservedRange"; @@ -1207,11 +1219,11 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : bool _internal_has_start() const; public: void clear_start(); - ::PROTOBUF_NAMESPACE_ID::int32 start() const; - void set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 start() const; + void set_start(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const; - void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_start() const; + void _internal_set_start(arc_i32 value); public: // optional int32 end = 2; @@ -1220,11 +1232,11 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : bool _internal_has_end() const; public: void clear_end(); - ::PROTOBUF_NAMESPACE_ID::int32 end() const; - void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 end() const; + void set_end(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; - void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_end() const; + void _internal_set_end(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ReservedRange) @@ -1236,8 +1248,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::int32 start_; - ::PROTOBUF_NAMESPACE_ID::int32 end_; + arc_i32 start_; + arc_i32 end_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -1304,7 +1316,12 @@ class PROTOBUF_EXPORT DescriptorProto final : } inline void Swap(DescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1318,11 +1335,7 @@ class PROTOBUF_EXPORT DescriptorProto final : // implements Message ---------------------------------------------- - inline DescriptorProto* New() const final { - return new DescriptorProto(); - } - - DescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + DescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<DescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1337,8 +1350,8 @@ class PROTOBUF_EXPORT DescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1346,6 +1359,8 @@ class PROTOBUF_EXPORT DescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(DescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.DescriptorProto"; @@ -1542,7 +1557,7 @@ class PROTOBUF_EXPORT DescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -1557,7 +1572,7 @@ class PROTOBUF_EXPORT DescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::MessageOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::MessageOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::MessageOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::MessageOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::MessageOptions* options); private: @@ -1653,7 +1668,12 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : } inline void Swap(ExtensionRangeOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1667,11 +1687,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : // implements Message ---------------------------------------------- - inline ExtensionRangeOptions* New() const final { - return new ExtensionRangeOptions(); - } - - ExtensionRangeOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + ExtensionRangeOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ExtensionRangeOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1686,8 +1702,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1695,6 +1711,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ExtensionRangeOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.ExtensionRangeOptions"; @@ -1826,7 +1844,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -2004,7 +2022,12 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : } inline void Swap(FieldDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -2018,11 +2041,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : // implements Message ---------------------------------------------- - inline FieldDescriptorProto* New() const final { - return new FieldDescriptorProto(); - } - - FieldDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FieldDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FieldDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -2037,8 +2056,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -2046,6 +2065,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FieldDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FieldDescriptorProto"; @@ -2184,7 +2205,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -2202,7 +2223,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_extendee(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_extendee(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_extendee(); + PROTOBUF_NODISCARD TProtoStringType* release_extendee(); void set_allocated_extendee(TProtoStringType* extendee); private: const TProtoStringType& _internal_extendee() const; @@ -2220,7 +2241,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_type_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_type_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_type_name(); + PROTOBUF_NODISCARD TProtoStringType* release_type_name(); void set_allocated_type_name(TProtoStringType* type_name); private: const TProtoStringType& _internal_type_name() const; @@ -2238,7 +2259,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_default_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_default_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_default_value(); + PROTOBUF_NODISCARD TProtoStringType* release_default_value(); void set_allocated_default_value(TProtoStringType* default_value); private: const TProtoStringType& _internal_default_value() const; @@ -2256,7 +2277,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_json_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_json_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_json_name(); + PROTOBUF_NODISCARD TProtoStringType* release_json_name(); void set_allocated_json_name(TProtoStringType* json_name); private: const TProtoStringType& _internal_json_name() const; @@ -2271,7 +2292,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::FieldOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::FieldOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::FieldOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::FieldOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::FieldOptions* options); private: @@ -2288,11 +2309,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_number() const; public: void clear_number(); - ::PROTOBUF_NAMESPACE_ID::int32 number() const; - void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 number() const; + void set_number(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; - void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_number() const; + void _internal_set_number(arc_i32 value); public: // optional int32 oneof_index = 9; @@ -2301,11 +2322,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_oneof_index() const; public: void clear_oneof_index(); - ::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const; - void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 oneof_index() const; + void set_oneof_index(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const; - void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_oneof_index() const; + void _internal_set_oneof_index(arc_i32 value); public: // optional bool proto3_optional = 17; @@ -2362,8 +2383,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr default_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr json_name_; ::PROTOBUF_NAMESPACE_ID::FieldOptions* options_; - ::PROTOBUF_NAMESPACE_ID::int32 number_; - ::PROTOBUF_NAMESPACE_ID::int32 oneof_index_; + arc_i32 number_; + arc_i32 oneof_index_; bool proto3_optional_; int label_; int type_; @@ -2433,7 +2454,12 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : } inline void Swap(OneofDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -2447,11 +2473,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : // implements Message ---------------------------------------------- - inline OneofDescriptorProto* New() const final { - return new OneofDescriptorProto(); - } - - OneofDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + OneofDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<OneofDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -2466,8 +2488,8 @@ class PROTOBUF_EXPORT OneofDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -2475,6 +2497,8 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(OneofDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.OneofDescriptorProto"; @@ -2510,7 +2534,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -2525,7 +2549,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::OneofOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::OneofOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::OneofOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::OneofOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::OneofOptions* options); private: @@ -2613,7 +2637,12 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : } inline void Swap(EnumDescriptorProto_EnumReservedRange* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -2627,11 +2656,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : // implements Message ---------------------------------------------- - inline EnumDescriptorProto_EnumReservedRange* New() const final { - return new EnumDescriptorProto_EnumReservedRange(); - } - - EnumDescriptorProto_EnumReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + EnumDescriptorProto_EnumReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<EnumDescriptorProto_EnumReservedRange>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -2646,8 +2671,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -2655,6 +2680,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(EnumDescriptorProto_EnumReservedRange* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.EnumDescriptorProto.EnumReservedRange"; @@ -2686,11 +2713,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : bool _internal_has_start() const; public: void clear_start(); - ::PROTOBUF_NAMESPACE_ID::int32 start() const; - void set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 start() const; + void set_start(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const; - void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_start() const; + void _internal_set_start(arc_i32 value); public: // optional int32 end = 2; @@ -2699,11 +2726,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : bool _internal_has_end() const; public: void clear_end(); - ::PROTOBUF_NAMESPACE_ID::int32 end() const; - void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 end() const; + void set_end(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; - void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_end() const; + void _internal_set_end(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto.EnumReservedRange) @@ -2715,8 +2742,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::int32 start_; - ::PROTOBUF_NAMESPACE_ID::int32 end_; + arc_i32 start_; + arc_i32 end_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -2783,7 +2810,12 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : } inline void Swap(EnumDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -2797,11 +2829,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : // implements Message ---------------------------------------------- - inline EnumDescriptorProto* New() const final { - return new EnumDescriptorProto(); - } - - EnumDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + EnumDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<EnumDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -2816,8 +2844,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -2825,6 +2853,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(EnumDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.EnumDescriptorProto"; @@ -2925,7 +2955,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -2940,7 +2970,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::EnumOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::EnumOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::EnumOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::EnumOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumOptions* options); private: @@ -3031,7 +3061,12 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : } inline void Swap(EnumValueDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -3045,11 +3080,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : // implements Message ---------------------------------------------- - inline EnumValueDescriptorProto* New() const final { - return new EnumValueDescriptorProto(); - } - - EnumValueDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + EnumValueDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<EnumValueDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -3064,8 +3095,8 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -3073,6 +3104,8 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(EnumValueDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.EnumValueDescriptorProto"; @@ -3109,7 +3142,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -3124,7 +3157,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options); private: @@ -3141,11 +3174,11 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : bool _internal_has_number() const; public: void clear_number(); - ::PROTOBUF_NAMESPACE_ID::int32 number() const; - void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 number() const; + void set_number(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; - void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_number() const; + void _internal_set_number(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueDescriptorProto) @@ -3159,7 +3192,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options_; - ::PROTOBUF_NAMESPACE_ID::int32 number_; + arc_i32 number_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -3226,7 +3259,12 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : } inline void Swap(ServiceDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -3240,11 +3278,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : // implements Message ---------------------------------------------- - inline ServiceDescriptorProto* New() const final { - return new ServiceDescriptorProto(); - } - - ServiceDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + ServiceDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ServiceDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -3259,8 +3293,8 @@ class PROTOBUF_EXPORT ServiceDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -3268,6 +3302,8 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ServiceDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.ServiceDescriptorProto"; @@ -3322,7 +3358,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -3337,7 +3373,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::ServiceOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::ServiceOptions* options); private: @@ -3426,7 +3462,12 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : } inline void Swap(MethodDescriptorProto* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -3440,11 +3481,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : // implements Message ---------------------------------------------- - inline MethodDescriptorProto* New() const final { - return new MethodDescriptorProto(); - } - - MethodDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + MethodDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<MethodDescriptorProto>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -3459,8 +3496,8 @@ class PROTOBUF_EXPORT MethodDescriptorProto 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -3468,6 +3505,8 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(MethodDescriptorProto* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.MethodDescriptorProto"; @@ -3507,7 +3546,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -3525,7 +3564,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_input_type(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_input_type(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_input_type(); + PROTOBUF_NODISCARD TProtoStringType* release_input_type(); void set_allocated_input_type(TProtoStringType* input_type); private: const TProtoStringType& _internal_input_type() const; @@ -3543,7 +3582,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_output_type(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_output_type(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_output_type(); + PROTOBUF_NODISCARD TProtoStringType* release_output_type(); void set_allocated_output_type(TProtoStringType* output_type); private: const TProtoStringType& _internal_output_type() const; @@ -3558,7 +3597,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public: void clear_options(); const ::PROTOBUF_NAMESPACE_ID::MethodOptions& options() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::MethodOptions* release_options(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::MethodOptions* release_options(); ::PROTOBUF_NAMESPACE_ID::MethodOptions* mutable_options(); void set_allocated_options(::PROTOBUF_NAMESPACE_ID::MethodOptions* options); private: @@ -3676,7 +3715,12 @@ class PROTOBUF_EXPORT FileOptions final : } inline void Swap(FileOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -3690,11 +3734,7 @@ class PROTOBUF_EXPORT FileOptions final : // implements Message ---------------------------------------------- - inline FileOptions* New() const final { - return new FileOptions(); - } - - FileOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FileOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FileOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -3709,8 +3749,8 @@ class PROTOBUF_EXPORT FileOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -3718,6 +3758,8 @@ class PROTOBUF_EXPORT FileOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FileOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FileOptions"; @@ -3822,7 +3864,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_java_package(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_java_package(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_java_package(); + PROTOBUF_NODISCARD TProtoStringType* release_java_package(); void set_allocated_java_package(TProtoStringType* java_package); private: const TProtoStringType& _internal_java_package() const; @@ -3840,7 +3882,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_java_outer_classname(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_java_outer_classname(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_java_outer_classname(); + PROTOBUF_NODISCARD TProtoStringType* release_java_outer_classname(); void set_allocated_java_outer_classname(TProtoStringType* java_outer_classname); private: const TProtoStringType& _internal_java_outer_classname() const; @@ -3858,7 +3900,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_go_package(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_go_package(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_go_package(); + PROTOBUF_NODISCARD TProtoStringType* release_go_package(); void set_allocated_go_package(TProtoStringType* go_package); private: const TProtoStringType& _internal_go_package() const; @@ -3876,7 +3918,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_objc_class_prefix(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_objc_class_prefix(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_objc_class_prefix(); + PROTOBUF_NODISCARD TProtoStringType* release_objc_class_prefix(); void set_allocated_objc_class_prefix(TProtoStringType* objc_class_prefix); private: const TProtoStringType& _internal_objc_class_prefix() const; @@ -3894,7 +3936,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_csharp_namespace(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_csharp_namespace(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_csharp_namespace(); + PROTOBUF_NODISCARD TProtoStringType* release_csharp_namespace(); void set_allocated_csharp_namespace(TProtoStringType* csharp_namespace); private: const TProtoStringType& _internal_csharp_namespace() const; @@ -3912,7 +3954,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_swift_prefix(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_swift_prefix(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_swift_prefix(); + PROTOBUF_NODISCARD TProtoStringType* release_swift_prefix(); void set_allocated_swift_prefix(TProtoStringType* swift_prefix); private: const TProtoStringType& _internal_swift_prefix() const; @@ -3930,7 +3972,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_php_class_prefix(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_php_class_prefix(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_php_class_prefix(); + PROTOBUF_NODISCARD TProtoStringType* release_php_class_prefix(); void set_allocated_php_class_prefix(TProtoStringType* php_class_prefix); private: const TProtoStringType& _internal_php_class_prefix() const; @@ -3948,7 +3990,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_php_namespace(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_php_namespace(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_php_namespace(); + PROTOBUF_NODISCARD TProtoStringType* release_php_namespace(); void set_allocated_php_namespace(TProtoStringType* php_namespace); private: const TProtoStringType& _internal_php_namespace() const; @@ -3966,7 +4008,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_php_metadata_namespace(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_php_metadata_namespace(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_php_metadata_namespace(); + PROTOBUF_NODISCARD TProtoStringType* release_php_metadata_namespace(); void set_allocated_php_metadata_namespace(TProtoStringType* php_metadata_namespace); private: const TProtoStringType& _internal_php_metadata_namespace() const; @@ -3984,7 +4026,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_ruby_package(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_ruby_package(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_ruby_package(); + PROTOBUF_NODISCARD TProtoStringType* release_ruby_package(); void set_allocated_ruby_package(TProtoStringType* ruby_package); private: const TProtoStringType& _internal_ruby_package() const; @@ -4211,7 +4253,7 @@ class PROTOBUF_EXPORT FileOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -4410,7 +4452,12 @@ class PROTOBUF_EXPORT MessageOptions final : } inline void Swap(MessageOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -4424,11 +4471,7 @@ class PROTOBUF_EXPORT MessageOptions final : // implements Message ---------------------------------------------- - inline MessageOptions* New() const final { - return new MessageOptions(); - } - - MessageOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + MessageOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<MessageOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -4443,8 +4486,8 @@ class PROTOBUF_EXPORT MessageOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -4452,6 +4495,8 @@ class PROTOBUF_EXPORT MessageOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(MessageOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.MessageOptions"; @@ -4639,7 +4684,7 @@ class PROTOBUF_EXPORT MessageOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -4822,7 +4867,12 @@ class PROTOBUF_EXPORT FieldOptions final : } inline void Swap(FieldOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -4836,11 +4886,7 @@ class PROTOBUF_EXPORT FieldOptions final : // implements Message ---------------------------------------------- - inline FieldOptions* New() const final { - return new FieldOptions(); - } - - FieldOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FieldOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FieldOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -4855,8 +4901,8 @@ class PROTOBUF_EXPORT FieldOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -4864,6 +4910,8 @@ class PROTOBUF_EXPORT FieldOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FieldOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FieldOptions"; @@ -5143,7 +5191,7 @@ class PROTOBUF_EXPORT FieldOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -5328,7 +5376,12 @@ class PROTOBUF_EXPORT OneofOptions final : } inline void Swap(OneofOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -5342,11 +5395,7 @@ class PROTOBUF_EXPORT OneofOptions final : // implements Message ---------------------------------------------- - inline OneofOptions* New() const final { - return new OneofOptions(); - } - - OneofOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + OneofOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<OneofOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -5361,8 +5410,8 @@ class PROTOBUF_EXPORT OneofOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -5370,6 +5419,8 @@ class PROTOBUF_EXPORT OneofOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(OneofOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.OneofOptions"; @@ -5501,7 +5552,7 @@ class PROTOBUF_EXPORT OneofOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -5679,7 +5730,12 @@ class PROTOBUF_EXPORT EnumOptions final : } inline void Swap(EnumOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -5693,11 +5749,7 @@ class PROTOBUF_EXPORT EnumOptions final : // implements Message ---------------------------------------------- - inline EnumOptions* New() const final { - return new EnumOptions(); - } - - EnumOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + EnumOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<EnumOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -5712,8 +5764,8 @@ class PROTOBUF_EXPORT EnumOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -5721,6 +5773,8 @@ class PROTOBUF_EXPORT EnumOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(EnumOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.EnumOptions"; @@ -5880,7 +5934,7 @@ class PROTOBUF_EXPORT EnumOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -6061,7 +6115,12 @@ class PROTOBUF_EXPORT EnumValueOptions final : } inline void Swap(EnumValueOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -6075,11 +6134,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : // implements Message ---------------------------------------------- - inline EnumValueOptions* New() const final { - return new EnumValueOptions(); - } - - EnumValueOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + EnumValueOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<EnumValueOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -6094,8 +6149,8 @@ class PROTOBUF_EXPORT EnumValueOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -6103,6 +6158,8 @@ class PROTOBUF_EXPORT EnumValueOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(EnumValueOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.EnumValueOptions"; @@ -6248,7 +6305,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -6428,7 +6485,12 @@ class PROTOBUF_EXPORT ServiceOptions final : } inline void Swap(ServiceOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -6442,11 +6504,7 @@ class PROTOBUF_EXPORT ServiceOptions final : // implements Message ---------------------------------------------- - inline ServiceOptions* New() const final { - return new ServiceOptions(); - } - - ServiceOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + ServiceOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ServiceOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -6461,8 +6519,8 @@ class PROTOBUF_EXPORT ServiceOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -6470,6 +6528,8 @@ class PROTOBUF_EXPORT ServiceOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ServiceOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.ServiceOptions"; @@ -6615,7 +6675,7 @@ class PROTOBUF_EXPORT ServiceOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -6795,7 +6855,12 @@ class PROTOBUF_EXPORT MethodOptions final : } inline void Swap(MethodOptions* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -6809,11 +6874,7 @@ class PROTOBUF_EXPORT MethodOptions final : // implements Message ---------------------------------------------- - inline MethodOptions* New() const final { - return new MethodOptions(); - } - - MethodOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + MethodOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<MethodOptions>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -6828,8 +6889,8 @@ class PROTOBUF_EXPORT MethodOptions 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -6837,6 +6898,8 @@ class PROTOBUF_EXPORT MethodOptions final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(MethodOptions* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.MethodOptions"; @@ -7028,7 +7091,7 @@ class PROTOBUF_EXPORT MethodOptions final : template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> - inline PROTOBUF_MUST_USE_RESULT + PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -7209,7 +7272,12 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : } inline void Swap(UninterpretedOption_NamePart* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -7223,11 +7291,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : // implements Message ---------------------------------------------- - inline UninterpretedOption_NamePart* New() const final { - return new UninterpretedOption_NamePart(); - } - - UninterpretedOption_NamePart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + UninterpretedOption_NamePart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<UninterpretedOption_NamePart>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -7242,8 +7306,8 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -7251,6 +7315,8 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(UninterpretedOption_NamePart* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.UninterpretedOption.NamePart"; @@ -7286,7 +7352,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name_part(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name_part(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name_part(); + PROTOBUF_NODISCARD TProtoStringType* release_name_part(); void set_allocated_name_part(TProtoStringType* name_part); private: const TProtoStringType& _internal_name_part() const; @@ -7387,7 +7453,12 @@ class PROTOBUF_EXPORT UninterpretedOption final : } inline void Swap(UninterpretedOption* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -7401,11 +7472,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : // implements Message ---------------------------------------------- - inline UninterpretedOption* New() const final { - return new UninterpretedOption(); - } - - UninterpretedOption* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + UninterpretedOption* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<UninterpretedOption>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -7420,8 +7487,8 @@ class PROTOBUF_EXPORT UninterpretedOption 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -7429,6 +7496,8 @@ class PROTOBUF_EXPORT UninterpretedOption final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(UninterpretedOption* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.UninterpretedOption"; @@ -7489,7 +7558,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_identifier_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_identifier_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_identifier_value(); + PROTOBUF_NODISCARD TProtoStringType* release_identifier_value(); void set_allocated_identifier_value(TProtoStringType* identifier_value); private: const TProtoStringType& _internal_identifier_value() const; @@ -7507,7 +7576,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_string_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_string_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_string_value(); + PROTOBUF_NODISCARD TProtoStringType* release_string_value(); void set_allocated_string_value(TProtoStringType* string_value); private: const TProtoStringType& _internal_string_value() const; @@ -7525,7 +7594,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_aggregate_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_aggregate_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_aggregate_value(); + PROTOBUF_NODISCARD TProtoStringType* release_aggregate_value(); void set_allocated_aggregate_value(TProtoStringType* aggregate_value); private: const TProtoStringType& _internal_aggregate_value() const; @@ -7539,11 +7608,11 @@ class PROTOBUF_EXPORT UninterpretedOption final : bool _internal_has_positive_int_value() const; public: void clear_positive_int_value(); - ::PROTOBUF_NAMESPACE_ID::uint64 positive_int_value() const; - void set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + arc_ui64 positive_int_value() const; + void set_positive_int_value(arc_ui64 value); private: - ::PROTOBUF_NAMESPACE_ID::uint64 _internal_positive_int_value() const; - void _internal_set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + arc_ui64 _internal_positive_int_value() const; + void _internal_set_positive_int_value(arc_ui64 value); public: // optional int64 negative_int_value = 5; @@ -7552,11 +7621,11 @@ class PROTOBUF_EXPORT UninterpretedOption final : bool _internal_has_negative_int_value() const; public: void clear_negative_int_value(); - ::PROTOBUF_NAMESPACE_ID::int64 negative_int_value() const; - void set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 negative_int_value() const; + void set_negative_int_value(arc_i64 value); private: - ::PROTOBUF_NAMESPACE_ID::int64 _internal_negative_int_value() const; - void _internal_set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 _internal_negative_int_value() const; + void _internal_set_negative_int_value(arc_i64 value); public: // optional double double_value = 6; @@ -7585,8 +7654,8 @@ class PROTOBUF_EXPORT UninterpretedOption final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr identifier_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_value_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr aggregate_value_; - ::PROTOBUF_NAMESPACE_ID::uint64 positive_int_value_; - ::PROTOBUF_NAMESPACE_ID::int64 negative_int_value_; + arc_ui64 positive_int_value_; + arc_i64 negative_int_value_; double double_value_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; @@ -7654,7 +7723,12 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : } inline void Swap(SourceCodeInfo_Location* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -7668,11 +7742,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : // implements Message ---------------------------------------------- - inline SourceCodeInfo_Location* New() const final { - return new SourceCodeInfo_Location(); - } - - SourceCodeInfo_Location* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + SourceCodeInfo_Location* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<SourceCodeInfo_Location>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -7687,8 +7757,8 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -7696,6 +7766,8 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(SourceCodeInfo_Location* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.SourceCodeInfo.Location"; @@ -7731,19 +7803,19 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public: void clear_path(); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_path(int index) const; - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 _internal_path(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& _internal_path() const; - void _internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + void _internal_add_path(arc_i32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* _internal_mutable_path(); public: - ::PROTOBUF_NAMESPACE_ID::int32 path(int index) const; - void set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); - void add_path(::PROTOBUF_NAMESPACE_ID::int32 value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 path(int index) const; + void set_path(int index, arc_i32 value); + void add_path(arc_i32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& path() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* mutable_path(); // repeated int32 span = 2 [packed = true]; @@ -7753,19 +7825,19 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public: void clear_span(); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_span(int index) const; - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 _internal_span(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& _internal_span() const; - void _internal_add_span(::PROTOBUF_NAMESPACE_ID::int32 value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + void _internal_add_span(arc_i32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* _internal_mutable_span(); public: - ::PROTOBUF_NAMESPACE_ID::int32 span(int index) const; - void set_span(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); - void add_span(::PROTOBUF_NAMESPACE_ID::int32 value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 span(int index) const; + void set_span(int index, arc_i32 value); + void add_span(arc_i32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& span() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* mutable_span(); // repeated string leading_detached_comments = 6; @@ -7802,7 +7874,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_leading_comments(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_leading_comments(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_leading_comments(); + PROTOBUF_NODISCARD TProtoStringType* release_leading_comments(); void set_allocated_leading_comments(TProtoStringType* leading_comments); private: const TProtoStringType& _internal_leading_comments() const; @@ -7820,7 +7892,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_trailing_comments(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_trailing_comments(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_trailing_comments(); + PROTOBUF_NODISCARD TProtoStringType* release_trailing_comments(); void set_allocated_trailing_comments(TProtoStringType* trailing_comments); private: const TProtoStringType& _internal_trailing_comments() const; @@ -7837,9 +7909,9 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > path_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 > path_; mutable std::atomic<int> _path_cached_byte_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > span_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 > span_; mutable std::atomic<int> _span_cached_byte_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<TProtoStringType> leading_detached_comments_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr leading_comments_; @@ -7910,7 +7982,12 @@ class PROTOBUF_EXPORT SourceCodeInfo final : } inline void Swap(SourceCodeInfo* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -7924,11 +8001,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : // implements Message ---------------------------------------------- - inline SourceCodeInfo* New() const final { - return new SourceCodeInfo(); - } - - SourceCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + SourceCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<SourceCodeInfo>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -7943,8 +8016,8 @@ class PROTOBUF_EXPORT SourceCodeInfo 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -7952,6 +8025,8 @@ class PROTOBUF_EXPORT SourceCodeInfo final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(SourceCodeInfo* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.SourceCodeInfo"; @@ -8071,7 +8146,12 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : } inline void Swap(GeneratedCodeInfo_Annotation* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -8085,11 +8165,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : // implements Message ---------------------------------------------- - inline GeneratedCodeInfo_Annotation* New() const final { - return new GeneratedCodeInfo_Annotation(); - } - - GeneratedCodeInfo_Annotation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + GeneratedCodeInfo_Annotation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<GeneratedCodeInfo_Annotation>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -8104,8 +8180,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -8113,6 +8189,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(GeneratedCodeInfo_Annotation* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.GeneratedCodeInfo.Annotation"; @@ -8147,19 +8225,19 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public: void clear_path(); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_path(int index) const; - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 _internal_path(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& _internal_path() const; - void _internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + void _internal_add_path(arc_i32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* _internal_mutable_path(); public: - ::PROTOBUF_NAMESPACE_ID::int32 path(int index) const; - void set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); - void add_path(::PROTOBUF_NAMESPACE_ID::int32 value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + arc_i32 path(int index) const; + void set_path(int index, arc_i32 value); + void add_path(arc_i32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& path() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* mutable_path(); // optional string source_file = 2; @@ -8172,7 +8250,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_source_file(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_source_file(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_source_file(); + PROTOBUF_NODISCARD TProtoStringType* release_source_file(); void set_allocated_source_file(TProtoStringType* source_file); private: const TProtoStringType& _internal_source_file() const; @@ -8186,11 +8264,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : bool _internal_has_begin() const; public: void clear_begin(); - ::PROTOBUF_NAMESPACE_ID::int32 begin() const; - void set_begin(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 begin() const; + void set_begin(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_begin() const; - void _internal_set_begin(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_begin() const; + void _internal_set_begin(arc_i32 value); public: // optional int32 end = 4; @@ -8199,11 +8277,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : bool _internal_has_end() const; public: void clear_end(); - ::PROTOBUF_NAMESPACE_ID::int32 end() const; - void set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 end() const; + void set_end(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const; - void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_end() const; + void _internal_set_end(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo.Annotation) @@ -8215,11 +8293,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > path_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 > path_; mutable std::atomic<int> _path_cached_byte_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_file_; - ::PROTOBUF_NAMESPACE_ID::int32 begin_; - ::PROTOBUF_NAMESPACE_ID::int32 end_; + arc_i32 begin_; + arc_i32 end_; friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto; }; // ------------------------------------------------------------------- @@ -8286,7 +8364,12 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : } inline void Swap(GeneratedCodeInfo* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -8300,11 +8383,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : // implements Message ---------------------------------------------- - inline GeneratedCodeInfo* New() const final { - return new GeneratedCodeInfo(); - } - - GeneratedCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + GeneratedCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<GeneratedCodeInfo>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -8319,8 +8398,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -8328,6 +8407,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(GeneratedCodeInfo* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.GeneratedCodeInfo"; @@ -8483,7 +8564,13 @@ inline TProtoStringType* FileDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -8493,6 +8580,11 @@ inline void FileDescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name) } @@ -8541,7 +8633,13 @@ inline TProtoStringType* FileDescriptorProto::release_package() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileDescriptorProto::set_allocated_package(TProtoStringType* package) { if (package != nullptr) { @@ -8551,6 +8649,11 @@ inline void FileDescriptorProto::set_allocated_package(TProtoStringType* package } package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), package, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package) } @@ -8639,38 +8742,38 @@ inline int FileDescriptorProto::public_dependency_size() const { inline void FileDescriptorProto::clear_public_dependency() { public_dependency_.Clear(); } -inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::_internal_public_dependency(int index) const { +inline arc_i32 FileDescriptorProto::_internal_public_dependency(int index) const { return public_dependency_.Get(index); } -inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::public_dependency(int index) const { +inline arc_i32 FileDescriptorProto::public_dependency(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency) return _internal_public_dependency(index); } -inline void FileDescriptorProto::set_public_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::set_public_dependency(int index, arc_i32 value) { public_dependency_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency) } -inline void FileDescriptorProto::_internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::_internal_add_public_dependency(arc_i32 value) { public_dependency_.Add(value); } -inline void FileDescriptorProto::add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::add_public_dependency(arc_i32 value) { _internal_add_public_dependency(value); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency) } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& FileDescriptorProto::_internal_public_dependency() const { return public_dependency_; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& FileDescriptorProto::public_dependency() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency) return _internal_public_dependency(); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* FileDescriptorProto::_internal_mutable_public_dependency() { return &public_dependency_; } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* FileDescriptorProto::mutable_public_dependency() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency) return _internal_mutable_public_dependency(); @@ -8686,38 +8789,38 @@ inline int FileDescriptorProto::weak_dependency_size() const { inline void FileDescriptorProto::clear_weak_dependency() { weak_dependency_.Clear(); } -inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::_internal_weak_dependency(int index) const { +inline arc_i32 FileDescriptorProto::_internal_weak_dependency(int index) const { return weak_dependency_.Get(index); } -inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::weak_dependency(int index) const { +inline arc_i32 FileDescriptorProto::weak_dependency(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency) return _internal_weak_dependency(index); } -inline void FileDescriptorProto::set_weak_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::set_weak_dependency(int index, arc_i32 value) { weak_dependency_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency) } -inline void FileDescriptorProto::_internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::_internal_add_weak_dependency(arc_i32 value) { weak_dependency_.Add(value); } -inline void FileDescriptorProto::add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FileDescriptorProto::add_weak_dependency(arc_i32 value) { _internal_add_weak_dependency(value); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency) } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& FileDescriptorProto::_internal_weak_dependency() const { return weak_dependency_; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& FileDescriptorProto::weak_dependency() const { // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency) return _internal_weak_dependency(); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* FileDescriptorProto::_internal_mutable_weak_dependency() { return &weak_dependency_; } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* FileDescriptorProto::mutable_weak_dependency() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency) return _internal_mutable_weak_dependency(); @@ -9108,7 +9211,13 @@ inline TProtoStringType* FileDescriptorProto::release_syntax() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (syntax_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileDescriptorProto::set_allocated_syntax(TProtoStringType* syntax) { if (syntax != nullptr) { @@ -9118,6 +9227,11 @@ inline void FileDescriptorProto::set_allocated_syntax(TProtoStringType* syntax) } syntax_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), syntax, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (syntax_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax) } @@ -9137,18 +9251,18 @@ inline void DescriptorProto_ExtensionRange::clear_start() { start_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::_internal_start() const { +inline arc_i32 DescriptorProto_ExtensionRange::_internal_start() const { return start_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::start() const { +inline arc_i32 DescriptorProto_ExtensionRange::start() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start) return _internal_start(); } -inline void DescriptorProto_ExtensionRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ExtensionRange::_internal_set_start(arc_i32 value) { _has_bits_[0] |= 0x00000002u; start_ = value; } -inline void DescriptorProto_ExtensionRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ExtensionRange::set_start(arc_i32 value) { _internal_set_start(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start) } @@ -9165,18 +9279,18 @@ inline void DescriptorProto_ExtensionRange::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000004u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::_internal_end() const { +inline arc_i32 DescriptorProto_ExtensionRange::_internal_end() const { return end_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::end() const { +inline arc_i32 DescriptorProto_ExtensionRange::end() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end) return _internal_end(); } -inline void DescriptorProto_ExtensionRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ExtensionRange::_internal_set_end(arc_i32 value) { _has_bits_[0] |= 0x00000004u; end_ = value; } -inline void DescriptorProto_ExtensionRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ExtensionRange::set_end(arc_i32 value) { _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end) } @@ -9287,18 +9401,18 @@ inline void DescriptorProto_ReservedRange::clear_start() { start_ = 0; _has_bits_[0] &= ~0x00000001u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::_internal_start() const { +inline arc_i32 DescriptorProto_ReservedRange::_internal_start() const { return start_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::start() const { +inline arc_i32 DescriptorProto_ReservedRange::start() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.start) return _internal_start(); } -inline void DescriptorProto_ReservedRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ReservedRange::_internal_set_start(arc_i32 value) { _has_bits_[0] |= 0x00000001u; start_ = value; } -inline void DescriptorProto_ReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ReservedRange::set_start(arc_i32 value) { _internal_set_start(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.start) } @@ -9315,18 +9429,18 @@ inline void DescriptorProto_ReservedRange::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::_internal_end() const { +inline arc_i32 DescriptorProto_ReservedRange::_internal_end() const { return end_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::end() const { +inline arc_i32 DescriptorProto_ReservedRange::end() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.end) return _internal_end(); } -inline void DescriptorProto_ReservedRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ReservedRange::_internal_set_end(arc_i32 value) { _has_bits_[0] |= 0x00000002u; end_ = value; } -inline void DescriptorProto_ReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void DescriptorProto_ReservedRange::set_end(arc_i32 value) { _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.end) } @@ -9380,7 +9494,13 @@ inline TProtoStringType* DescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void DescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -9390,6 +9510,11 @@ inline void DescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name) } @@ -9931,7 +10056,13 @@ inline TProtoStringType* FieldDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FieldDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -9941,6 +10072,11 @@ inline void FieldDescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name) } @@ -9956,18 +10092,18 @@ inline void FieldDescriptorProto::clear_number() { number_ = 0; _has_bits_[0] &= ~0x00000040u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::_internal_number() const { +inline arc_i32 FieldDescriptorProto::_internal_number() const { return number_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::number() const { +inline arc_i32 FieldDescriptorProto::number() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number) return _internal_number(); } -inline void FieldDescriptorProto::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FieldDescriptorProto::_internal_set_number(arc_i32 value) { _has_bits_[0] |= 0x00000040u; number_ = value; } -inline void FieldDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FieldDescriptorProto::set_number(arc_i32 value) { _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number) } @@ -10075,7 +10211,13 @@ inline TProtoStringType* FieldDescriptorProto::release_type_name() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (type_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FieldDescriptorProto::set_allocated_type_name(TProtoStringType* type_name) { if (type_name != nullptr) { @@ -10085,6 +10227,11 @@ inline void FieldDescriptorProto::set_allocated_type_name(TProtoStringType* type } type_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (type_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name) } @@ -10133,7 +10280,13 @@ inline TProtoStringType* FieldDescriptorProto::release_extendee() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (extendee_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FieldDescriptorProto::set_allocated_extendee(TProtoStringType* extendee) { if (extendee != nullptr) { @@ -10143,6 +10296,11 @@ inline void FieldDescriptorProto::set_allocated_extendee(TProtoStringType* exten } extendee_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), extendee, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (extendee_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee) } @@ -10191,7 +10349,13 @@ inline TProtoStringType* FieldDescriptorProto::release_default_value() { return nullptr; } _has_bits_[0] &= ~0x00000008u; - return default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FieldDescriptorProto::set_allocated_default_value(TProtoStringType* default_value) { if (default_value != nullptr) { @@ -10201,6 +10365,11 @@ inline void FieldDescriptorProto::set_allocated_default_value(TProtoStringType* } default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value) } @@ -10216,18 +10385,18 @@ inline void FieldDescriptorProto::clear_oneof_index() { oneof_index_ = 0; _has_bits_[0] &= ~0x00000080u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::_internal_oneof_index() const { +inline arc_i32 FieldDescriptorProto::_internal_oneof_index() const { return oneof_index_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::oneof_index() const { +inline arc_i32 FieldDescriptorProto::oneof_index() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index) return _internal_oneof_index(); } -inline void FieldDescriptorProto::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FieldDescriptorProto::_internal_set_oneof_index(arc_i32 value) { _has_bits_[0] |= 0x00000080u; oneof_index_ = value; } -inline void FieldDescriptorProto::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void FieldDescriptorProto::set_oneof_index(arc_i32 value) { _internal_set_oneof_index(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index) } @@ -10277,7 +10446,13 @@ inline TProtoStringType* FieldDescriptorProto::release_json_name() { return nullptr; } _has_bits_[0] &= ~0x00000010u; - return json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FieldDescriptorProto::set_allocated_json_name(TProtoStringType* json_name) { if (json_name != nullptr) { @@ -10287,6 +10462,11 @@ inline void FieldDescriptorProto::set_allocated_json_name(TProtoStringType* json } json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name) } @@ -10457,7 +10637,13 @@ inline TProtoStringType* OneofDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void OneofDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -10467,6 +10653,11 @@ inline void OneofDescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name) } @@ -10576,18 +10767,18 @@ inline void EnumDescriptorProto_EnumReservedRange::clear_start() { start_ = 0; _has_bits_[0] &= ~0x00000001u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::_internal_start() const { +inline arc_i32 EnumDescriptorProto_EnumReservedRange::_internal_start() const { return start_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::start() const { +inline arc_i32 EnumDescriptorProto_EnumReservedRange::start() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.start) return _internal_start(); } -inline void EnumDescriptorProto_EnumReservedRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumDescriptorProto_EnumReservedRange::_internal_set_start(arc_i32 value) { _has_bits_[0] |= 0x00000001u; start_ = value; } -inline void EnumDescriptorProto_EnumReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumDescriptorProto_EnumReservedRange::set_start(arc_i32 value) { _internal_set_start(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.start) } @@ -10604,18 +10795,18 @@ inline void EnumDescriptorProto_EnumReservedRange::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::_internal_end() const { +inline arc_i32 EnumDescriptorProto_EnumReservedRange::_internal_end() const { return end_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::end() const { +inline arc_i32 EnumDescriptorProto_EnumReservedRange::end() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.end) return _internal_end(); } -inline void EnumDescriptorProto_EnumReservedRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumDescriptorProto_EnumReservedRange::_internal_set_end(arc_i32 value) { _has_bits_[0] |= 0x00000002u; end_ = value; } -inline void EnumDescriptorProto_EnumReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumDescriptorProto_EnumReservedRange::set_end(arc_i32 value) { _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.end) } @@ -10669,7 +10860,13 @@ inline TProtoStringType* EnumDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void EnumDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -10679,6 +10876,11 @@ inline void EnumDescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name) } @@ -10976,7 +11178,13 @@ inline TProtoStringType* EnumValueDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void EnumValueDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -10986,6 +11194,11 @@ inline void EnumValueDescriptorProto::set_allocated_name(TProtoStringType* name) } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name) } @@ -11001,18 +11214,18 @@ inline void EnumValueDescriptorProto::clear_number() { number_ = 0; _has_bits_[0] &= ~0x00000004u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValueDescriptorProto::_internal_number() const { +inline arc_i32 EnumValueDescriptorProto::_internal_number() const { return number_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValueDescriptorProto::number() const { +inline arc_i32 EnumValueDescriptorProto::number() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number) return _internal_number(); } -inline void EnumValueDescriptorProto::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumValueDescriptorProto::_internal_set_number(arc_i32 value) { _has_bits_[0] |= 0x00000004u; number_ = value; } -inline void EnumValueDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumValueDescriptorProto::set_number(arc_i32 value) { _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number) } @@ -11156,7 +11369,13 @@ inline TProtoStringType* ServiceDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void ServiceDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -11166,6 +11385,11 @@ inline void ServiceDescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name) } @@ -11348,7 +11572,13 @@ inline TProtoStringType* MethodDescriptorProto::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void MethodDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -11358,6 +11588,11 @@ inline void MethodDescriptorProto::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name) } @@ -11406,7 +11641,13 @@ inline TProtoStringType* MethodDescriptorProto::release_input_type() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (input_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void MethodDescriptorProto::set_allocated_input_type(TProtoStringType* input_type) { if (input_type != nullptr) { @@ -11416,6 +11657,11 @@ inline void MethodDescriptorProto::set_allocated_input_type(TProtoStringType* in } input_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), input_type, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (input_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type) } @@ -11464,7 +11710,13 @@ inline TProtoStringType* MethodDescriptorProto::release_output_type() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (output_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void MethodDescriptorProto::set_allocated_output_type(TProtoStringType* output_type) { if (output_type != nullptr) { @@ -11474,6 +11726,11 @@ inline void MethodDescriptorProto::set_allocated_output_type(TProtoStringType* o } output_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), output_type, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (output_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type) } @@ -11672,7 +11929,13 @@ inline TProtoStringType* FileOptions::release_java_package() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (java_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_java_package(TProtoStringType* java_package) { if (java_package != nullptr) { @@ -11682,6 +11945,11 @@ inline void FileOptions::set_allocated_java_package(TProtoStringType* java_packa } java_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_package, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (java_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package) } @@ -11730,7 +11998,13 @@ inline TProtoStringType* FileOptions::release_java_outer_classname() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (java_outer_classname_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_java_outer_classname(TProtoStringType* java_outer_classname) { if (java_outer_classname != nullptr) { @@ -11740,6 +12014,11 @@ inline void FileOptions::set_allocated_java_outer_classname(TProtoStringType* ja } java_outer_classname_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_outer_classname, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (java_outer_classname_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname) } @@ -11901,7 +12180,13 @@ inline TProtoStringType* FileOptions::release_go_package() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (go_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_go_package(TProtoStringType* go_package) { if (go_package != nullptr) { @@ -11911,6 +12196,11 @@ inline void FileOptions::set_allocated_go_package(TProtoStringType* go_package) } go_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), go_package, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (go_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package) } @@ -12127,7 +12417,13 @@ inline TProtoStringType* FileOptions::release_objc_class_prefix() { return nullptr; } _has_bits_[0] &= ~0x00000008u; - return objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (objc_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_objc_class_prefix(TProtoStringType* objc_class_prefix) { if (objc_class_prefix != nullptr) { @@ -12137,6 +12433,11 @@ inline void FileOptions::set_allocated_objc_class_prefix(TProtoStringType* objc_ } objc_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), objc_class_prefix, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (objc_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) } @@ -12185,7 +12486,13 @@ inline TProtoStringType* FileOptions::release_csharp_namespace() { return nullptr; } _has_bits_[0] &= ~0x00000010u; - return csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (csharp_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_csharp_namespace(TProtoStringType* csharp_namespace) { if (csharp_namespace != nullptr) { @@ -12195,6 +12502,11 @@ inline void FileOptions::set_allocated_csharp_namespace(TProtoStringType* csharp } csharp_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), csharp_namespace, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (csharp_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) } @@ -12243,7 +12555,13 @@ inline TProtoStringType* FileOptions::release_swift_prefix() { return nullptr; } _has_bits_[0] &= ~0x00000020u; - return swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (swift_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_swift_prefix(TProtoStringType* swift_prefix) { if (swift_prefix != nullptr) { @@ -12253,6 +12571,11 @@ inline void FileOptions::set_allocated_swift_prefix(TProtoStringType* swift_pref } swift_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), swift_prefix, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (swift_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix) } @@ -12301,7 +12624,13 @@ inline TProtoStringType* FileOptions::release_php_class_prefix() { return nullptr; } _has_bits_[0] &= ~0x00000040u; - return php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (php_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_php_class_prefix(TProtoStringType* php_class_prefix) { if (php_class_prefix != nullptr) { @@ -12311,6 +12640,11 @@ inline void FileOptions::set_allocated_php_class_prefix(TProtoStringType* php_cl } php_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_class_prefix, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (php_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix) } @@ -12359,7 +12693,13 @@ inline TProtoStringType* FileOptions::release_php_namespace() { return nullptr; } _has_bits_[0] &= ~0x00000080u; - return php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (php_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_php_namespace(TProtoStringType* php_namespace) { if (php_namespace != nullptr) { @@ -12369,6 +12709,11 @@ inline void FileOptions::set_allocated_php_namespace(TProtoStringType* php_names } php_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_namespace, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (php_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace) } @@ -12417,7 +12762,13 @@ inline TProtoStringType* FileOptions::release_php_metadata_namespace() { return nullptr; } _has_bits_[0] &= ~0x00000100u; - return php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (php_metadata_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_php_metadata_namespace(TProtoStringType* php_metadata_namespace) { if (php_metadata_namespace != nullptr) { @@ -12427,6 +12778,11 @@ inline void FileOptions::set_allocated_php_metadata_namespace(TProtoStringType* } php_metadata_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_metadata_namespace, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (php_metadata_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_metadata_namespace) } @@ -12475,7 +12831,13 @@ inline TProtoStringType* FileOptions::release_ruby_package() { return nullptr; } _has_bits_[0] &= ~0x00000200u; - return ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (ruby_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void FileOptions::set_allocated_ruby_package(TProtoStringType* ruby_package) { if (ruby_package != nullptr) { @@ -12485,6 +12847,11 @@ inline void FileOptions::set_allocated_ruby_package(TProtoStringType* ruby_packa } ruby_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ruby_package, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (ruby_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.ruby_package) } @@ -13336,7 +13703,13 @@ inline TProtoStringType* UninterpretedOption_NamePart::release_name_part() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_part_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void UninterpretedOption_NamePart::set_allocated_name_part(TProtoStringType* name_part) { if (name_part != nullptr) { @@ -13346,6 +13719,11 @@ inline void UninterpretedOption_NamePart::set_allocated_name_part(TProtoStringTy } name_part_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name_part, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_part_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part) } @@ -13466,7 +13844,13 @@ inline TProtoStringType* UninterpretedOption::release_identifier_value() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (identifier_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void UninterpretedOption::set_allocated_identifier_value(TProtoStringType* identifier_value) { if (identifier_value != nullptr) { @@ -13476,6 +13860,11 @@ inline void UninterpretedOption::set_allocated_identifier_value(TProtoStringType } identifier_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), identifier_value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (identifier_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value) } @@ -13491,18 +13880,18 @@ inline void UninterpretedOption::clear_positive_int_value() { positive_int_value_ = arc_ui64{0u}; _has_bits_[0] &= ~0x00000008u; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::_internal_positive_int_value() const { +inline arc_ui64 UninterpretedOption::_internal_positive_int_value() const { return positive_int_value_; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::positive_int_value() const { +inline arc_ui64 UninterpretedOption::positive_int_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value) return _internal_positive_int_value(); } -inline void UninterpretedOption::_internal_set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void UninterpretedOption::_internal_set_positive_int_value(arc_ui64 value) { _has_bits_[0] |= 0x00000008u; positive_int_value_ = value; } -inline void UninterpretedOption::set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void UninterpretedOption::set_positive_int_value(arc_ui64 value) { _internal_set_positive_int_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value) } @@ -13519,18 +13908,18 @@ inline void UninterpretedOption::clear_negative_int_value() { negative_int_value_ = arc_i64{0}; _has_bits_[0] &= ~0x00000010u; } -inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::_internal_negative_int_value() const { +inline arc_i64 UninterpretedOption::_internal_negative_int_value() const { return negative_int_value_; } -inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::negative_int_value() const { +inline arc_i64 UninterpretedOption::negative_int_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value) return _internal_negative_int_value(); } -inline void UninterpretedOption::_internal_set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void UninterpretedOption::_internal_set_negative_int_value(arc_i64 value) { _has_bits_[0] |= 0x00000010u; negative_int_value_ = value; } -inline void UninterpretedOption::set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void UninterpretedOption::set_negative_int_value(arc_i64 value) { _internal_set_negative_int_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value) } @@ -13608,7 +13997,13 @@ inline TProtoStringType* UninterpretedOption::release_string_value() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (string_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void UninterpretedOption::set_allocated_string_value(TProtoStringType* string_value) { if (string_value != nullptr) { @@ -13618,6 +14013,11 @@ inline void UninterpretedOption::set_allocated_string_value(TProtoStringType* st } string_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), string_value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (string_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value) } @@ -13666,7 +14066,13 @@ inline TProtoStringType* UninterpretedOption::release_aggregate_value() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (aggregate_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void UninterpretedOption::set_allocated_aggregate_value(TProtoStringType* aggregate_value) { if (aggregate_value != nullptr) { @@ -13676,6 +14082,11 @@ inline void UninterpretedOption::set_allocated_aggregate_value(TProtoStringType* } aggregate_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), aggregate_value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (aggregate_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value) } @@ -13693,38 +14104,38 @@ inline int SourceCodeInfo_Location::path_size() const { inline void SourceCodeInfo_Location::clear_path() { path_.Clear(); } -inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::_internal_path(int index) const { +inline arc_i32 SourceCodeInfo_Location::_internal_path(int index) const { return path_.Get(index); } -inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::path(int index) const { +inline arc_i32 SourceCodeInfo_Location::path(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path) return _internal_path(index); } -inline void SourceCodeInfo_Location::set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::set_path(int index, arc_i32 value) { path_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path) } -inline void SourceCodeInfo_Location::_internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::_internal_add_path(arc_i32 value) { path_.Add(value); } -inline void SourceCodeInfo_Location::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::add_path(arc_i32 value) { _internal_add_path(value); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path) } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& SourceCodeInfo_Location::_internal_path() const { return path_; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& SourceCodeInfo_Location::path() const { // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path) return _internal_path(); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* SourceCodeInfo_Location::_internal_mutable_path() { return &path_; } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* SourceCodeInfo_Location::mutable_path() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path) return _internal_mutable_path(); @@ -13740,38 +14151,38 @@ inline int SourceCodeInfo_Location::span_size() const { inline void SourceCodeInfo_Location::clear_span() { span_.Clear(); } -inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::_internal_span(int index) const { +inline arc_i32 SourceCodeInfo_Location::_internal_span(int index) const { return span_.Get(index); } -inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::span(int index) const { +inline arc_i32 SourceCodeInfo_Location::span(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span) return _internal_span(index); } -inline void SourceCodeInfo_Location::set_span(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::set_span(int index, arc_i32 value) { span_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span) } -inline void SourceCodeInfo_Location::_internal_add_span(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::_internal_add_span(arc_i32 value) { span_.Add(value); } -inline void SourceCodeInfo_Location::add_span(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void SourceCodeInfo_Location::add_span(arc_i32 value) { _internal_add_span(value); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span) } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& SourceCodeInfo_Location::_internal_span() const { return span_; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& SourceCodeInfo_Location::span() const { // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span) return _internal_span(); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* SourceCodeInfo_Location::_internal_mutable_span() { return &span_; } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* SourceCodeInfo_Location::mutable_span() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span) return _internal_mutable_span(); @@ -13822,7 +14233,13 @@ inline TProtoStringType* SourceCodeInfo_Location::release_leading_comments() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (leading_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void SourceCodeInfo_Location::set_allocated_leading_comments(TProtoStringType* leading_comments) { if (leading_comments != nullptr) { @@ -13832,6 +14249,11 @@ inline void SourceCodeInfo_Location::set_allocated_leading_comments(TProtoString } leading_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), leading_comments, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (leading_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments) } @@ -13880,7 +14302,13 @@ inline TProtoStringType* SourceCodeInfo_Location::release_trailing_comments() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (trailing_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void SourceCodeInfo_Location::set_allocated_trailing_comments(TProtoStringType* trailing_comments) { if (trailing_comments != nullptr) { @@ -13890,6 +14318,11 @@ inline void SourceCodeInfo_Location::set_allocated_trailing_comments(TProtoStrin } trailing_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), trailing_comments, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (trailing_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments) } @@ -14026,38 +14459,38 @@ inline int GeneratedCodeInfo_Annotation::path_size() const { inline void GeneratedCodeInfo_Annotation::clear_path() { path_.Clear(); } -inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_path(int index) const { +inline arc_i32 GeneratedCodeInfo_Annotation::_internal_path(int index) const { return path_.Get(index); } -inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::path(int index) const { +inline arc_i32 GeneratedCodeInfo_Annotation::path(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) return _internal_path(index); } -inline void GeneratedCodeInfo_Annotation::set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::set_path(int index, arc_i32 value) { path_.Set(index, value); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) } -inline void GeneratedCodeInfo_Annotation::_internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::_internal_add_path(arc_i32 value) { path_.Add(value); } -inline void GeneratedCodeInfo_Annotation::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::add_path(arc_i32 value) { _internal_add_path(value); // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& GeneratedCodeInfo_Annotation::_internal_path() const { return path_; } -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >& GeneratedCodeInfo_Annotation::path() const { // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) return _internal_path(); } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* GeneratedCodeInfo_Annotation::_internal_mutable_path() { return &path_; } -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< arc_i32 >* GeneratedCodeInfo_Annotation::mutable_path() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) return _internal_mutable_path(); @@ -14108,7 +14541,13 @@ inline TProtoStringType* GeneratedCodeInfo_Annotation::release_source_file() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (source_file_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(TProtoStringType* source_file) { if (source_file != nullptr) { @@ -14118,6 +14557,11 @@ inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(TProtoString } source_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source_file, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (source_file_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) } @@ -14133,18 +14577,18 @@ inline void GeneratedCodeInfo_Annotation::clear_begin() { begin_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_begin() const { +inline arc_i32 GeneratedCodeInfo_Annotation::_internal_begin() const { return begin_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::begin() const { +inline arc_i32 GeneratedCodeInfo_Annotation::begin() const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) return _internal_begin(); } -inline void GeneratedCodeInfo_Annotation::_internal_set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::_internal_set_begin(arc_i32 value) { _has_bits_[0] |= 0x00000002u; begin_ = value; } -inline void GeneratedCodeInfo_Annotation::set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::set_begin(arc_i32 value) { _internal_set_begin(value); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) } @@ -14161,18 +14605,18 @@ inline void GeneratedCodeInfo_Annotation::clear_end() { end_ = 0; _has_bits_[0] &= ~0x00000004u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_end() const { +inline arc_i32 GeneratedCodeInfo_Annotation::_internal_end() const { return end_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::end() const { +inline arc_i32 GeneratedCodeInfo_Annotation::end() const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) return _internal_end(); } -inline void GeneratedCodeInfo_Annotation::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::_internal_set_end(arc_i32 value) { _has_bits_[0] |= 0x00000004u; end_ = value; } -inline void GeneratedCodeInfo_Annotation::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void GeneratedCodeInfo_Annotation::set_end(arc_i32 value) { _internal_set_end(value); // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) } diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc index d6182825b5..4b05990240 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc @@ -381,7 +381,7 @@ bool SimpleDescriptorDatabase::FindAllFileNames( bool SimpleDescriptorDatabase::MaybeCopy(const FileDescriptorProto* file, FileDescriptorProto* output) { - if (file == NULL) return false; + if (file == nullptr) return false; output->CopyFrom(*file); return true; } @@ -583,7 +583,7 @@ bool EncodedDescriptorDatabase::FindFileContainingSymbol( bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol( const TProtoStringType& symbol_name, TProtoStringType* output) { auto encoded_file = index_->FindSymbol(symbol_name); - if (encoded_file.first == NULL) return false; + if (encoded_file.first == nullptr) return false; // Optimization: The name should be the first field in the encoded message. // Try to just read it directly. @@ -871,7 +871,7 @@ bool EncodedDescriptorDatabase::FindAllFileNames( bool EncodedDescriptorDatabase::MaybeParse( std::pair<const void*, int> encoded_file, FileDescriptorProto* output) { - if (encoded_file.first == NULL) return false; + if (encoded_file.first == nullptr) return false; return output->ParseFromArray(encoded_file.first, encoded_file.second); } @@ -893,7 +893,7 @@ DescriptorPoolDatabase::~DescriptorPoolDatabase() {} bool DescriptorPoolDatabase::FindFileByName(const TProtoStringType& filename, FileDescriptorProto* output) { const FileDescriptor* file = pool_.FindFileByName(filename); - if (file == NULL) return false; + if (file == nullptr) return false; output->Clear(); file->CopyTo(output); return true; @@ -902,7 +902,7 @@ bool DescriptorPoolDatabase::FindFileByName(const TProtoStringType& filename, bool DescriptorPoolDatabase::FindFileContainingSymbol( const TProtoStringType& symbol_name, FileDescriptorProto* output) { const FileDescriptor* file = pool_.FindFileContainingSymbol(symbol_name); - if (file == NULL) return false; + if (file == nullptr) return false; output->Clear(); file->CopyTo(output); return true; @@ -912,11 +912,11 @@ bool DescriptorPoolDatabase::FindFileContainingExtension( const TProtoStringType& containing_type, int field_number, FileDescriptorProto* output) { const Descriptor* extendee = pool_.FindMessageTypeByName(containing_type); - if (extendee == NULL) return false; + if (extendee == nullptr) return false; const FieldDescriptor* extension = pool_.FindExtensionByNumber(extendee, field_number); - if (extension == NULL) return false; + if (extension == nullptr) return false; output->Clear(); extension->file()->CopyTo(output); @@ -926,7 +926,7 @@ bool DescriptorPoolDatabase::FindFileContainingExtension( bool DescriptorPoolDatabase::FindAllExtensionNumbers( const TProtoStringType& extendee_type, std::vector<int>* output) { const Descriptor* extendee = pool_.FindMessageTypeByName(extendee_type); - if (extendee == NULL) return false; + if (extendee == nullptr) return false; std::vector<const FieldDescriptor*> extensions; pool_.FindAllExtensions(extendee, &extensions); diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h index ac89ff6e39..9c9941031d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h @@ -268,7 +268,7 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { DescriptorIndex<const FileDescriptorProto*> index_; std::vector<std::unique_ptr<const FileDescriptorProto>> files_to_delete_; - // If file is non-NULL, copy it into *output and return true, otherwise + // If file is non-nullptr, copy it into *output and return true, otherwise // return false. bool MaybeCopy(const FileDescriptorProto* file, FileDescriptorProto* output); @@ -320,8 +320,8 @@ class PROTOBUF_EXPORT EncodedDescriptorDatabase : public DescriptorDatabase { std::unique_ptr<DescriptorIndex> index_; std::vector<void*> files_to_delete_; - // If encoded_file.first is non-NULL, parse the data into *output and return - // true, otherwise return false. + // If encoded_file.first is non-nullptr, parse the data into *output and + // return true, otherwise return false. bool MaybeParse(std::pair<const void*, int> encoded_file, FileDescriptorProto* output); diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc index eaf0f3e738..a88ff6686d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/duration.pb.cc @@ -35,7 +35,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_), ~0u, // no _extensions_ @@ -100,7 +100,7 @@ Duration::Duration(const Duration& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) } -void Duration::SharedCtor() { +inline void Duration::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&seconds_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&nanos_) - @@ -130,7 +130,7 @@ void Duration::SetCachedSize(int size) const { void Duration::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -143,12 +143,12 @@ void Duration::Clear() { const char* Duration::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // int64 seconds = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -156,8 +156,8 @@ const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::i 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -185,10 +185,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Duration::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Duration::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // int64 seconds = 1; @@ -215,7 +215,7 @@ size_t Duration::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -248,7 +248,7 @@ void Duration::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Duration::MergeFrom(const Duration& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_seconds() != 0) { diff --git a/contrib/libs/protobuf/src/google/protobuf/duration.pb.h b/contrib/libs/protobuf/src/google/protobuf/duration.pb.h index ebae830f61..a306c7c946 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fduration_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -120,7 +120,12 @@ class PROTOBUF_EXPORT Duration final : } inline void Swap(Duration* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -134,11 +139,7 @@ class PROTOBUF_EXPORT Duration final : // implements Message ---------------------------------------------- - inline Duration* New() const final { - return new Duration(); - } - - Duration* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Duration* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Duration>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -153,8 +154,8 @@ class PROTOBUF_EXPORT Duration 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -162,6 +163,8 @@ class PROTOBUF_EXPORT Duration final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Duration* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Duration"; @@ -189,20 +192,20 @@ class PROTOBUF_EXPORT Duration final : }; // int64 seconds = 1; void clear_seconds(); - ::PROTOBUF_NAMESPACE_ID::int64 seconds() const; - void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 seconds() const; + void set_seconds(arc_i64 value); private: - ::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const; - void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 _internal_seconds() const; + void _internal_set_seconds(arc_i64 value); public: // int32 nanos = 2; void clear_nanos(); - ::PROTOBUF_NAMESPACE_ID::int32 nanos() const; - void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 nanos() const; + void set_nanos(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const; - void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_nanos() const; + void _internal_set_nanos(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Duration) @@ -212,8 +215,8 @@ class PROTOBUF_EXPORT Duration final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::int64 seconds_; - ::PROTOBUF_NAMESPACE_ID::int32 nanos_; + arc_i64 seconds_; + arc_i32 nanos_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fduration_2eproto; }; @@ -232,18 +235,18 @@ class PROTOBUF_EXPORT Duration final : inline void Duration::clear_seconds() { seconds_ = arc_i64{0}; } -inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::_internal_seconds() const { +inline arc_i64 Duration::_internal_seconds() const { return seconds_; } -inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::seconds() const { +inline arc_i64 Duration::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) return _internal_seconds(); } -inline void Duration::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Duration::_internal_set_seconds(arc_i64 value) { seconds_ = value; } -inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Duration::set_seconds(arc_i64 value) { _internal_set_seconds(value); // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) } @@ -252,18 +255,18 @@ inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { inline void Duration::clear_nanos() { nanos_ = 0; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::_internal_nanos() const { +inline arc_i32 Duration::_internal_nanos() const { return nanos_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::nanos() const { +inline arc_i32 Duration::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) return _internal_nanos(); } -inline void Duration::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Duration::_internal_set_nanos(arc_i32 value) { nanos_ = value; } -inline void Duration::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Duration::set_nanos(arc_i32 value) { _internal_set_nanos(value); // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) } diff --git a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc index b3c2546dc0..b68ecc8d9b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc @@ -246,7 +246,6 @@ class DynamicMessage : public Message { // implements Message ---------------------------------------------- - Message* New() const override; Message* New(Arena* arena) const override; int GetCachedSize() const override; @@ -450,7 +449,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) { case FieldDescriptor::CPPTYPE_MESSAGE: { if (!field->is_repeated()) { - new (field_ptr) Message*(NULL); + new (field_ptr) Message*(nullptr); } else { if (IsMapFieldInApi(field)) { // We need to lock in most cases to avoid data racing. Only not lock @@ -499,7 +498,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) { bool DynamicMessage::is_prototype() const { return type_info_->prototype == this || - // If type_info_->prototype is NULL, then we must be constructing + // If type_info_->prototype is nullptr, then we must be constructing // the prototype now, which means we must be the prototype. type_info_->prototype == nullptr; } @@ -546,7 +545,7 @@ DynamicMessage::~DynamicMessage() { // from reflection. const TProtoStringType* default_value = nullptr; reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy( - default_value, NULL); + default_value, nullptr); break; } } @@ -606,14 +605,14 @@ DynamicMessage::~DynamicMessage() { type_info_->offsets[i])) ->GetPointer(); reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy(default_value, - NULL); + nullptr); break; } } } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { if (!is_prototype()) { Message* message = *reinterpret_cast<Message**>(field_ptr); - if (message != NULL) { + if (message != nullptr) { delete message; } } @@ -645,10 +644,8 @@ void DynamicMessage::CrossLinkPrototypes() { } } -Message* DynamicMessage::New() const { return New(NULL); } - Message* DynamicMessage::New(Arena* arena) const { - if (arena != NULL) { + if (arena != nullptr) { void* new_base = Arena::CreateArray<char>(arena, type_info_->size); memset(new_base, 0, type_info_->size); return new (new_base) DynamicMessage(type_info_, arena); @@ -701,7 +698,7 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( } const TypeInfo** target = &prototypes_[type]; - if (*target != NULL) { + if (*target != nullptr) { // Already exists. return (*target)->prototype; } @@ -710,7 +707,7 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( *target = type_info; type_info->type = type; - type_info->pool = (pool_ == NULL) ? type->file()->pool() : pool_; + type_info->pool = (pool_ == nullptr) ? type->file()->pool() : pool_; type_info->factory = this; // We need to construct all the structures passed to Reflection's constructor. @@ -747,9 +744,9 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( // hasbits. type_info->has_bits_offset = size; arc_ui32* has_bits_indices = new arc_ui32[type->field_count()]; - for (int i = 0; i < type->field_count(); i++) { + for (int j = 0; j < type->field_count(); j++) { // Initialize to -1, fields that need a hasbit will overwrite. - has_bits_indices[i] = static_cast<arc_ui32>(-1); + has_bits_indices[j] = static_cast<arc_ui32>(-1); } type_info->has_bits_indices.reset(has_bits_indices); } diff --git a/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc b/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc index f773af10fb..841e143a1d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/empty.pb.cc @@ -33,7 +33,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Empty, _internal_metadata_), ~0u, // no _extensions_ diff --git a/contrib/libs/protobuf/src/google/protobuf/empty.pb.h b/contrib/libs/protobuf/src/google/protobuf/empty.pb.h index 6fe2769c21..5e81d7e9ef 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -51,7 +51,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fempty_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -120,7 +120,12 @@ class PROTOBUF_EXPORT Empty final : } inline void Swap(Empty* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -134,11 +139,7 @@ class PROTOBUF_EXPORT Empty final : // implements Message ---------------------------------------------- - inline Empty* New() const final { - return new Empty(); - } - - Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Empty>(arena); } using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyFrom; @@ -150,6 +151,8 @@ class PROTOBUF_EXPORT Empty final : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(this, from); } public: + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Empty"; diff --git a/contrib/libs/protobuf/src/google/protobuf/explicitly_constructed.h b/contrib/libs/protobuf/src/google/protobuf/explicitly_constructed.h new file mode 100644 index 0000000000..69de60f76d --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/explicitly_constructed.h @@ -0,0 +1,91 @@ +// 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_EXPLICITLY_CONSTRUCTED_H__ +#define GOOGLE_PROTOBUF_EXPLICITLY_CONSTRUCTED_H__ + +#include <stdint.h> + +#include <utility> + +#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/stubs/common.h> + +// clang-format off +#include <google/protobuf/port_def.inc> +// clang-format on + +namespace google { +namespace protobuf { +namespace internal { + +// Wraps a variable whose constructor and destructor are explicitly +// called. It is particularly useful for a global variable, without its +// constructor and destructor run on start and end of the program lifetime. +// This circumvents the initial construction order fiasco, while keeping +// the address of the empty string a compile time constant. +// +// Pay special attention to the initialization state of the object. +// 1. The object is "uninitialized" to begin with. +// 2. Call Construct() or DefaultConstruct() only if the object is +// uninitialized. After the call, the object becomes "initialized". +// 3. Call get() and get_mutable() only if the object is initialized. +// 4. Call Destruct() only if the object is initialized. +// After the call, the object becomes uninitialized. +template <typename T> +class ExplicitlyConstructed { + public: + void DefaultConstruct() { new (&union_) T(); } + + template <typename... Args> + void Construct(Args&&... args) { + new (&union_) T(std::forward<Args>(args)...); + } + + void Destruct() { get_mutable()->~T(); } + + constexpr const T& get() const { return reinterpret_cast<const T&>(union_); } + T* get_mutable() { return reinterpret_cast<T*>(&union_); } + + private: + union AlignedUnion { + alignas(T) char space[sizeof(T)]; + arc_i64 align_to_int64; + void* align_to_ptr; + } union_; +}; + +} // namespace internal +} // namespace protobuf +} // namespace google + +#include <google/protobuf/port_undef.inc> + +#endif // GOOGLE_PROTOBUF_EXPLICITLY_CONSTRUCTED_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.cc b/contrib/libs/protobuf/src/google/protobuf/extension_set.cc index b4bcc24b18..af851b2a45 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.cc +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.cc @@ -142,7 +142,7 @@ ExtensionFinder::~ExtensionFinder() {} bool GeneratedExtensionFinder::Find(int number, ExtensionInfo* output) { const ExtensionInfo* extension = FindRegisteredExtension(extendee_, number); - if (extension == NULL) { + if (extension == nullptr) { return false; } else { *output = *extension; @@ -204,12 +204,12 @@ ExtensionSet::ExtensionSet(Arena* arena) flat_capacity_(0), flat_size_(0), map_{flat_capacity_ == 0 - ? NULL + ? nullptr : Arena::CreateArray<KeyValue>(arena_, flat_capacity_)} {} ExtensionSet::~ExtensionSet() { // Deletes all allocated extensions. - if (arena_ == NULL) { + if (arena_ == nullptr) { ForEach([](int /* number */, Extension& ext) { ext.Free(); }); if (PROTOBUF_PREDICT_FALSE(is_large())) { delete map_.large; @@ -242,11 +242,15 @@ void ExtensionSet::DeleteFlatMap(const ExtensionSet::KeyValue* flat, bool ExtensionSet::Has(int number) const { const Extension* ext = FindOrNull(number); - if (ext == NULL) return false; + if (ext == nullptr) return false; GOOGLE_DCHECK(!ext->is_repeated); return !ext->is_cleared; } +bool ExtensionSet::HasLazy(int number) const { + return Has(number) && FindOrNull(number)->is_lazy; +} + int ExtensionSet::NumExtensions() const { int result = 0; ForEach([&result](int /* number */, const Extension& ext) { @@ -259,12 +263,12 @@ int ExtensionSet::NumExtensions() const { int ExtensionSet::ExtensionSize(int number) const { const Extension* ext = FindOrNull(number); - return ext == NULL ? 0 : ext->GetSize(); + return ext == nullptr ? 0 : ext->GetSize(); } FieldType ExtensionSet::ExtensionType(int number) const { const Extension* ext = FindOrNull(number); - if (ext == NULL) { + if (ext == nullptr) { GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (1). "; return 0; } @@ -276,7 +280,7 @@ FieldType ExtensionSet::ExtensionType(int number) const { void ExtensionSet::ClearExtension(int number) { Extension* ext = FindOrNull(number); - if (ext == NULL) return; + if (ext == nullptr) return; ext->Clear(); } @@ -301,7 +305,7 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; LOWERCASE ExtensionSet::Get##CAMELCASE(int number, LOWERCASE default_value) \ const { \ const Extension* extension = FindOrNull(number); \ - if (extension == NULL || extension->is_cleared) { \ + if (extension == nullptr || extension->is_cleared) { \ return default_value; \ } else { \ GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ @@ -312,7 +316,7 @@ 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) { \ + if (extension == nullptr || extension->is_cleared) { \ return default_value; \ } else { \ GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE); \ @@ -339,7 +343,7 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; LOWERCASE ExtensionSet::GetRepeated##CAMELCASE(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, UPPERCASE); \ return extension->repeated_##LOWERCASE##_value->Get(index); \ } \ @@ -347,7 +351,7 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; 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_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty)."; \ GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE); \ return extension->repeated_##LOWERCASE##_value->Get(index); \ } \ @@ -355,7 +359,7 @@ enum { REPEATED_FIELD, OPTIONAL_FIELD }; void ExtensionSet::SetRepeated##CAMELCASE(int number, int index, \ LOWERCASE 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, UPPERCASE); \ extension->repeated_##LOWERCASE##_value->Set(index, value); \ } \ @@ -392,7 +396,7 @@ PRIMITIVE_ACCESSORS(BOOL, bool, Bool) const void* ExtensionSet::GetRawRepeatedField(int number, const void* default_value) const { const Extension* extension = FindOrNull(number); - if (extension == NULL) { + if (extension == nullptr) { return default_value; } // We assume that all the RepeatedField<>* pointers have the same @@ -466,7 +470,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number, FieldType field_type, // the don't already exist; instead, just GOOGLE_CHECK-fails. void* ExtensionSet::MutableRawRepeatedField(int number) { Extension* extension = FindOrNull(number); - GOOGLE_CHECK(extension != NULL) << "Extension not found."; + GOOGLE_CHECK(extension != nullptr) << "Extension not found."; // We assume that all the RepeatedField<>* pointers have the same // size and alignment within the anonymous union in Extension. return extension->repeated_arc_i32_value; @@ -477,7 +481,7 @@ void* ExtensionSet::MutableRawRepeatedField(int number) { int ExtensionSet::GetEnum(int number, int default_value) 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 default_value; } else { @@ -556,7 +560,7 @@ void ExtensionSet::AddEnum(int number, FieldType type, bool packed, int value, const TProtoStringType& ExtensionSet::GetString( int number, const TProtoStringType& default_value) 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 default_value; } else { @@ -583,14 +587,14 @@ TProtoStringType* ExtensionSet::MutableString(int number, FieldType type, const TProtoStringType& ExtensionSet::GetRepeatedString(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, STRING); return extension->repeated_string_value->Get(index); } TProtoStringType* ExtensionSet::MutableRepeatedString(int number, int index) { 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, STRING); return extension->repeated_string_value->Mutable(index); } @@ -617,13 +621,13 @@ TProtoStringType* ExtensionSet::AddString(int number, FieldType type, const MessageLite& ExtensionSet::GetMessage( int number, const MessageLite& default_value) const { const Extension* extension = FindOrNull(number); - if (extension == NULL) { + if (extension == nullptr) { // Not present. Return the default value. return default_value; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); if (extension->is_lazy) { - return extension->lazymessage_value->GetMessage(default_value); + return extension->lazymessage_value->GetMessage(default_value, arena_); } else { return *extension->message_value; } @@ -666,7 +670,7 @@ MessageLite* ExtensionSet::MutableMessage(int number, FieldType type, void ExtensionSet::SetAllocatedMessage(int number, FieldType type, const FieldDescriptor* descriptor, MessageLite* message) { - if (message == NULL) { + if (message == nullptr) { ClearExtension(number); return; } @@ -681,9 +685,9 @@ void ExtensionSet::SetAllocatedMessage(int number, FieldType type, extension->is_lazy = false; if (message_arena == arena_) { extension->message_value = message; - } else if (message_arena == NULL) { + } else if (message_arena == nullptr) { extension->message_value = message; - arena_->Own(message); // not NULL because not equal to message_arena + arena_->Own(message); // not nullptr because not equal to message_arena } else { extension->message_value = message->New(arena_); extension->message_value->CheckTypeAndMergeFrom(*message); @@ -691,16 +695,16 @@ void ExtensionSet::SetAllocatedMessage(int number, FieldType type, } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); if (extension->is_lazy) { - extension->lazymessage_value->SetAllocatedMessage(message); + extension->lazymessage_value->SetAllocatedMessage(message, arena_); } else { - if (arena_ == NULL) { + if (arena_ == nullptr) { delete extension->message_value; } if (message_arena == arena_) { extension->message_value = message; - } else if (message_arena == NULL) { + } else if (message_arena == nullptr) { extension->message_value = message; - arena_->Own(message); // not NULL because not equal to message_arena + arena_->Own(message); // not nullptr because not equal to message_arena } else { extension->message_value = message->New(arena_); extension->message_value->CheckTypeAndMergeFrom(*message); @@ -713,7 +717,7 @@ void ExtensionSet::SetAllocatedMessage(int number, FieldType type, void ExtensionSet::UnsafeArenaSetAllocatedMessage( int number, FieldType type, const FieldDescriptor* descriptor, MessageLite* message) { - if (message == NULL) { + if (message == nullptr) { ClearExtension(number); return; } @@ -727,9 +731,10 @@ void ExtensionSet::UnsafeArenaSetAllocatedMessage( } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); if (extension->is_lazy) { - extension->lazymessage_value->UnsafeArenaSetAllocatedMessage(message); + extension->lazymessage_value->UnsafeArenaSetAllocatedMessage(message, + arena_); } else { - if (arena_ == NULL) { + if (arena_ == nullptr) { delete extension->message_value; } extension->message_value = message; @@ -741,19 +746,19 @@ void ExtensionSet::UnsafeArenaSetAllocatedMessage( MessageLite* ExtensionSet::ReleaseMessage(int number, const MessageLite& prototype) { Extension* extension = FindOrNull(number); - if (extension == NULL) { - // Not present. Return NULL. - return NULL; + if (extension == nullptr) { + // Not present. Return nullptr. + return nullptr; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); - MessageLite* ret = NULL; + MessageLite* ret = nullptr; if (extension->is_lazy) { - ret = extension->lazymessage_value->ReleaseMessage(prototype); - if (arena_ == NULL) { + ret = extension->lazymessage_value->ReleaseMessage(prototype, arena_); + if (arena_ == nullptr) { delete extension->lazymessage_value; } } else { - if (arena_ == NULL) { + if (arena_ == nullptr) { ret = extension->message_value; } else { // ReleaseMessage() always returns a heap-allocated message, and we are @@ -770,15 +775,16 @@ MessageLite* ExtensionSet::ReleaseMessage(int number, MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( int number, const MessageLite& prototype) { Extension* extension = FindOrNull(number); - if (extension == NULL) { - // Not present. Return NULL. - return NULL; + if (extension == nullptr) { + // Not present. Return nullptr. + return nullptr; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE); - MessageLite* ret = NULL; + MessageLite* ret = nullptr; if (extension->is_lazy) { - ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(prototype); - if (arena_ == NULL) { + ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(prototype, + arena_); + if (arena_ == nullptr) { delete extension->lazymessage_value; } } else { @@ -796,14 +802,14 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( const MessageLite& ExtensionSet::GetRepeatedMessage(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, MESSAGE); return extension->repeated_message_value->Get(index); } MessageLite* ExtensionSet::MutableRepeatedMessage(int number, int index) { 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, MESSAGE); return extension->repeated_message_value->Mutable(index); } @@ -827,7 +833,7 @@ MessageLite* ExtensionSet::AddMessage(int number, FieldType type, MessageLite* result = reinterpret_cast<internal::RepeatedPtrFieldBase*>( extension->repeated_message_value) ->AddFromCleared<GenericTypeHandler<MessageLite>>(); - if (result == NULL) { + if (result == nullptr) { result = prototype.New(arena_); extension->repeated_message_value->AddAllocated(result); } @@ -843,7 +849,7 @@ MessageLite* ExtensionSet::AddMessage(int number, FieldType type, void ExtensionSet::RemoveLast(int number) { 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(extension->is_repeated); switch (cpp_type(extension->type)) { @@ -882,7 +888,7 @@ void ExtensionSet::RemoveLast(int number) { MessageLite* ExtensionSet::ReleaseLast(int number) { 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(extension->is_repeated); GOOGLE_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE); return extension->repeated_message_value->ReleaseLast(); @@ -898,7 +904,7 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseLast(int number) { void ExtensionSet::SwapElements(int number, int index1, int index2) { 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(extension->is_repeated); switch (cpp_type(extension->type)) { @@ -963,7 +969,8 @@ size_t SizeOfUnion(ItX it_xs, ItX end_xs, ItY it_ys, ItY end_ys) { } } // namespace -void ExtensionSet::MergeFrom(const ExtensionSet& other) { +void ExtensionSet::MergeFrom(const MessageLite* extendee, + const ExtensionSet& other) { if (PROTOBUF_PREDICT_TRUE(!is_large())) { if (PROTOBUF_PREDICT_TRUE(!other.is_large())) { GrowCapacity(SizeOfUnion(flat_begin(), flat_end(), other.flat_begin(), @@ -974,13 +981,15 @@ void ExtensionSet::MergeFrom(const ExtensionSet& other) { other.map_.large->end())); } } - other.ForEach([this](int number, const Extension& ext) { - this->InternalExtensionMergeFrom(number, ext); + other.ForEach([extendee, this, &other](int number, const Extension& ext) { + this->InternalExtensionMergeFrom(extendee, number, ext, other.arena_); }); } -void ExtensionSet::InternalExtensionMergeFrom( - int number, const Extension& other_extension) { +void ExtensionSet::InternalExtensionMergeFrom(const MessageLite* extendee, + int number, + const Extension& other_extension, + Arena* other_arena) { if (other_extension.is_repeated) { Extension* extension; bool is_new = @@ -1033,7 +1042,7 @@ void ExtensionSet::InternalExtensionMergeFrom( reinterpret_cast<internal::RepeatedPtrFieldBase*>( extension->repeated_message_value) ->AddFromCleared<GenericTypeHandler<MessageLite>>(); - if (target == NULL) { + if (target == nullptr) { target = other_message.New(arena_); extension->repeated_message_value->AddAllocated(target); } @@ -1077,6 +1086,7 @@ void ExtensionSet::InternalExtensionMergeFrom( extension->lazymessage_value = other_extension.lazymessage_value->New(arena_); extension->lazymessage_value->MergeFrom( + GetPrototypeForLazyMessage(extendee, number), *other_extension.lazymessage_value, arena_); } else { extension->is_lazy = false; @@ -1092,11 +1102,12 @@ void ExtensionSet::InternalExtensionMergeFrom( if (other_extension.is_lazy) { if (extension->is_lazy) { extension->lazymessage_value->MergeFrom( + GetPrototypeForLazyMessage(extendee, number), *other_extension.lazymessage_value, arena_); } else { extension->message_value->CheckTypeAndMergeFrom( other_extension.lazymessage_value->GetMessage( - *extension->message_value)); + *extension->message_value, other_arena)); } } else { if (extension->is_lazy) { @@ -1117,23 +1128,23 @@ void ExtensionSet::InternalExtensionMergeFrom( } } -void ExtensionSet::Swap(ExtensionSet* x) { +void ExtensionSet::Swap(const MessageLite* extendee, ExtensionSet* other) { #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetArena() != nullptr && GetArena() == x->GetArena()) { + if (GetArena() != nullptr && GetArena() == other->GetArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetArena() == x->GetArena()) { + if (GetArena() == other->GetArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(x); + InternalSwap(other); } else { // TODO(cfallin, rohananil): We maybe able to optimize a case where we are // swapping from heap to arena-allocated extension set, by just Own()'ing // the extensions. ExtensionSet extension_set; - extension_set.MergeFrom(*x); - x->Clear(); - x->MergeFrom(*this); + extension_set.MergeFrom(extendee, *other); + other->Clear(); + other->MergeFrom(extendee, *this); Clear(); - MergeFrom(extension_set); + MergeFrom(extendee, extension_set); } } @@ -1145,7 +1156,8 @@ void ExtensionSet::InternalSwap(ExtensionSet* other) { swap(map_, other->map_); } -void ExtensionSet::SwapExtension(ExtensionSet* other, int number) { +void ExtensionSet::SwapExtension(const MessageLite* extendee, + ExtensionSet* other, int number) { if (this == other) return; if (GetArena() == other->GetArena()) { @@ -1165,18 +1177,22 @@ void ExtensionSet::SwapExtension(ExtensionSet* other, int number) { // We do it this way to reuse the copy-across-arenas logic already // implemented in ExtensionSet's MergeFrom. ExtensionSet temp; - temp.InternalExtensionMergeFrom(number, *other_ext); + temp.InternalExtensionMergeFrom(extendee, number, *other_ext, + other->GetArena()); Extension* temp_ext = temp.FindOrNull(number); + other_ext->Clear(); - other->InternalExtensionMergeFrom(number, *this_ext); + other->InternalExtensionMergeFrom(extendee, number, *this_ext, + this->GetArena()); this_ext->Clear(); - InternalExtensionMergeFrom(number, *temp_ext); + InternalExtensionMergeFrom(extendee, number, *temp_ext, temp.GetArena()); } else if (this_ext == nullptr) { - InternalExtensionMergeFrom(number, *other_ext); + InternalExtensionMergeFrom(extendee, number, *other_ext, other->GetArena()); if (other->GetArena() == nullptr) other_ext->Free(); other->Erase(number); } else { - other->InternalExtensionMergeFrom(number, *this_ext); + other->InternalExtensionMergeFrom(extendee, number, *this_ext, + this->GetArena()); if (GetArena() == nullptr) this_ext->Free(); Erase(number); } @@ -1888,7 +1904,7 @@ const ExtensionSet::Extension* ExtensionSet::FindOrNullInLargeMap( if (it != map_.large->end()) { return &it->second; } - return NULL; + return nullptr; } ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) { @@ -1960,8 +1976,12 @@ void ExtensionSet::GrowCapacity(size_t minimum_new_capacity) { map_ = new_map; } +#if (__cplusplus < 201703) && \ + (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // static constexpr uint16_t ExtensionSet::kMaximumFlatCapacity; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 + // && _MSC_VER < 1912)) void ExtensionSet::Erase(int key) { if (PROTOBUF_PREDICT_FALSE(is_large())) { diff --git a/contrib/libs/protobuf/src/google/protobuf/extension_set.h b/contrib/libs/protobuf/src/google/protobuf/extension_set.h index 6cd4bd1c14..1ea91bfa32 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set.h @@ -70,6 +70,7 @@ class DescriptorPool; // descriptor.h class MessageLite; // message_lite.h class Message; // message.h class MessageFactory; // message.h +class Reflection; // message.h class UnknownFieldSet; // unknown_field_set.h namespace internal { class FieldSkipper; // wire_format_lite.h @@ -100,22 +101,22 @@ typedef bool EnumValidityFuncWithArg(const void* arg, int number); // Information about a registered extension. struct ExtensionInfo { - inline ExtensionInfo() {} - inline ExtensionInfo(const MessageLite* extendee, int param_number, - FieldType type_param, bool isrepeated, bool ispacked) + constexpr ExtensionInfo() : enum_validity_check() {} + constexpr 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) {} + enum_validity_check() {} - const MessageLite* message; - int number; + const MessageLite* message = nullptr; + int number = 0; - FieldType type; - bool is_repeated; - bool is_packed; + FieldType type = 0; + bool is_repeated = false; + bool is_packed = false; struct EnumValidityCheck { EnumValidityFuncWithArg* func; @@ -132,9 +133,9 @@ struct ExtensionInfo { }; // The descriptor for this extension, if one exists and is known. May be - // NULL. Must not be NULL if the descriptor for the extension does not + // nullptr. Must not be nullptr if the descriptor for the extension does not // live in the same pool as the descriptor for the containing type. - const FieldDescriptor* descriptor; + const FieldDescriptor* descriptor = nullptr; }; // Abstract interface for an object which looks up extension definitions. Used @@ -261,7 +262,7 @@ class PROTOBUF_EXPORT ExtensionSet { const MessageLite& GetMessage(int number, const Descriptor* message_type, MessageFactory* factory) const; - // |descriptor| may be NULL so long as it is known that the descriptor for + // |descriptor| may be nullptr so long as it is known that the descriptor for // the extension lives in the same pool as the descriptor for the containing // type. #define desc const FieldDescriptor* descriptor // avoid line wrapping @@ -281,19 +282,19 @@ class PROTOBUF_EXPORT ExtensionSet { MessageFactory* factory); // Adds the given message to the ExtensionSet, taking ownership of the // message object. Existing message with the same number will be deleted. - // If "message" is NULL, this is equivalent to "ClearExtension(number)". + // If "message" is nullptr, this is equivalent to "ClearExtension(number)". void SetAllocatedMessage(int number, FieldType type, const FieldDescriptor* descriptor, MessageLite* message); void UnsafeArenaSetAllocatedMessage(int number, FieldType type, const FieldDescriptor* descriptor, MessageLite* message); - PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage( - int number, const MessageLite& prototype); + PROTOBUF_NODISCARD MessageLite* ReleaseMessage(int number, + const MessageLite& prototype); MessageLite* UnsafeArenaReleaseMessage(int number, const MessageLite& prototype); - PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage( + PROTOBUF_NODISCARD MessageLite* ReleaseMessage( const FieldDescriptor* descriptor, MessageFactory* factory); MessageLite* UnsafeArenaReleaseMessage(const FieldDescriptor* descriptor, MessageFactory* factory); @@ -363,7 +364,7 @@ class PROTOBUF_EXPORT ExtensionSet { #undef desc void RemoveLast(int number); - PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseLast(int number); + PROTOBUF_NODISCARD MessageLite* ReleaseLast(int number); MessageLite* UnsafeArenaReleaseLast(int number); void SwapElements(int number, int index1, int index2); @@ -377,10 +378,11 @@ class PROTOBUF_EXPORT ExtensionSet { // class, but providing them here helps keep the generated code size down. void Clear(); - void MergeFrom(const ExtensionSet& other); - void Swap(ExtensionSet* other); + void MergeFrom(const MessageLite* extendee, const ExtensionSet& other); + void Swap(const MessageLite* extendee, ExtensionSet* other); void InternalSwap(ExtensionSet* other); - void SwapExtension(ExtensionSet* other, int number); + void SwapExtension(const MessageLite* extendee, ExtensionSet* other, + int number); void UnsafeShallowSwapExtension(ExtensionSet* other, int number); bool IsInitialized() const; @@ -544,6 +546,8 @@ class PROTOBUF_EXPORT ExtensionSet { template <typename Type, bool IsValid(int)> friend class RepeatedEnumTypeTraits; + friend class google::protobuf::Reflection; + const arc_i32& GetRefInt32(int number, const arc_i32& default_value) const; const arc_i64& GetRefInt64(int number, const arc_i64& default_value) const; const arc_ui32& GetRefUInt32(int number, const arc_ui32& default_value) const; @@ -573,16 +577,17 @@ class PROTOBUF_EXPORT ExtensionSet { virtual ~LazyMessageExtension() {} virtual LazyMessageExtension* New(Arena* arena) const = 0; - virtual const MessageLite& GetMessage( - const MessageLite& prototype) const = 0; + virtual const MessageLite& GetMessage(const MessageLite& prototype, + Arena* arena) const = 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( - const MessageLite& prototype) = 0; - virtual MessageLite* UnsafeArenaReleaseMessage( - const MessageLite& prototype) = 0; + virtual void SetAllocatedMessage(MessageLite* message, Arena* arena) = 0; + virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message, + Arena* arena) = 0; + PROTOBUF_NODISCARD virtual MessageLite* ReleaseMessage( + const MessageLite& prototype, Arena* arena) = 0; + virtual MessageLite* UnsafeArenaReleaseMessage(const MessageLite& prototype, + Arena* arena) = 0; virtual bool IsInitialized() const = 0; @@ -591,13 +596,15 @@ class PROTOBUF_EXPORT ExtensionSet { virtual size_t ByteSizeLong() const = 0; virtual size_t SpaceUsedLong() const = 0; - virtual void MergeFrom(const LazyMessageExtension& other, Arena* arena) = 0; + virtual void MergeFrom(const MessageLite* prototype, + 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 const char* _InternalParse(const Message& prototype, Arena* arena, + const char* ptr, ParseContext* ctx) = 0; virtual uint8_t* WriteMessageToArray( const MessageLite* prototype, int number, uint8_t* target, io::EpsCopyOutputStream* stream) const = 0; @@ -664,8 +671,8 @@ class PROTOBUF_EXPORT ExtensionSet { mutable int cached_size; // The descriptor for this extension, if one exists and is known. May be - // NULL. Must not be NULL if the descriptor for the extension does not - // live in the same pool as the descriptor for the containing type. + // nullptr. Must not be nullptr if the descriptor for the extension does + // not live in the same pool as the descriptor for the containing type. const FieldDescriptor* descriptor; // Some helper methods for operations on a single Extension. @@ -766,7 +773,9 @@ class PROTOBUF_EXPORT ExtensionSet { } // Merges existing Extension from other_extension - void InternalExtensionMergeFrom(int number, const Extension& other_extension); + void InternalExtensionMergeFrom(const MessageLite* extendee, int number, + const Extension& other_extension, + Arena* other_arena); // Returns true and fills field_number and extension if extension is found. // Note to support packed repeated field compatibility, it also fills whether @@ -806,6 +815,9 @@ class PROTOBUF_EXPORT ExtensionSet { ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper); + // Returns true if extension is present and lazy. + bool HasLazy(int number) const; + // Gets the extension with the given number, creating it if it does not // already exist. Returns true if the extension did not already exist. bool MaybeNewExtension(int number, const FieldDescriptor* descriptor, @@ -1078,7 +1090,7 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { template <> \ inline void PrimitiveTypeTraits<TYPE>::Set(int number, FieldType field_type, \ TYPE value, ExtensionSet* set) { \ - set->Set##METHOD(number, field_type, value, NULL); \ + set->Set##METHOD(number, field_type, value, nullptr); \ } \ \ template <> \ @@ -1100,7 +1112,7 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { inline void RepeatedPrimitiveTypeTraits<TYPE>::Add( \ int number, FieldType field_type, bool is_packed, TYPE value, \ ExtensionSet* set) { \ - set->Add##METHOD(number, field_type, is_packed, value, NULL); \ + set->Add##METHOD(number, field_type, is_packed, value, nullptr); \ } \ template <> \ inline const RepeatedField<TYPE>* \ @@ -1126,7 +1138,7 @@ class PROTOBUF_EXPORT RepeatedPrimitiveDefaults { RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated( \ int number, FieldType field_type, bool is_packed, ExtensionSet* set) { \ return reinterpret_cast<RepeatedField<TYPE>*>( \ - set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); \ + set->MutableRawRepeatedField(number, field_type, is_packed, nullptr)); \ } PROTOBUF_DEFINE_PRIMITIVE_TYPE(arc_i32, Int32) @@ -1159,11 +1171,11 @@ class PROTOBUF_EXPORT StringTypeTraits { } static inline void Set(int number, FieldType field_type, const TProtoStringType& value, ExtensionSet* set) { - set->SetString(number, field_type, value, NULL); + set->SetString(number, field_type, value, nullptr); } static inline TProtoStringType* Mutable(int number, FieldType field_type, ExtensionSet* set) { - return set->MutableString(number, field_type, NULL); + return set->MutableString(number, field_type, nullptr); } template <typename ExtendeeT> static void Register(int number, FieldType type, bool is_packed) { @@ -1201,11 +1213,11 @@ class PROTOBUF_EXPORT RepeatedStringTypeTraits { } static inline void Add(int number, FieldType field_type, bool /*is_packed*/, const TProtoStringType& value, ExtensionSet* set) { - set->AddString(number, field_type, value, NULL); + set->AddString(number, field_type, value, nullptr); } static inline TProtoStringType* Add(int number, FieldType field_type, ExtensionSet* set) { - return set->AddString(number, field_type, NULL); + return set->AddString(number, field_type, nullptr); } static inline const RepeatedPtrField<TProtoStringType>& GetRepeated( int number, const ExtensionSet& set) { @@ -1216,7 +1228,7 @@ class PROTOBUF_EXPORT RepeatedStringTypeTraits { static inline RepeatedPtrField<TProtoStringType>* MutableRepeated( int number, FieldType field_type, bool is_packed, ExtensionSet* set) { return reinterpret_cast<RepeatedPtrField<TProtoStringType>*>( - set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); + set->MutableRawRepeatedField(number, field_type, is_packed, nullptr)); } static const RepeatedFieldType* GetDefaultRepeatedField(); @@ -1256,7 +1268,7 @@ class EnumTypeTraits { static inline void Set(int number, FieldType field_type, ConstType value, ExtensionSet* set) { GOOGLE_DCHECK(IsValid(value)); - set->SetEnum(number, field_type, value, NULL); + set->SetEnum(number, field_type, value, nullptr); } template <typename ExtendeeT> static void Register(int number, FieldType type, bool is_packed) { @@ -1290,7 +1302,7 @@ class RepeatedEnumTypeTraits { static inline void Add(int number, FieldType field_type, bool is_packed, ConstType value, ExtensionSet* set) { GOOGLE_DCHECK(IsValid(value)); - set->AddEnum(number, field_type, is_packed, value, NULL); + set->AddEnum(number, field_type, is_packed, value, nullptr); } static inline const RepeatedField<Type>& GetRepeated( int number, const ExtensionSet& set) { @@ -1310,7 +1322,7 @@ class RepeatedEnumTypeTraits { bool is_packed, ExtensionSet* set) { return reinterpret_cast<RepeatedField<Type>*>( - set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); + set->MutableRawRepeatedField(number, field_type, is_packed, nullptr)); } static const RepeatedFieldType* GetDefaultRepeatedField() { @@ -1347,27 +1359,27 @@ 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*/) { + 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( - number, field_type, Type::default_instance(), NULL)); + number, field_type, Type::default_instance(), nullptr)); } static inline void SetAllocated(int number, FieldType field_type, MutableType message, ExtensionSet* set) { - set->SetAllocatedMessage(number, field_type, NULL, message); + set->SetAllocatedMessage(number, field_type, nullptr, message); } static inline void UnsafeArenaSetAllocated(int number, FieldType field_type, MutableType message, ExtensionSet* set) { - set->UnsafeArenaSetAllocatedMessage(number, field_type, NULL, message); + set->UnsafeArenaSetAllocatedMessage(number, field_type, nullptr, message); } - static inline PROTOBUF_MUST_USE_RESULT MutableType - Release(int number, FieldType /* field_type */, ExtensionSet* set) { + PROTOBUF_NODISCARD static inline MutableType Release( + int number, FieldType /* field_type */, ExtensionSet* set) { return static_cast<Type*>( set->ReleaseMessage(number, Type::default_instance())); } @@ -1400,13 +1412,13 @@ 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*/) { + 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*/) { + static inline std::nullptr_t GetRepeatedPtr(int /* number */, + const ExtensionSet& /* set */) { // Cannot be implemented because of forward declared messages? return nullptr; } @@ -1416,7 +1428,7 @@ class RepeatedMessageTypeTraits { static inline MutableType Add(int number, FieldType field_type, ExtensionSet* set) { return static_cast<Type*>( - set->AddMessage(number, field_type, Type::default_instance(), NULL)); + set->AddMessage(number, field_type, Type::default_instance(), nullptr)); } static inline const RepeatedPtrField<Type>& GetRepeated( int number, const ExtensionSet& set) { @@ -1433,7 +1445,7 @@ class RepeatedMessageTypeTraits { bool is_packed, ExtensionSet* set) { return reinterpret_cast<RepeatedPtrField<Type>*>( - set->MutableRawRepeatedField(number, field_type, is_packed, NULL)); + set->MutableRawRepeatedField(number, field_type, is_packed, nullptr)); } static const RepeatedFieldType* GetDefaultRepeatedField(); 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 aa9e818bdd..7bb4433d70 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set_heavy.cc @@ -157,7 +157,7 @@ const MessageLite& ExtensionSet::GetMessage(int number, GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); if (extension->is_lazy) { return extension->lazymessage_value->GetMessage( - *factory->GetPrototype(message_type)); + *factory->GetPrototype(message_type), arena_); } else { return *extension->message_value; } @@ -194,14 +194,14 @@ MessageLite* ExtensionSet::ReleaseMessage(const FieldDescriptor* descriptor, MessageFactory* factory) { Extension* extension = FindOrNull(descriptor->number()); if (extension == nullptr) { - // Not present. Return NULL. + // Not present. Return nullptr. return nullptr; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->ReleaseMessage( - *factory->GetPrototype(descriptor->message_type())); + *factory->GetPrototype(descriptor->message_type()), arena_); if (arena_ == nullptr) { delete extension->lazymessage_value; } @@ -222,14 +222,14 @@ MessageLite* ExtensionSet::UnsafeArenaReleaseMessage( const FieldDescriptor* descriptor, MessageFactory* factory) { Extension* extension = FindOrNull(descriptor->number()); if (extension == nullptr) { - // Not present. Return NULL. + // Not present. Return nullptr. return nullptr; } else { GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE); MessageLite* ret = nullptr; if (extension->is_lazy) { ret = extension->lazymessage_value->UnsafeArenaReleaseMessage( - *factory->GetPrototype(descriptor->message_type())); + *factory->GetPrototype(descriptor->message_type()), arena_); if (arena_ == nullptr) { delete extension->lazymessage_value; } @@ -313,7 +313,7 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { output->message_info.prototype = factory_->GetPrototype(extension->message_type()); GOOGLE_CHECK(output->message_info.prototype != nullptr) - << "Extension factory's GetPrototype() returned NULL for extension: " + << "Extension factory's GetPrototype() returned nullptr; extension: " << extension->full_name(); } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) { output->enum_validity_check.func = ValidateEnumUsingDescriptor; 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 b3e69b1201..df05f610aa 100644 --- a/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h +++ b/contrib/libs/protobuf/src/google/protobuf/extension_set_inl.h @@ -206,21 +206,16 @@ const char* ExtensionSet::ParseMessageSetItemTmpl( const char* ptr, const Msg* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { TProtoStringType payload; - arc_ui32 type_id; - enum class State { kNoTag, kHasType, kHasPayload, kDone }; - State state = State::kNoTag; - + arc_ui32 type_id = 0; + bool payload_read = false; while (!ctx->Done(&ptr)) { arc_ui32 tag = static_cast<uint8_t>(*ptr++); if (tag == WireFormatLite::kMessageSetTypeIdTag) { arc_ui64 tmp; ptr = ParseBigVarint(ptr, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - if (state == State::kNoTag) { - type_id = tmp; - state = State::kHasType; - } else if (state == State::kHasPayload) { - type_id = tmp; + type_id = tmp; + if (payload_read) { ExtensionInfo extension; bool was_packed_on_wire; if (!FindExtension(2, type_id, extendee, ctx, &extension, @@ -246,24 +241,20 @@ const char* ExtensionSet::ParseMessageSetItemTmpl( GOOGLE_PROTOBUF_PARSER_ASSERT(value->_InternalParse(p, &tmp_ctx) && tmp_ctx.EndedAtLimit()); } - state = State::kDone; + type_id = 0; } } else if (tag == WireFormatLite::kMessageSetMessageTag) { - if (state == State::kHasType) { + if (type_id != 0) { ptr = ParseFieldMaybeLazily(static_cast<arc_ui64>(type_id) * 8 + 2, ptr, extendee, metadata, ctx); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr); - state = State::kDone; + type_id = 0; } else { - TProtoStringType tmp; arc_i32 size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - ptr = ctx->ReadString(ptr, size, &tmp); + ptr = ctx->ReadString(ptr, size, &payload); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - if (state == State::kNoTag) { - payload = std::move(tmp); - state = State::kHasPayload; - } + payload_read = true; } } else { ptr = ReadTag(ptr - 1, &tag); 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 fbb4f12948..25d027839e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.cc @@ -34,7 +34,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 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_), ~0u, // no _extensions_ @@ -97,7 +97,7 @@ FieldMask::FieldMask(const FieldMask& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask) } -void FieldMask::SharedCtor() { +inline void FieldMask::SharedCtor() { } FieldMask::~FieldMask() { @@ -123,7 +123,7 @@ void FieldMask::SetCachedSize(int size) const { void FieldMask::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldMask) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -134,12 +134,12 @@ void FieldMask::Clear() { const char* FieldMask::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated string paths = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -175,10 +175,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FieldMask::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FieldMask::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated string paths = 1; @@ -203,7 +203,7 @@ size_t FieldMask::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldMask) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -234,7 +234,7 @@ void FieldMask::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FieldMask::MergeFrom(const FieldMask& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldMask) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; paths_.MergeFrom(from.paths_); 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 14d931a571..fe0a7ae2db 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -120,7 +120,12 @@ class PROTOBUF_EXPORT FieldMask final : } inline void Swap(FieldMask* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -134,11 +139,7 @@ class PROTOBUF_EXPORT FieldMask final : // implements Message ---------------------------------------------- - inline FieldMask* New() const final { - return new FieldMask(); - } - - FieldMask* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FieldMask* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FieldMask>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -153,8 +154,8 @@ class PROTOBUF_EXPORT FieldMask 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -162,6 +163,8 @@ class PROTOBUF_EXPORT FieldMask final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FieldMask* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FieldMask"; 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 80eacea4db..dae6e8feae 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc @@ -50,10 +50,13 @@ #include <google/protobuf/repeated_field.h> #include <google/protobuf/unknown_field_set.h> #include <google/protobuf/wire_format.h> +#include <google/protobuf/stubs/casts.h> #include <google/protobuf/stubs/strutil.h> +// clang-format off #include <google/protobuf/port_def.inc> +// clang-format on #define GOOGLE_PROTOBUF_HAS_ONEOF @@ -248,6 +251,12 @@ UnknownFieldSet* Reflection::MutableUnknownFields(Message* message) const { ->mutable_unknown_fields<UnknownFieldSet>(); } +bool Reflection::IsLazyExtension(const Message& message, + const FieldDescriptor* field) const { + return field->is_extension() && + GetExtensionSet(message).HasLazy(field->number()); +} + bool Reflection::IsLazilyVerifiedLazyField(const FieldDescriptor* field) const { return field->options().lazy(); } @@ -987,6 +996,8 @@ void Reflection::SwapFieldsImpl( GOOGLE_DCHECK(!unsafe_shallow_swap || message1->GetArenaForAllocation() == message2->GetArenaForAllocation()); + const Message* prototype = + message_factory_->GetPrototype(message1->GetDescriptor()); for (const auto* field : fields) { CheckInvalidAccess(schema_, field); if (field->is_extension()) { @@ -995,7 +1006,7 @@ void Reflection::SwapFieldsImpl( MutableExtensionSet(message2), field->number()); } else { MutableExtensionSet(message1)->SwapExtension( - MutableExtensionSet(message2), field->number()); + prototype, MutableExtensionSet(message2), field->number()); } } else { if (schema_.InRealOneof(field)) { @@ -1604,6 +1615,7 @@ TProtoStringType Reflection::GetString(const Message& message, const TProtoStringType& Reflection::GetStringReference(const Message& message, const FieldDescriptor* field, TProtoStringType* scratch) const { + (void)scratch; // Parameter is used by Google-internal code. USAGE_CHECK_ALL(GetStringReference, SINGULAR, STRING); if (field->is_extension()) { return GetExtensionSet(message).GetString(field->number(), @@ -1692,6 +1704,7 @@ TProtoStringType Reflection::GetRepeatedString(const Message& message, const TProtoStringType& Reflection::GetRepeatedStringReference( const Message& message, const FieldDescriptor* field, int index, TProtoStringType* scratch) const { + (void)scratch; // Parameter is used by Google-internal code. USAGE_CHECK_ALL(GetRepeatedStringReference, REPEATED, STRING); if (field->is_extension()) { return GetExtensionSet(message).GetRepeatedString(field->number(), index); @@ -2231,6 +2244,7 @@ void* Reflection::MutableRawRepeatedField(Message* message, FieldDescriptor::CppType cpptype, int ctype, const Descriptor* desc) const { + (void)ctype; // Parameter is used by Google-internal code. USAGE_CHECK_REPEATED("MutableRawRepeatedField"); CheckInvalidAccess(schema_, field); @@ -2508,9 +2522,13 @@ bool Reflection::HasBit(const Message& message, case FieldDescriptor::CPPTYPE_UINT64: return GetRaw<arc_ui64>(message, field) != 0; case FieldDescriptor::CPPTYPE_FLOAT: - return GetRaw<float>(message, field) != 0.0; + static_assert(sizeof(arc_ui32) == sizeof(float), + "Code assumes arc_ui32 and float are the same size."); + return GetRaw<arc_ui32>(message, field) != 0; case FieldDescriptor::CPPTYPE_DOUBLE: - return GetRaw<double>(message, field) != 0.0; + static_assert(sizeof(arc_ui64) == sizeof(double), + "Code assumes arc_ui64 and double are the same size."); + return GetRaw<arc_ui64>(message, field) != 0; case FieldDescriptor::CPPTYPE_ENUM: return GetRaw<int>(message, field) != 0; case FieldDescriptor::CPPTYPE_MESSAGE: @@ -2620,19 +2638,19 @@ void Reflection::ClearOneof(Message* message, } } -#define HANDLE_TYPE(TYPE, CPPTYPE, CTYPE) \ - template <> \ - const RepeatedField<TYPE>& Reflection::GetRepeatedFieldInternal<TYPE>( \ - const Message& message, const FieldDescriptor* field) const { \ - return *static_cast<RepeatedField<TYPE>*>(MutableRawRepeatedField( \ - const_cast<Message*>(&message), field, CPPTYPE, CTYPE, NULL)); \ - } \ - \ - template <> \ - RepeatedField<TYPE>* Reflection::MutableRepeatedFieldInternal<TYPE>( \ - Message * message, const FieldDescriptor* field) const { \ - return static_cast<RepeatedField<TYPE>*>( \ - MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, NULL)); \ +#define HANDLE_TYPE(TYPE, CPPTYPE, CTYPE) \ + template <> \ + const RepeatedField<TYPE>& Reflection::GetRepeatedFieldInternal<TYPE>( \ + const Message& message, const FieldDescriptor* field) const { \ + return *static_cast<RepeatedField<TYPE>*>(MutableRawRepeatedField( \ + const_cast<Message*>(&message), field, CPPTYPE, CTYPE, nullptr)); \ + } \ + \ + template <> \ + RepeatedField<TYPE>* Reflection::MutableRepeatedFieldInternal<TYPE>( \ + Message * message, const FieldDescriptor* field) const { \ + return static_cast<RepeatedField<TYPE>*>( \ + MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, nullptr)); \ } HANDLE_TYPE(arc_i32, FieldDescriptor::CPPTYPE_INT32, -1); @@ -2649,9 +2667,10 @@ HANDLE_TYPE(bool, FieldDescriptor::CPPTYPE_BOOL, -1); void* Reflection::MutableRawRepeatedString(Message* message, const FieldDescriptor* field, bool is_string) const { + (void)is_string; // Parameter is used by Google-internal code. return MutableRawRepeatedField(message, field, FieldDescriptor::CPPTYPE_STRING, - FieldOptions::STRING, NULL); + FieldOptions::STRING, nullptr); } // Template implementations of basic accessors. Inline because each @@ -3003,7 +3022,7 @@ void RegisterFileLevelMetadata(const DescriptorTable* table) { } void UnknownFieldSetSerializer(const uint8_t* base, arc_ui32 offset, - arc_ui32 tag, arc_ui32 has_offset, + arc_ui32 /*tag*/, arc_ui32 /*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_table_driven.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_table_driven.cc index 487fd0d145..8db7780c88 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 @@ -74,14 +74,14 @@ struct UnknownFieldHandler { static bool ParseExtension(MessageLite* msg, const ParseTable& table, io::CodedInputStream* input, int tag) { ExtensionSet* extensions = GetExtensionSet(msg, table.extension_offset); - if (extensions == NULL) { + if (extensions == nullptr) { return false; } const Message* prototype = down_cast<const Message*>(table.default_instance()); - GOOGLE_DCHECK(prototype != NULL); + GOOGLE_DCHECK(prototype != nullptr); GOOGLE_DCHECK(table.unknown_field_set); UnknownFieldSet* unknown_fields = MutableUnknownFields(msg, table.arena_offset); 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 32192965d5..462fb28c25 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 @@ -267,9 +267,10 @@ inline void TableSerialize(const MessageLite& msg, } PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base, - const FieldMetadata* table, - arc_i32 num_fields, bool is_deterministic, - uint8_t* buffer); + const FieldMetadata* table, + arc_i32 num_fields, + bool is_deterministic, + uint8_t* buffer); inline uint8_t* TableSerializeToArray(const MessageLite& msg, const SerializationTable* table, 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 b8261bab0a..ed0a3d4d19 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 @@ -78,7 +78,7 @@ struct UnknownFieldHandlerLite { static bool ParseExtension(MessageLite* msg, const ParseTable& table, io::CodedInputStream* input, int tag) { ExtensionSet* extensions = GetExtensionSet(msg, table.extension_offset); - if (extensions == NULL) { + if (extensions == nullptr) { return false; } 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 4965411bcd..50a619ee93 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 @@ -83,7 +83,7 @@ inline const Type* Raw(const MessageLite* msg, arc_i64 offset) { inline ExtensionSet* GetExtensionSet(MessageLite* msg, arc_i64 extension_offset) { if (extension_offset == -1) { - return NULL; + return nullptr; } return Raw<ExtensionSet>(msg, extension_offset); @@ -148,7 +148,7 @@ inline void ClearOneofField(const ParseTableField& field, Arena* arena, MessageLite* msg) { switch (field.processing_type & kTypeMask) { case WireFormatLite::TYPE_MESSAGE: - if (arena == NULL) { + if (arena == nullptr) { delete *Raw<MessageLite*>(msg, field.offset); } break; @@ -161,7 +161,7 @@ inline void ClearOneofField(const ParseTableField& field, Arena* arena, case TYPE_STRING_INLINED: case TYPE_BYTES_INLINED: - Raw<InlinedStringField>(msg, field.offset)->DestroyNoArena(NULL); + Raw<InlinedStringField>(msg, field.offset)->DestroyNoArena(nullptr); break; default: @@ -343,15 +343,12 @@ class RepeatedMessageTypeHandler { typedef MessageLite Type; typedef MessageLite WeakType; static Arena* GetArena(Type* t) { return t->GetArena(); } - static void* GetMaybeArenaPointer(Type* t) { - return t->GetMaybeArenaPointer(); - } static inline Type* NewFromPrototype(const Type* prototype, - Arena* arena = NULL) { + Arena* arena = nullptr) { return prototype->New(arena); } - static void Delete(Type* t, Arena* arena = NULL) { - if (arena == NULL) { + static void Delete(Type* t, Arena* arena = nullptr) { + if (arena == nullptr) { delete t; } } @@ -376,7 +373,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, // TODO(ckennelly): Make this a compile-time parameter with templates. GOOGLE_DCHECK_GE(table.has_bits_offset, 0); arc_ui32* has_bits = Raw<arc_ui32>(msg, table.has_bits_offset); - GOOGLE_DCHECK(has_bits != NULL); + GOOGLE_DCHECK(has_bits != nullptr); while (true) { arc_ui32 tag = input->ReadTagWithCutoffNoLastTag(kMaxTag).first; @@ -623,7 +620,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, MutableField<MessageLite*>(msg, has_bits, presence_index, offset); MessageLite* submsg = *submsg_holder; - if (submsg == NULL) { + if (submsg == nullptr) { Arena* const arena = msg->GetArena(); const MessageLite* prototype = table.aux[field_number].messages.default_message(); @@ -642,7 +639,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, RepeatedPtrFieldBase* field = Raw<RepeatedPtrFieldBase>(msg, offset); const MessageLite* prototype = table.aux[field_number].messages.default_message(); - GOOGLE_DCHECK(prototype != NULL); + GOOGLE_DCHECK(prototype != nullptr); MessageLite* submsg = MergePartialFromCodedStreamHelper::Add(field, prototype); @@ -659,11 +656,11 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, MutableField<MessageLite*>(msg, has_bits, presence_index, offset); MessageLite* submsg = *submsg_holder; - if (submsg == NULL) { + if (submsg == nullptr) { Arena* const arena = msg->GetArena(); const MessageLite* prototype = table.aux[field_number].messages.default_message(); - if (prototype == NULL) { + if (prototype == nullptr) { prototype = ImplicitWeakMessage::default_instance(); } submsg = prototype->New(arena); @@ -683,7 +680,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, RepeatedPtrFieldBase* field = Raw<RepeatedPtrFieldBase>(msg, offset); const MessageLite* prototype = table.aux[field_number].messages.default_message(); - if (prototype == NULL) { + if (prototype == nullptr) { prototype = ImplicitWeakMessage::default_instance(); } @@ -703,7 +700,7 @@ bool MergePartialFromCodedStreamInlined(MessageLite* msg, MessageLite** submsg_holder = Raw<MessageLite*>(msg, offset); ResetOneofField<ProcessingType_MESSAGE>( table, field_number, arena, msg, oneof_case + presence_index, - offset, NULL); + offset, nullptr); MessageLite* submsg = *submsg_holder; if (PROTOBUF_PREDICT_FALSE( 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 5a6b60b92d..84c3e715dd 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 @@ -65,39 +65,42 @@ struct TcFieldData { arc_ui64 data; }; -struct TailCallParseTableBase; +struct TcParseTableBase; // TailCallParseFunc is the function pointer type used in the tailcall table. 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. +// TcParseTableBase 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 alignas(arc_ui64) TailCallParseTableBase { +struct alignas(arc_ui64) TcParseTableBase { // Common attributes for message layout: uint16_t has_bits_offset; uint16_t extension_offset; arc_ui32 extension_range_low; arc_ui32 extension_range_high; + uint8_t fast_idx_mask; + uint8_t reserved; + uint16_t num_fields; const MessageLite* default_instance; // Handler for fields which are not handled by table dispatch. TailCallParseFunc fallback; // Table entry for fast-path tailcall dispatch handling. - struct FieldEntry { + struct FastFieldEntry { // Target function for dispatch: TailCallParseFunc target; // Field data used during parse: TcFieldData bits; }; // There is always at least one table entry. - const FieldEntry* table() const { - return reinterpret_cast<const FieldEntry*>(this + 1); + const FastFieldEntry* fast_entry(size_t idx) const { + return reinterpret_cast<const FastFieldEntry*>(this + 1) + idx; } }; @@ -105,12 +108,12 @@ struct alignas(arc_ui64) TailCallParseTableBase { #pragma warning(pop) #endif -static_assert(sizeof(TailCallParseTableBase::FieldEntry) <= 16, +static_assert(sizeof(TcParseTableBase::FastFieldEntry) <= 16, "Field entry is too big."); -template <size_t kTableSizeLog2> -struct TailCallParseTable { - TailCallParseTableBase header; +template <size_t kFastTableSizeLog2> +struct TcParseTable { + TcParseTableBase header; // Entries for each field. // @@ -118,15 +121,14 @@ struct TailCallParseTable { // number is masked to fit inside the table. Note that the parsing logic // generally calls `TailCallParseTableBase::table()` instead of accessing // this field directly. - TailCallParseTableBase::FieldEntry entries[(1 << kTableSizeLog2)]; + TcParseTableBase::FastFieldEntry entries[(1 << kFastTableSizeLog2)]; }; -static_assert(std::is_standard_layout<TailCallParseTable<1>>::value, - "TailCallParseTable must be standard layout."); +static_assert(std::is_standard_layout<TcParseTable<1>>::value, + "TcParseTable must be standard layout."); -static_assert(offsetof(TailCallParseTable<1>, entries) == - sizeof(TailCallParseTableBase), - "Table entries must be laid out after TailCallParseTableBase."); +static_assert(offsetof(TcParseTable<1>, entries) == sizeof(TcParseTableBase), + "Table entries must be laid out after TcParseTableBase."); } // namespace internal } // namespace protobuf diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_full.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_full.cc new file mode 100644 index 0000000000..44dcddc796 --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_full.cc @@ -0,0 +1,53 @@ +// 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 <cstdint> + +#include <google/protobuf/parse_context.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/generated_message_tctable_impl.h> +#include <google/protobuf/message.h> +#include <google/protobuf/unknown_field_set.h> + +// clang-format off +#include <google/protobuf/port_def.inc> +// clang-format on + +namespace google { +namespace protobuf { +namespace internal { + +const char* TcParser::GenericFallback(PROTOBUF_TC_PARAM_DECL) { + return GenericFallbackImpl<Message, UnknownFieldSet>(PROTOBUF_TC_PARAM_PASS); +} + +} // namespace internal +} // namespace protobuf +} // namespace google 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 d7023c8dac..11c5c8660c 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 @@ -69,28 +69,28 @@ namespace internal { #define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) MESSAGE::Tct_ParseS1 #else #define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) \ - ::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint8_t> + ::google::protobuf::internal::TcParser::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> + ::google::protobuf::internal::TcParser::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> + ::google::protobuf::internal::TcParser::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> + ::google::protobuf::internal::TcParser::RepeatedParseMessage<MESSAGE, uint16_t> #endif // PROTOBUF_TC_STATIC_PARSE_REPEATED2 #ifndef NDEBUG @@ -106,11 +106,52 @@ extern template void AlignFail<4>(uintptr_t); extern template void AlignFail<8>(uintptr_t); #endif -class TcParserBase { +// TcParser implements most of the parsing logic for tailcall tables. +class TcParser final { public: static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL); static const char* GenericFallbackLite(PROTOBUF_TC_PARAM_DECL); + // Dispatch to the designated parse function + inline PROTOBUF_ALWAYS_INLINE static const char* TagDispatch( + PROTOBUF_TC_PARAM_DECL) { + const auto coded_tag = UnalignedLoad<uint16_t>(ptr); + const size_t idx = coded_tag & table->fast_idx_mask; + PROTOBUF_ASSUME((idx & 7) == 0); + auto* fast_entry = table->fast_entry(idx >> 3); + data = fast_entry->bits; + data.data ^= coded_tag; + PROTOBUF_MUSTTAIL return fast_entry->target(PROTOBUF_TC_PARAM_PASS); + } + + // We can only safely call from field to next field if the call is optimized + // to a proper tail call. Otherwise we blow through stack. Clang and gcc + // reliably do this optimization in opt mode, but do not perform this in debug + // mode. Luckily the structure of the algorithm is such that it's always + // possible to just return and use the enclosing parse loop as a trampoline. + static const char* ToTagDispatch(PROTOBUF_TC_PARAM_DECL) { + constexpr bool always_return = !PROTOBUF_TAILCALL; + if (always_return || !ctx->DataAvailable(ptr)) { + PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_PASS); + } + PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_PASS); + } + + static const char* ParseLoop(MessageLite* msg, const char* ptr, + ParseContext* ctx, + const TcParseTableBase* table) { + ScopedArenaSwap saved(msg, ctx); + const arc_ui32 has_bits_offset = table->has_bits_offset; + while (!ctx->Done(&ptr)) { + arc_ui64 hasbits = 0; + if (has_bits_offset) hasbits = RefAt<arc_ui32>(msg, has_bits_offset); + ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {}); + if (ptr == nullptr) break; + if (ctx->LastTag() != 1) break; // Ended on terminating tag + } + return ptr; + } + template <typename FieldType, typename TagType> PROTOBUF_NOINLINE static const char* SingularParseMessage( PROTOBUF_TC_PARAM_DECL) { @@ -146,12 +187,16 @@ class TcParserBase { } template <typename LayoutType, typename TagType> + static const char* SingularFixed(PROTOBUF_TC_PARAM_DECL); + template <typename LayoutType, typename TagType> static const char* RepeatedFixed(PROTOBUF_TC_PARAM_DECL); template <typename LayoutType, typename TagType> static const char* PackedFixed(PROTOBUF_TC_PARAM_DECL); enum VarintDecode { kNoConversion = 0, kZigZag = 1 }; template <typename FieldType, typename TagType, VarintDecode zigzag> + static const char* SingularVarint(PROTOBUF_TC_PARAM_DECL); + template <typename FieldType, typename TagType, VarintDecode zigzag> static const char* RepeatedVarint(PROTOBUF_TC_PARAM_DECL); template <typename FieldType, typename TagType, VarintDecode zigzag> static const char* PackedVarint(PROTOBUF_TC_PARAM_DECL); @@ -175,7 +220,7 @@ class TcParserBase { } static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits( - MessageLite* msg, arc_ui64 hasbits, const TailCallParseTableBase* table) { + MessageLite* msg, arc_ui64 hasbits, const TcParseTableBase* table) { const arc_ui32 has_bits_offset = table->has_bits_offset; if (has_bits_offset) { // Only the first 32 has-bits are updated. Nothing above those is stored, @@ -185,14 +230,19 @@ class TcParserBase { } protected: - static inline PROTOBUF_ALWAYS_INLINE const char* Return( + static inline PROTOBUF_ALWAYS_INLINE const char* ToParseLoop( PROTOBUF_TC_PARAM_DECL) { + (void)data; + (void)ctx; SyncHasbits(msg, hasbits, table); return ptr; } static inline PROTOBUF_ALWAYS_INLINE const char* Error( PROTOBUF_TC_PARAM_DECL) { + (void)data; + (void)ctx; + (void)ptr; SyncHasbits(msg, hasbits, table); return nullptr; } @@ -224,6 +274,7 @@ class TcParserBase { ctx->SetLastTag(tag); return ptr; } + (void)data; arc_ui32 num = tag >> 3; if (table->extension_range_low <= num && num <= table->extension_range_high) { @@ -239,59 +290,6 @@ class TcParserBase { } }; -// TcParser implements most of the parsing logic for tailcall tables. -// -// This is templated on lg2(table size), since dispatching depends upon the size -// of the table. The template parameter avoids runtime overhead for computing -// the table entry index. -template <arc_ui32 kPowerOf2> -struct TcParser final : TcParserBase { - // Dispatch to the designated parse function - inline PROTOBUF_ALWAYS_INLINE static const char* TagDispatch( - PROTOBUF_TC_PARAM_DECL) { - const auto coded_tag = UnalignedLoad<uint16_t>(ptr); - constexpr size_t kIdxMask = ((1 << (kPowerOf2)) - 1); - const size_t idx = (coded_tag >> 3) & kIdxMask; - data = table->table()[idx].bits; - data.data ^= coded_tag; - PROTOBUF_MUSTTAIL return table->table()[idx].target(PROTOBUF_TC_PARAM_PASS); - } - - // We can only safely call from field to next field if the call is optimized - // to a proper tail call. Otherwise we blow through stack. Clang and gcc - // reliably do this optimization in opt mode, but do not perform this in debug - // mode. Luckily the structure of the algorithm is such that it's always - // possible to just return and use the enclosing parse loop as a trampoline. - static const char* TailCall(PROTOBUF_TC_PARAM_DECL) { - constexpr bool always_return = !PROTOBUF_TAILCALL; - if (always_return || !ctx->DataAvailable(ptr)) { - PROTOBUF_MUSTTAIL return Return(PROTOBUF_TC_PARAM_PASS); - } - PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_PASS); - } - - static const char* ParseLoop(MessageLite* msg, const char* ptr, - ParseContext* ctx, - const TailCallParseTableBase* table) { - ScopedArenaSwap saved(msg, ctx); - const arc_ui32 has_bits_offset = table->has_bits_offset; - while (!ctx->Done(&ptr)) { - arc_ui64 hasbits = 0; - if (has_bits_offset) hasbits = RefAt<arc_ui32>(msg, has_bits_offset); - ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {}); - if (ptr == nullptr) break; - if (ctx->LastTag() != 1) break; // Ended on terminating tag - } - return ptr; - } - - template <typename LayoutType, typename TagType> - static const char* SingularFixed(PROTOBUF_TC_PARAM_DECL); - - template <typename FieldType, typename TagType, VarintDecode zigzag> - static const char* SingularVarint(PROTOBUF_TC_PARAM_DECL); -}; - // Declare helper functions: #include <google/protobuf/generated_message_tctable_impl.inc> 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 2eddd8f038..a02e65e2c0 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 @@ -34,120 +34,59 @@ #else #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<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_i32, 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<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL); -PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<arc_i32, 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); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<arc_ui64, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<arc_ui32, uint8_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_ui64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_ui32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_i64, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_i32, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<arc_ui64, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<arc_ui32, uint16_t>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_ui64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_ui32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_i64, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<arc_i32, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); +PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL); #undef PROTOBUF_TCT_EXTERN // clang-format on diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_lite.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_lite.cc new file mode 100644 index 0000000000..35071abd76 --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_tctable_lite.cc @@ -0,0 +1,456 @@ +// 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 <cstdint> + +#include <google/protobuf/parse_context.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/generated_message_tctable_decl.h> +#include <google/protobuf/generated_message_tctable_impl.h> +#include <google/protobuf/message_lite.h> +#include <google/protobuf/wire_format_lite.h> + +// clang-format off +#include <google/protobuf/port_def.inc> +// clang-format on + +namespace google { +namespace protobuf { +namespace internal { + +#ifndef NDEBUG +template void AlignFail<4>(uintptr_t); +template void AlignFail<8>(uintptr_t); +#endif + +const char* TcParser::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) { + return GenericFallbackImpl<MessageLite, TProtoStringType>(PROTOBUF_TC_PARAM_PASS); +} + +namespace { + +// Offset returns the address `offset` bytes after `base`. +inline void* Offset(void* base, arc_ui32 offset) { + return static_cast<uint8_t*>(base) + offset; +} + +// InvertPacked changes tag bits from the given wire type to length +// delimited. This is the difference expected between packed and non-packed +// repeated fields. +template <WireFormatLite::WireType Wt> +inline PROTOBUF_ALWAYS_INLINE void InvertPacked(TcFieldData& data) { + data.data ^= Wt ^ WireFormatLite::WIRETYPE_LENGTH_DELIMITED; +} + +} // namespace + +////////////////////////////////////////////////////////////////////////////// +// Fixed fields +////////////////////////////////////////////////////////////////////////////// + +template <typename LayoutType, typename TagType> +const char* TcParser::SingularFixed(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + ptr += sizeof(TagType); // Consume tag + hasbits |= (arc_ui64{1} << data.hasbit_idx()); + std::memcpy(Offset(msg, data.offset()), ptr, sizeof(LayoutType)); + ptr += sizeof(LayoutType); + PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS); +} + +template <typename LayoutType, typename TagType> +const char* TcParser::RepeatedFixed(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + // Check if the field can be parsed as packed repeated: + constexpr WireFormatLite::WireType fallback_wt = + sizeof(LayoutType) == 4 ? WireFormatLite::WIRETYPE_FIXED32 + : WireFormatLite::WIRETYPE_FIXED64; + InvertPacked<fallback_wt>(data); + if (data.coded_tag<TagType>() == 0) { + return PackedFixed<LayoutType, TagType>(PROTOBUF_TC_PARAM_PASS); + } else { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + } + auto& field = RefAt<RepeatedField<LayoutType>>(msg, data.offset()); + int idx = field.size(); + auto elem = field.Add(); + int space = field.Capacity() - idx; + idx = 0; + auto expected_tag = UnalignedLoad<TagType>(ptr); + do { + ptr += sizeof(TagType); + std::memcpy(elem + (idx++), ptr, sizeof(LayoutType)); + ptr += sizeof(LayoutType); + if (idx >= space) break; + if (!ctx->DataAvailable(ptr)) break; + } while (UnalignedLoad<TagType>(ptr) == expected_tag); + field.AddNAlreadyReserved(idx - 1); + return ToParseLoop(PROTOBUF_TC_PARAM_PASS); +} + +template <typename LayoutType, typename TagType> +const char* TcParser::PackedFixed(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + // Try parsing as non-packed repeated: + constexpr WireFormatLite::WireType fallback_wt = + sizeof(LayoutType) == 4 ? WireFormatLite::WIRETYPE_FIXED32 + : WireFormatLite::WIRETYPE_FIXED64; + InvertPacked<fallback_wt>(data); + if (data.coded_tag<TagType>() == 0) { + return RepeatedFixed<LayoutType, TagType>(PROTOBUF_TC_PARAM_PASS); + } else { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + } + ptr += sizeof(TagType); + // Since ctx->ReadPackedFixed does not use TailCall<> or Return<>, sync any + // pending hasbits now: + SyncHasbits(msg, hasbits, table); + auto& field = RefAt<RepeatedField<LayoutType>>(msg, data.offset()); + int size = ReadSize(&ptr); + // TODO(dlj): add a tailcalling variant of ReadPackedFixed. + return ctx->ReadPackedFixed(ptr, size, + static_cast<RepeatedField<LayoutType>*>(&field)); +} + +////////////////////////////////////////////////////////////////////////////// +// Varint fields +////////////////////////////////////////////////////////////////////////////// + +namespace { + +inline PROTOBUF_ALWAYS_INLINE std::pair<const char*, arc_ui64> +Parse64FallbackPair(const char* p, arc_i64 res1) { + auto ptr = reinterpret_cast<const int8_t*>(p); + + // The algorithm relies on sign extension for each byte to set all high bits + // when the varint continues. It also relies on asserting all of the lower + // bits for each successive byte read. This allows the result to be aggregated + // using a bitwise AND. For example: + // + // 8 1 64 57 ... 24 17 16 9 8 1 + // ptr[0] = 1aaa aaaa ; res1 = 1111 1111 ... 1111 1111 1111 1111 1aaa aaaa + // ptr[1] = 1bbb bbbb ; res2 = 1111 1111 ... 1111 1111 11bb bbbb b111 1111 + // ptr[2] = 1ccc cccc ; res3 = 0000 0000 ... 000c cccc cc11 1111 1111 1111 + // --------------------------------------------- + // res1 & res2 & res3 = 0000 0000 ... 000c cccc ccbb bbbb baaa aaaa + // + // On x86-64, a shld from a single register filled with enough 1s in the high + // bits can accomplish all this in one instruction. It so happens that res1 + // has 57 high bits of ones, which is enough for the largest shift done. + GOOGLE_DCHECK_EQ(res1 >> 7, -1); + arc_ui64 ones = res1; // save the high 1 bits from res1 (input to SHLD) + arc_ui64 byte; // the "next" 7-bit chunk, shifted (result from SHLD) + arc_i64 res2, res3; // accumulated result chunks +#define SHLD(n) byte = ((byte << (n * 7)) | (ones >> (64 - (n * 7)))) + + int sign_bit; +#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) + // For the first two rounds (ptr[1] and ptr[2]), micro benchmarks show a + // substantial improvement from capturing the sign from the condition code + // register on x86-64. +#define SHLD_SIGN(n) \ + asm("shldq %3, %2, %1" \ + : "=@ccs"(sign_bit), "+r"(byte) \ + : "r"(ones), "i"(n * 7)) +#else + // Generic fallback: +#define SHLD_SIGN(n) \ + do { \ + SHLD(n); \ + sign_bit = static_cast<arc_i64>(byte) < 0; \ + } while (0) +#endif + + byte = ptr[1]; + SHLD_SIGN(1); + res2 = byte; + if (!sign_bit) goto done2; + byte = ptr[2]; + SHLD_SIGN(2); + res3 = byte; + if (!sign_bit) goto done3; + +#undef SHLD_SIGN + + // For the remainder of the chunks, check the sign of the AND result. + byte = ptr[3]; + SHLD(3); + res1 &= byte; + if (res1 >= 0) goto done4; + byte = ptr[4]; + SHLD(4); + res2 &= byte; + if (res2 >= 0) goto done5; + byte = ptr[5]; + SHLD(5); + res3 &= byte; + if (res3 >= 0) goto done6; + byte = ptr[6]; + SHLD(6); + res1 &= byte; + if (res1 >= 0) goto done7; + byte = ptr[7]; + SHLD(7); + res2 &= byte; + if (res2 >= 0) goto done8; + byte = ptr[8]; + SHLD(8); + res3 &= byte; + if (res3 >= 0) goto done9; + +#undef SHLD + + // For valid 64bit varints, the 10th byte/ptr[9] should be exactly 1. In this + // case, the continuation bit of ptr[8] already set the top bit of res3 + // correctly, so all we have to do is check that the expected case is true. + byte = ptr[9]; + if (PROTOBUF_PREDICT_TRUE(byte == 1)) goto done10; + + // A value of 0, however, represents an over-serialized varint. This case + // should not happen, but if does (say, due to a nonconforming serializer), + // deassert the continuation bit that came from ptr[8]. + if (byte == 0) { + res3 ^= static_cast<arc_ui64>(1) << 63; + goto done10; + } + + // If the 10th byte/ptr[9] itself has any other value, then it is too big to + // fit in 64 bits. If the continue bit is set, it is an unterminated varint. + return {nullptr, 0}; + +#define DONE(n) done##n : return {p + n, res1 & res2 & res3}; +done2: + return {p + 2, res1 & res2}; + DONE(3) + DONE(4) + DONE(5) + DONE(6) + DONE(7) + DONE(8) + DONE(9) + DONE(10) +#undef DONE +} + +inline PROTOBUF_ALWAYS_INLINE const char* ParseVarint(const char* p, + arc_ui64* value) { + arc_i64 byte = static_cast<int8_t>(*p); + if (PROTOBUF_PREDICT_TRUE(byte >= 0)) { + *value = byte; + return p + 1; + } else { + auto tmp = Parse64FallbackPair(p, byte); + if (PROTOBUF_PREDICT_TRUE(tmp.first)) *value = tmp.second; + return tmp.first; + } +} + +template <typename FieldType, + TcParser::VarintDecode = TcParser::VarintDecode::kNoConversion> +FieldType ZigZagDecodeHelper(arc_ui64 value) { + return static_cast<FieldType>(value); +} + +template <> +arc_i32 ZigZagDecodeHelper<arc_i32, TcParser::VarintDecode::kZigZag>( + arc_ui64 value) { + return WireFormatLite::ZigZagDecode32(value); +} + +template <> +arc_i64 ZigZagDecodeHelper<arc_i64, TcParser::VarintDecode::kZigZag>( + arc_ui64 value) { + return WireFormatLite::ZigZagDecode64(value); +} + +} // namespace + +template <typename FieldType, typename TagType, TcParser::VarintDecode zigzag> +const char* TcParser::SingularVarint(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + ptr += sizeof(TagType); // Consume tag + hasbits |= (arc_ui64{1} << data.hasbit_idx()); + arc_ui64 tmp; + ptr = ParseVarint(ptr, &tmp); + if (ptr == nullptr) { + return Error(PROTOBUF_TC_PARAM_PASS); + } + RefAt<FieldType>(msg, data.offset()) = + ZigZagDecodeHelper<FieldType, zigzag>(tmp); + PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS); +} + +template <typename FieldType, typename TagType, TcParser::VarintDecode zigzag> +PROTOBUF_NOINLINE const char* TcParser::RepeatedVarint(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + // Try parsing as non-packed repeated: + InvertPacked<WireFormatLite::WIRETYPE_VARINT>(data); + if (data.coded_tag<TagType>() == 0) { + return PackedVarint<FieldType, TagType, zigzag>(PROTOBUF_TC_PARAM_PASS); + } else { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + } + auto& field = RefAt<RepeatedField<FieldType>>(msg, data.offset()); + auto expected_tag = UnalignedLoad<TagType>(ptr); + do { + ptr += sizeof(TagType); + arc_ui64 tmp; + ptr = ParseVarint(ptr, &tmp); + if (ptr == nullptr) { + return Error(PROTOBUF_TC_PARAM_PASS); + } + field.Add(ZigZagDecodeHelper<FieldType, zigzag>(tmp)); + if (!ctx->DataAvailable(ptr)) { + break; + } + } while (UnalignedLoad<TagType>(ptr) == expected_tag); + return ToParseLoop(PROTOBUF_TC_PARAM_PASS); +} + +template <typename FieldType, typename TagType, TcParser::VarintDecode zigzag> +PROTOBUF_NOINLINE const char* TcParser::PackedVarint(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + InvertPacked<WireFormatLite::WIRETYPE_VARINT>(data); + if (data.coded_tag<TagType>() == 0) { + return RepeatedVarint<FieldType, TagType, zigzag>(PROTOBUF_TC_PARAM_PASS); + } else { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + } + ptr += sizeof(TagType); + // Since ctx->ReadPackedVarint does not use TailCall or Return, sync any + // pending hasbits now: + SyncHasbits(msg, hasbits, table); + auto* field = &RefAt<RepeatedField<FieldType>>(msg, data.offset()); + return ctx->ReadPackedVarint(ptr, [field](arc_ui64 varint) { + FieldType val; + if (zigzag) { + if (sizeof(FieldType) == 8) { + val = WireFormatLite::ZigZagDecode64(varint); + } else { + val = WireFormatLite::ZigZagDecode32(varint); + } + } else { + val = varint; + } + field->Add(val); + }); +} + +////////////////////////////////////////////////////////////////////////////// +// String/bytes fields +////////////////////////////////////////////////////////////////////////////// + +// Defined in wire_format_lite.cc +void PrintUTF8ErrorLog(const char* field_name, const char* operation_str, + bool emit_stacktrace); + +namespace { + +PROTOBUF_NOINLINE +const char* SingularStringParserFallback(ArenaStringPtr* s, const char* ptr, + EpsCopyInputStream* stream) { + int size = ReadSize(&ptr); + if (!ptr) return nullptr; + return stream->ReadString( + ptr, size, s->MutableNoArenaNoDefault(&GetEmptyStringAlreadyInited())); +} + +} // namespace + +template <typename TagType, TcParser::Utf8Type utf8> +const char* TcParser::SingularString(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + ptr += sizeof(TagType); + hasbits |= (arc_ui64{1} << data.hasbit_idx()); + auto& field = RefAt<ArenaStringPtr>(msg, data.offset()); + auto arena = ctx->data().arena; + if (arena) { + ptr = ctx->ReadArenaString(ptr, &field, arena); + } else { + ptr = SingularStringParserFallback(&field, ptr, ctx); + } + if (ptr == nullptr) return Error(PROTOBUF_TC_PARAM_PASS); + switch (utf8) { + case kNoUtf8: +#ifdef NDEBUG + case kUtf8ValidateOnly: +#endif + return ToParseLoop(PROTOBUF_TC_PARAM_PASS); + default: + if (PROTOBUF_PREDICT_TRUE(IsStructurallyValidUTF8(field.Get()))) { + return ToParseLoop(PROTOBUF_TC_PARAM_PASS); + } + PrintUTF8ErrorLog("unknown", "parsing", false); + return utf8 == kUtf8 ? Error(PROTOBUF_TC_PARAM_PASS) + : ToParseLoop(PROTOBUF_TC_PARAM_PASS); + } +} + +template <typename TagType, TcParser::Utf8Type utf8> +const char* TcParser::RepeatedString(PROTOBUF_TC_PARAM_DECL) { + if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) { + return table->fallback(PROTOBUF_TC_PARAM_PASS); + } + auto expected_tag = UnalignedLoad<TagType>(ptr); + auto& field = RefAt<RepeatedPtrField<TProtoStringType>>(msg, data.offset()); + do { + ptr += sizeof(TagType); + TProtoStringType* str = field.Add(); + ptr = InlineGreedyStringParser(str, ptr, ctx); + if (ptr == nullptr) { + return Error(PROTOBUF_TC_PARAM_PASS); + } + if (utf8 != kNoUtf8) { + if (PROTOBUF_PREDICT_FALSE(!IsStructurallyValidUTF8(*str))) { + PrintUTF8ErrorLog("unknown", "parsing", false); + if (utf8 == kUtf8) return Error(PROTOBUF_TC_PARAM_PASS); + } + } + if (!ctx->DataAvailable(ptr)) break; + } while (UnalignedLoad<TagType>(ptr) == expected_tag); + return ToParseLoop(PROTOBUF_TC_PARAM_PASS); +} + +#define PROTOBUF_TCT_SOURCE +#include <google/protobuf/generated_message_tctable_impl.inc> + +} // namespace internal +} // namespace protobuf +} // namespace google 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 d81f40a194..8db97d66ae 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.cc @@ -316,7 +316,7 @@ 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, - arc_i32 cached_size, + arc_i32 /*cached_size*/, io::CodedOutputStream* output) { const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg); SerializeInternal(base, field_table, num_fields, output); @@ -325,7 +325,7 @@ void SerializeMessageDispatch(const MessageLite& msg, // Helper to branch to fast path if possible void SerializeMessageDispatch(const MessageLite& msg, const FieldMetadata* field_table, int num_fields, - arc_i32 cached_size, ArrayOutput* output) { + arc_i32 /*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); @@ -523,7 +523,8 @@ struct PackedFieldHelper { template <> struct PackedFieldHelper<WireFormatLite::TYPE_STRING> { template <typename O> - static void Serialize(const void* field, const FieldMetadata& md, O* output) { + static void Serialize(const void* /*field*/, const FieldMetadata& md, + O* /*output*/) { GOOGLE_LOG(FATAL) << "Not implemented field number " << md.tag << " with type " << md.type; } @@ -591,12 +592,12 @@ bool IsNull<WireFormatLite::TYPE_BYTES>(const void* ptr) { template <> bool IsNull<WireFormatLite::TYPE_GROUP>(const void* ptr) { - return Get<const MessageLite*>(ptr) == NULL; + return Get<const MessageLite*>(ptr) == nullptr; } template <> bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) { - return Get<const MessageLite*>(ptr) == NULL; + return Get<const MessageLite*>(ptr) == nullptr; } @@ -701,13 +702,13 @@ uint8_t* SerializeInternalToArray(const uint8_t* base, // Special cases case FieldMetadata::kSpecial: { io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX); - io::CodedOutputStream output(&array_stream); - output.SetSerializationDeterministic(is_deterministic); + io::CodedOutputStream output_stream(&array_stream); + output_stream.SetSerializationDeterministic(is_deterministic); func = reinterpret_cast<SpecialSerializer>( const_cast<void*>(field_metadata.ptr)); func(base, field_metadata.offset, field_metadata.tag, - field_metadata.has_offset, &output); - array_output.ptr += output.ByteCount(); + field_metadata.has_offset, &output_stream); + array_output.ptr += output_stream.ByteCount(); } break; default: // __builtin_unreachable() @@ -726,7 +727,7 @@ void ExtensionSerializer(const MessageLite* extendee, const uint8_t* ptr, } void UnknownFieldSerializerLite(const uint8_t* ptr, arc_ui32 offset, - arc_ui32 tag, arc_ui32 has_offset, + arc_ui32 /*tag*/, arc_ui32 /*has_offset*/, io::CodedOutputStream* output) { output->WriteString( reinterpret_cast<const InternalMetadata*>(ptr + offset) @@ -739,7 +740,7 @@ MessageLite* DuplicateIfNonNullInternal(MessageLite* message) { ret->CheckTypeAndMergeFrom(*message); return ret; } else { - return NULL; + return nullptr; } } @@ -761,7 +762,7 @@ MessageLite* GetOwnedMessageInternal(Arena* message_arena, submessage_arena); GOOGLE_DCHECK(message_arena != submessage_arena); GOOGLE_DCHECK_EQ(submessage_arena, nullptr); - if (message_arena != NULL && submessage_arena == NULL) { + if (message_arena != nullptr && submessage_arena == nullptr) { message_arena->Own(submessage); return submessage; } else { 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 c9b59076b2..85c6205b7a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.h +++ b/contrib/libs/protobuf/src/google/protobuf/implicit_weak_message.h @@ -63,7 +63,6 @@ class PROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite { TProtoStringType GetTypeName() const override { return ""; } - MessageLite* New() const override { return new ImplicitWeakMessage; } MessageLite* New(Arena* arena) const override { return Arena::CreateMessage<ImplicitWeakMessage>(arena); } @@ -103,21 +102,18 @@ class ImplicitWeakTypeHandler { static constexpr bool Moveable = false; static inline MessageLite* NewFromPrototype(const MessageLite* prototype, - Arena* arena = NULL) { + Arena* arena = nullptr) { return prototype->New(arena); } static inline void Delete(MessageLite* value, Arena* arena) { - if (arena == NULL) { + if (arena == nullptr) { delete value; } } static inline Arena* GetArena(MessageLite* value) { return value->GetArena(); } - static inline void* GetMaybeArenaPointer(MessageLite* value) { - return value->GetArena(); - } static inline void Clear(MessageLite* value) { value->Clear(); } static void Merge(const MessageLite& from, MessageLite* to) { to->CheckTypeAndMergeFrom(from); diff --git a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h index ff18331e93..40dba70b45 100644 --- a/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/inlined_string_field.h @@ -199,12 +199,12 @@ class PROTOBUF_EXPORT InlinedStringField { arc_ui32* donating_states, arc_ui32 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 + // Own()'d by any arena. If the field is not set, this returns nullptr. The + // caller retains ownership. Clears this field back to nullptr 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( + PROTOBUF_NODISCARD TProtoStringType* Release(const TProtoStringType* default_value, + Arena* arena, bool donated); + PROTOBUF_NODISCARD TProtoStringType* ReleaseNonDefault( const TProtoStringType* default_value, Arena* arena); TProtoStringType* ReleaseNonDefaultNoArena(const TProtoStringType* default_value); @@ -248,9 +248,9 @@ class PROTOBUF_EXPORT InlinedStringField { 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|. + // Clears content, but keeps allocated TProtoStringType if arena != nullptr, 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); 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 136a09a75d..c209aeabad 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.cc @@ -946,7 +946,7 @@ CodedOutputStream::~CodedOutputStream() { Trim(); } uint8_t* CodedOutputStream::WriteStringWithSizeToArray(const TProtoStringType& str, uint8_t* target) { - GOOGLE_DCHECK_LE(str.size(), kuint32max); + GOOGLE_DCHECK_LE(str.size(), std::numeric_limits<arc_ui32>::max()); target = WriteVarint32ToArray(str.size(), target); return WriteStringToArray(str, 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 207bd501b3..3c44e0568c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/coded_stream.h @@ -116,6 +116,7 @@ #include <climits> #include <cstddef> #include <cstring> +#include <limits> #include <string> #include <type_traits> #include <utility> @@ -135,6 +136,10 @@ #include <machine/endian.h> // __BYTE_ORDER #elif defined(__FreeBSD__) #include <sys/endian.h> // __BYTE_ORDER +#elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)) +#include <sys/isa_defs.h> // __BYTE_ORDER +#elif defined(_AIX) || defined(__TOS_AIX__) +#include <sys/machine.h> // BYTE_ORDER #else #if !defined(__QNX__) #include <endian.h> // __BYTE_ORDER @@ -241,10 +246,10 @@ class PROTOBUF_EXPORT CodedInputStream { // responsible for ensuring that the buffer has sufficient space. // Read a 32-bit little-endian integer. static const uint8_t* ReadLittleEndian32FromArray(const uint8_t* buffer, - arc_ui32* value); + arc_ui32* value); // Read a 64-bit little-endian integer. static const uint8_t* ReadLittleEndian64FromArray(const uint8_t* buffer, - arc_ui64* value); + arc_ui64* value); // 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 @@ -314,7 +319,7 @@ class PROTOBUF_EXPORT CodedInputStream { // was not. PROTOBUF_ALWAYS_INLINE static const uint8_t* ExpectTagFromArray(const uint8_t* buffer, - arc_ui32 expected); + arc_ui32 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 @@ -687,7 +692,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { // 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_t* EnsureSpace(uint8_t* ptr) { + PROTOBUF_NODISCARD uint8_t* EnsureSpace(uint8_t* ptr) { if (PROTOBUF_PREDICT_FALSE(ptr >= end_)) { return EnsureSpaceFallback(ptr); } @@ -705,6 +710,9 @@ 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. +#ifndef NDEBUG + PROTOBUF_NOINLINE +#endif uint8_t* WriteRawMaybeAliased(const void* data, int size, uint8_t* ptr) { if (aliasing_enabled_) { return WriteAliasedRaw(data, size, ptr); @@ -714,7 +722,11 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { } - uint8_t* WriteStringMaybeAliased(arc_ui32 num, const TProtoStringType& s, uint8_t* ptr) { +#ifndef NDEBUG + PROTOBUF_NOINLINE +#endif + uint8_t* WriteStringMaybeAliased(arc_ui32 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)) { @@ -725,13 +737,14 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { std::memcpy(ptr, s.data(), size); return ptr + size; } - uint8_t* WriteBytesMaybeAliased(arc_ui32 num, const TProtoStringType& s, uint8_t* ptr) { + uint8_t* WriteBytesMaybeAliased(arc_ui32 num, const TProtoStringType& s, + uint8_t* ptr) { return WriteStringMaybeAliased(num, s, ptr); } template <typename T> PROTOBUF_ALWAYS_INLINE uint8_t* WriteString(arc_ui32 num, const T& s, - uint8_t* ptr) { + uint8_t* ptr) { std::ptrdiff_t size = s.size(); if (PROTOBUF_PREDICT_FALSE( size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) { @@ -743,49 +756,52 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { return ptr + size; } template <typename T> +#ifndef NDEBUG + PROTOBUF_NOINLINE +#endif uint8_t* WriteBytes(arc_ui32 num, const T& s, uint8_t* ptr) { return WriteString(num, s, ptr); } template <typename T> - PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt32Packed(int num, const T& r, int size, - uint8_t* 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_t* WriteUInt32Packed(int num, const T& r, int size, - uint8_t* 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_t* WriteSInt32Packed(int num, const T& r, int size, - uint8_t* 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_t* WriteInt64Packed(int num, const T& r, int size, - uint8_t* 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_t* WriteUInt64Packed(int num, const T& r, int size, - uint8_t* 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_t* WriteSInt64Packed(int num, const T& r, int size, - uint8_t* 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_t* WriteEnumPacked(int num, const T& r, int size, - uint8_t* ptr) { + uint8_t* ptr) { return WriteVarintPacked(num, r, size, ptr, Encode64); } template <typename T> PROTOBUF_ALWAYS_INLINE uint8_t* WriteFixedPacked(int num, const T& r, - uint8_t* ptr) { + uint8_t* ptr) { ptr = EnsureSpace(ptr); constexpr auto element_size = sizeof(typename T::value_type); auto size = r.size() * element_size; @@ -856,13 +872,14 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { : 5; } - PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(arc_ui32 num, arc_ui32 wt, uint8_t* ptr) { + PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(arc_ui32 num, arc_ui32 wt, + uint8_t* ptr) { GOOGLE_DCHECK(ptr < end_); // NOLINT return UnsafeVarint((num << 3) | wt, ptr); } PROTOBUF_ALWAYS_INLINE uint8_t* WriteLengthDelim(int num, arc_ui32 size, - uint8_t* ptr) { + uint8_t* ptr) { ptr = WriteTag(num, 2, ptr); return UnsafeWriteSize(size, ptr); } @@ -872,12 +889,13 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { uint8_t* WriteAliasedRaw(const void* data, int size, uint8_t* ptr); uint8_t* WriteStringMaybeAliasedOutline(arc_ui32 num, const TProtoStringType& s, - uint8_t* ptr); + uint8_t* ptr); uint8_t* WriteStringOutline(arc_ui32 num, const TProtoStringType& s, uint8_t* ptr); template <typename T, typename E> - PROTOBUF_ALWAYS_INLINE uint8_t* WriteVarintPacked(int num, const T& r, int size, - uint8_t* 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(); @@ -925,7 +943,7 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { } PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeWriteSize(arc_ui32 value, - uint8_t* ptr) { + uint8_t* ptr) { while (PROTOBUF_PREDICT_FALSE(value >= 0x80)) { *ptr = static_cast<uint8_t>(value | 0x80); value >>= 7; @@ -976,14 +994,14 @@ class PROTOBUF_EXPORT EpsCopyOutputStream { template <> inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<1>(const void* data, - int size, - uint8_t* ptr) { + int size, + uint8_t* ptr) { return WriteRaw(data, size, ptr); } template <> inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data, - int size, - uint8_t* ptr) { + int size, + uint8_t* ptr) { #ifdef PROTOBUF_LITTLE_ENDIAN return WriteRaw(data, size, ptr); #else @@ -992,8 +1010,8 @@ inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data, } template <> inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<8>(const void* data, - int size, - uint8_t* ptr) { + int size, + uint8_t* ptr) { #ifdef PROTOBUF_LITTLE_ENDIAN return WriteRaw(data, size, ptr); #else @@ -1117,7 +1135,8 @@ 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_t* WriteRawToArray(const void* buffer, int size, uint8_t* 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); @@ -1125,7 +1144,7 @@ class PROTOBUF_EXPORT CodedOutputStream { static uint8_t* WriteStringToArray(const TProtoStringType& str, uint8_t* target); // Write the varint-encoded size of str followed by str. static uint8_t* WriteStringWithSizeToArray(const TProtoStringType& str, - uint8_t* target); + uint8_t* target); // Write a 32-bit little-endian integer. @@ -1149,9 +1168,10 @@ class PROTOBUF_EXPORT CodedOutputStream { void WriteVarint32(arc_ui32 value); // Like WriteVarint32() but writing directly to the target array. static uint8_t* WriteVarint32ToArray(arc_ui32 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_t* WriteVarint32ToArrayOutOfLine(arc_ui32 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_t* WriteVarint32ToArrayOutOfLine(arc_ui32 value, + uint8_t* target); // Write an unsigned integer with Varint encoding. void WriteVarint64(arc_ui64 value); // Like WriteVarint64() but writing directly to the target array. @@ -1161,7 +1181,8 @@ class PROTOBUF_EXPORT CodedOutputStream { // in which case it must be sign-extended to a full 10 bytes. void WriteVarint32SignExtended(arc_i32 value); // Like WriteVarint32SignExtended() but writing directly to the target array. - static uint8_t* WriteVarint32SignExtendedToArray(arc_i32 value, uint8_t* target); + static uint8_t* WriteVarint32SignExtendedToArray(arc_i32 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 @@ -1272,7 +1293,8 @@ 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_t* WriteVarint32ToArrayOutOfLineHelper(arc_ui32 value, uint8_t* target); + static uint8_t* WriteVarint32ToArrayOutOfLineHelper(arc_ui32 value, + uint8_t* target); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedOutputStream); }; @@ -1341,13 +1363,13 @@ inline const uint8_t* CodedInputStream::ReadLittleEndian64FromArray( return buffer + sizeof(*value); #else arc_ui32 part0 = (static_cast<arc_ui32>(buffer[0])) | - (static_cast<arc_ui32>(buffer[1]) << 8) | - (static_cast<arc_ui32>(buffer[2]) << 16) | - (static_cast<arc_ui32>(buffer[3]) << 24); + (static_cast<arc_ui32>(buffer[1]) << 8) | + (static_cast<arc_ui32>(buffer[2]) << 16) | + (static_cast<arc_ui32>(buffer[3]) << 24); arc_ui32 part1 = (static_cast<arc_ui32>(buffer[4])) | - (static_cast<arc_ui32>(buffer[5]) << 8) | - (static_cast<arc_ui32>(buffer[6]) << 16) | - (static_cast<arc_ui32>(buffer[7]) << 24); + (static_cast<arc_ui32>(buffer[5]) << 8) | + (static_cast<arc_ui32>(buffer[6]) << 16) | + (static_cast<arc_ui32>(buffer[7]) << 24); *value = static_cast<arc_ui64>(part0) | (static_cast<arc_ui64>(part1) << 32); return buffer + sizeof(*value); #endif @@ -1464,8 +1486,8 @@ inline bool CodedInputStream::ExpectTag(arc_ui32 expected) { } } -inline const uint8_t* CodedInputStream::ExpectTagFromArray(const uint8_t* buffer, - arc_ui32 expected) { +inline const uint8_t* CodedInputStream::ExpectTagFromArray( + const uint8_t* buffer, arc_ui32 expected) { if (expected < (1 << 7)) { if (buffer[0] == expected) { return buffer + 1; @@ -1551,7 +1573,7 @@ inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input) last_tag_(0), legitimate_message_end_(false), aliasing_enabled_(false), - current_limit_(kint32max), + current_limit_(std::numeric_limits<arc_i32>::max()), buffer_size_after_limit_(0), total_bytes_limit_(kDefaultTotalBytesLimit), recursion_budget_(default_recursion_limit_), @@ -1599,7 +1621,7 @@ inline bool CodedInputStream::Skip(int count) { } inline uint8_t* CodedOutputStream::WriteVarint32ToArray(arc_ui32 value, - uint8_t* target) { + uint8_t* target) { return EpsCopyOutputStream::UnsafeVarint(value, target); } @@ -1614,7 +1636,7 @@ inline uint8_t* CodedOutputStream::WriteVarint32ToArrayOutOfLine( } inline uint8_t* CodedOutputStream::WriteVarint64ToArray(arc_ui64 value, - uint8_t* target) { + uint8_t* target) { return EpsCopyOutputStream::UnsafeVarint(value, target); } @@ -1628,7 +1650,7 @@ inline uint8_t* CodedOutputStream::WriteVarint32SignExtendedToArray( } inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(arc_ui32 value, - uint8_t* target) { + uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(target, &value, sizeof(value)); #else @@ -1641,7 +1663,7 @@ inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(arc_ui32 value, } inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(arc_ui64 value, - uint8_t* target) { + uint8_t* target) { #if defined(PROTOBUF_LITTLE_ENDIAN) memcpy(target, &value, sizeof(value)); #else @@ -1715,7 +1737,8 @@ inline size_t CodedOutputStream::VarintSize32SignExtended(arc_i32 value) { return VarintSize64(static_cast<arc_ui64>(arc_i64{value})); } -inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne(arc_i32 value) { +inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne( + arc_i32 value) { return VarintSize64PlusOne(static_cast<arc_ui64>(arc_i64{value})); } @@ -1729,13 +1752,13 @@ inline void CodedOutputStream::WriteRawMaybeAliased(const void* data, } inline uint8_t* CodedOutputStream::WriteRawToArray(const void* data, int size, - uint8_t* target) { + uint8_t* target) { memcpy(target, data, size); return target + size; } inline uint8_t* CodedOutputStream::WriteStringToArray(const TProtoStringType& str, - uint8_t* target) { + uint8_t* target) { return WriteRawToArray(str.data(), static_cast<int>(str.size()), target); } diff --git a/contrib/libs/protobuf/src/google/protobuf/io/io_win32.cc b/contrib/libs/protobuf/src/google/protobuf/io/io_win32.cc index c2684e5ac3..903cb36fc3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/io_win32.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/io_win32.cc @@ -266,7 +266,7 @@ int open(const char* path, int flags, int mode) { #endif } -int mkdir(const char* path, int _mode) { +int mkdir(const char* path, int /*_mode*/) { #ifdef SUPPORT_LONGPATHS wstring wpath; if (!as_windows_path(path, &wpath)) { diff --git a/contrib/libs/protobuf/src/google/protobuf/io/printer.h b/contrib/libs/protobuf/src/google/protobuf/io/printer.h index 720f732cfc..5407e0e454 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/printer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/printer.h @@ -82,9 +82,9 @@ class AnnotationProtoCollector : public AnnotationCollector { : annotation_proto_(annotation_proto) {} // Override for AnnotationCollector::AddAnnotation. - virtual void AddAnnotation(size_t begin_offset, size_t end_offset, - const TProtoStringType& file_path, - const std::vector<int>& path) override { + void AddAnnotation(size_t begin_offset, size_t end_offset, + const TProtoStringType& file_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) override { + 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 4acb29978c..1fdb036cc2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc @@ -224,6 +224,21 @@ Tokenizer::~Tokenizer() { } } +bool Tokenizer::report_whitespace() const { return report_whitespace_; } +// Note: `set_report_whitespace(false)` implies `set_report_newlines(false)`. +void Tokenizer::set_report_whitespace(bool report) { + report_whitespace_ = report; + report_newlines_ &= report; +} + +// If true, newline tokens are reported by Next(). +bool Tokenizer::report_newlines() const { return report_newlines_; } +// Note: `set_report_newlines(true)` implies `set_report_whitespace(true)`. +void Tokenizer::set_report_newlines(bool report) { + report_newlines_ = report; + report_whitespace_ |= report; // enable report_whitespace if necessary +} + // ------------------------------------------------------------------- // Internal helpers. @@ -560,13 +575,46 @@ Tokenizer::NextCommentStatus Tokenizer::TryConsumeCommentStart() { } } +bool Tokenizer::TryConsumeWhitespace() { + if (report_newlines_) { + if (TryConsumeOne<WhitespaceNoNewline>()) { + ConsumeZeroOrMore<WhitespaceNoNewline>(); + current_.type = TYPE_WHITESPACE; + return true; + } + return false; + } + if (TryConsumeOne<Whitespace>()) { + ConsumeZeroOrMore<Whitespace>(); + current_.type = TYPE_WHITESPACE; + return report_whitespace_; + } + return false; +} + +bool Tokenizer::TryConsumeNewline() { + if (!report_whitespace_ || !report_newlines_) { + return false; + } + if (TryConsume('\n')) { + current_.type = TYPE_NEWLINE; + return true; + } + return false; +} + // ------------------------------------------------------------------- bool Tokenizer::Next() { previous_ = current_; while (!read_error_) { - ConsumeZeroOrMore<Whitespace>(); + StartToken(); + bool report_token = TryConsumeWhitespace() || TryConsumeNewline(); + EndToken(); + if (report_token) { + return true; + } switch (TryConsumeCommentStart()) { case LINE_COMMENT: @@ -769,8 +817,9 @@ bool Tokenizer::NextWithComments(TProtoStringType* prev_trailing_comments, if (current_.type == TYPE_START) { // Ignore unicode byte order mark(BOM) if it appears at the file // beginning. Only UTF-8 BOM (0xEF 0xBB 0xBF) is accepted. - if (TryConsume((char)0xEF)) { - if (!TryConsume((char)0xBB) || !TryConsume((char)0xBF)) { + if (TryConsume(static_cast<char>(0xEF))) { + if (!TryConsume(static_cast<char>(0xBB)) || + !TryConsume(static_cast<char>(0xBF))) { AddError( "Proto file starts with 0xEF but not UTF-8 BOM. " "Only UTF-8 is accepted for proto file."); @@ -991,7 +1040,8 @@ static inline bool IsTrailSurrogate(arc_ui32 code_point) { } // Combine a head and trail surrogate into a single Unicode code point. -static arc_ui32 AssembleUTF16(arc_ui32 head_surrogate, arc_ui32 trail_surrogate) { +static arc_ui32 AssembleUTF16(arc_ui32 head_surrogate, + arc_ui32 trail_surrogate) { GOOGLE_DCHECK(IsHeadSurrogate(head_surrogate)); GOOGLE_DCHECK(IsTrailSurrogate(trail_surrogate)); return 0x10000 + (((head_surrogate - kMinHeadSurrogate) << 10) | diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h index 2b0fdc097c..de1abdf622 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h @@ -122,6 +122,13 @@ class PROTOBUF_EXPORT Tokenizer { TYPE_SYMBOL, // Any other printable character, like '!' or '+'. // Symbols are always a single character, so "!+$%" is // four tokens. + TYPE_WHITESPACE, // A sequence of whitespace. This token type is only + // produced if report_whitespace() is true. It is not + // reported for whitespace within comments or strings. + TYPE_NEWLINE, // A newline (\n). This token type is only + // produced if report_whitespace() is true and + // report_newlines() is true. It is not reported for + // newlines in comments or strings. }; // Structure representing a token read from the token stream. @@ -252,6 +259,16 @@ class PROTOBUF_EXPORT Tokenizer { allow_multiline_strings_ = allow; } + // If true, whitespace tokens are reported by Next(). + // Note: `set_report_whitespace(false)` implies `set_report_newlines(false)`. + bool report_whitespace() const; + void set_report_whitespace(bool report); + + // If true, newline tokens are reported by Next(). + // Note: `set_report_newlines(true)` implies `set_report_whitespace(true)`. + bool report_newlines() const; + void set_report_newlines(bool report); + // External helper: validate an identifier. static bool IsIdentifier(const TProtoStringType& text); @@ -287,6 +304,8 @@ class PROTOBUF_EXPORT Tokenizer { CommentStyle comment_style_; bool require_space_after_number_; bool allow_multiline_strings_; + bool report_whitespace_ = false; + bool report_newlines_ = false; // Since we count columns we need to interpret tabs somehow. We'll take // the standard 8-character definition for lack of any way to do better. @@ -360,6 +379,14 @@ class PROTOBUF_EXPORT Tokenizer { // of comment it is. NextCommentStatus TryConsumeCommentStart(); + // If we're looking at a TYPE_WHITESPACE token and `report_whitespace_` is + // true, consume it and return true. + bool TryConsumeWhitespace(); + + // If we're looking at a TYPE_NEWLINE token and `report_newlines_` is true, + // consume it and return true. + bool TryConsumeNewline(); + // ----------------------------------------------------------------- // These helper methods make the parsing code more readable. The // "character classes" referred to are defined at the top of the .cc file. 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 0b28bb9b53..7439a70d61 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 @@ -104,7 +104,7 @@ FileInputStream::CopyingFileInputStream::CopyingFileInputStream( is_closed_(false), errno_(0), previous_seek_failed_(false) { -#ifndef _MSC_VER +#ifndef _WIN32 int flags = fcntl(file_, F_GETFL); flags &= ~O_NONBLOCK; fcntl(file_, F_SETFL, flags); @@ -170,7 +170,7 @@ int FileInputStream::CopyingFileInputStream::Skip(int count) { // =================================================================== -FileOutputStream::FileOutputStream(int file_descriptor, int block_size) +FileOutputStream::FileOutputStream(int file_descriptor, int /*block_size*/) : CopyingOutputStreamAdaptor(©ing_output_), copying_output_(file_descriptor) {} diff --git a/contrib/libs/protobuf/src/google/protobuf/map.h b/contrib/libs/protobuf/src/google/protobuf/map.h index 9096dbaf57..6b56354e4d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map.h +++ b/contrib/libs/protobuf/src/google/protobuf/map.h @@ -50,6 +50,11 @@ #include <string_view> #endif // defined(__cpp_lib_string_view) +#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__) +#define GOOGLE_PROTOBUF_NO_RDTSC 1 +//#include <mach/mach_time.h> +#endif + #include <google/protobuf/stubs/common.h> #include <google/protobuf/arena.h> #include <google/protobuf/generated_enum_util.h> @@ -1080,12 +1085,24 @@ class Map { // 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) >> 4; -#if defined(__x86_64__) && defined(__GNUC__) && \ - !defined(GOOGLE_PROTOBUF_NO_RDTSC) +#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) +#if defined(__APPLE__) + // Use a commpage-based fast time function on Apple environments (MacOS, + // iOS, tvOS, watchOS, etc). + s += mach_absolute_time(); +#elif defined(__x86_64__) && defined(__GNUC__) arc_ui32 hi, lo; asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); s += ((static_cast<arc_ui64>(hi) << 32) | lo); +#elif defined(__aarch64__) && defined(__GNUC__) + // There is no rdtsc on ARMv8. CNTVCT_EL0 is the virtual counter of the + // system timer. It runs at a different frequency than the CPU's, but is + // the best source of time-based entropy we get. + arc_ui64 virtual_timer_value; + asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value)); + s += virtual_timer_value; #endif +#endif // !defined(GOOGLE_PROTOBUF_NO_RDTSC) return s; } 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 7f61a45cdb..d9880b2abb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_entry_lite.h @@ -194,7 +194,7 @@ class MapEntryImpl : public Base { _has_bits_{} {} ~MapEntryImpl() { - if (Base::GetArenaForAllocation() != NULL) return; + if (Base::GetArenaForAllocation() != nullptr) return; KeyTypeHandler::DeleteNoArena(key_); ValueTypeHandler::DeleteNoArena(value_); } @@ -286,11 +286,6 @@ class MapEntryImpl : public Base { return ValueTypeHandler::IsInitialized(value_); } - Base* New() const override { - Derived* entry = new Derived; - return entry; - } - Base* New(Arena* arena) const override { Derived* entry = Arena::CreateMessage<Derived>(arena); return entry; @@ -528,7 +523,9 @@ class MapEntryLite : public MapEntryImpl<T, MessageLite, Key, Value, SuperType; constexpr MapEntryLite() {} explicit MapEntryLite(Arena* arena) : SuperType(arena) {} - ~MapEntryLite() { MessageLite::_internal_metadata_.template Delete<TProtoStringType>(); } + ~MapEntryLite() { + MessageLite::_internal_metadata_.template Delete<TProtoStringType>(); + } void MergeFrom(const MapEntryLite& other) { MergeFromInternal(other); } private: diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field.cc b/contrib/libs/protobuf/src/google/protobuf/map_field.cc index 9e3aa86d8b..d6534806fe 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/map_field.cc @@ -40,7 +40,7 @@ namespace protobuf { namespace internal { MapFieldBase::~MapFieldBase() { - if (repeated_field_ != NULL && arena_ == NULL) delete repeated_field_; + if (repeated_field_ != nullptr && arena_ == nullptr) delete repeated_field_; } const RepeatedPtrFieldBase& MapFieldBase::GetRepeatedField() const { @@ -56,9 +56,44 @@ RepeatedPtrFieldBase* MapFieldBase::MutableRepeatedField() { return reinterpret_cast<RepeatedPtrFieldBase*>(repeated_field_); } +void MapFieldBase::SwapState(MapFieldBase* other) { + // a relaxed swap of the atomic + auto other_state = other->state_.load(std::memory_order_relaxed); + auto this_state = state_.load(std::memory_order_relaxed); + other->state_.store(this_state, std::memory_order_relaxed); + state_.store(other_state, std::memory_order_relaxed); +} + +void SwapRepeatedPtrToNull(RepeatedPtrField<Message>** from, + RepeatedPtrField<Message>** to, Arena* from_arena, + Arena* to_arena) { + GOOGLE_DCHECK(*from != nullptr); + GOOGLE_DCHECK(*to == nullptr); + *to = Arena::CreateMessage<RepeatedPtrField<Message> >(to_arena); + **to = std::move(**from); + if (from_arena == nullptr) { + delete *from; + } + *from = nullptr; +} + void MapFieldBase::Swap(MapFieldBase* other) { - // TODO(teboring): This is incorrect when on different arenas. - InternalSwap(other); + if (arena_ == other->arena_) { + InternalSwap(other); + return; + } + if (repeated_field_ != nullptr || other->repeated_field_ != nullptr) { + if (repeated_field_ == nullptr) { + SwapRepeatedPtrToNull(&other->repeated_field_, &repeated_field_, + other->arena_, arena_); + } else if (other->repeated_field_ == nullptr) { + SwapRepeatedPtrToNull(&repeated_field_, &other->repeated_field_, arena_, + other->arena_); + } else { + repeated_field_->Swap(other->repeated_field_); + } + } + SwapState(other); } void MapFieldBase::UnsafeShallowSwap(MapFieldBase* other) { @@ -69,11 +104,7 @@ void MapFieldBase::UnsafeShallowSwap(MapFieldBase* other) { void MapFieldBase::InternalSwap(MapFieldBase* other) { std::swap(arena_, other->arena_); std::swap(repeated_field_, other->repeated_field_); - // a relaxed swap of the atomic - auto other_state = other->state_.load(std::memory_order_relaxed); - auto this_state = state_.load(std::memory_order_relaxed); - other->state_.store(this_state, std::memory_order_relaxed); - state_.store(other_state, std::memory_order_relaxed); + SwapState(other); } size_t MapFieldBase::SpaceUsedExcludingSelfLong() const { @@ -86,7 +117,7 @@ size_t MapFieldBase::SpaceUsedExcludingSelfLong() const { } size_t MapFieldBase::SpaceUsedExcludingSelfNoLock() const { - if (repeated_field_ != NULL) { + if (repeated_field_ != nullptr) { return repeated_field_->SpaceUsedExcludingSelfLong(); } else { return 0; @@ -156,7 +187,7 @@ void MapFieldBase::SyncRepeatedFieldWithMap() const { } void MapFieldBase::SyncRepeatedFieldWithMapNoLock() const { - if (repeated_field_ == NULL) { + if (repeated_field_ == nullptr) { repeated_field_ = Arena::CreateMessage<RepeatedPtrField<Message> >(arena_); } } @@ -403,7 +434,7 @@ void DynamicMapField::SyncRepeatedFieldWithMapNoLock() const { const Reflection* reflection = default_entry_->GetReflection(); const FieldDescriptor* key_des = default_entry_->GetDescriptor()->map_key(); const FieldDescriptor* val_des = default_entry_->GetDescriptor()->map_value(); - if (MapFieldBase::repeated_field_ == NULL) { + if (MapFieldBase::repeated_field_ == nullptr) { MapFieldBase::repeated_field_ = Arena::CreateMessage<RepeatedPtrField<Message> >(MapFieldBase::arena_); } @@ -566,7 +597,7 @@ void DynamicMapField::SyncMapWithRepeatedFieldNoLock() const { size_t DynamicMapField::SpaceUsedExcludingSelfNoLock() const { size_t size = 0; - if (MapFieldBase::repeated_field_ != NULL) { + if (MapFieldBase::repeated_field_ != nullptr) { size += MapFieldBase::repeated_field_->SpaceUsedExcludingSelfLong(); } size += sizeof(map_); diff --git a/contrib/libs/protobuf/src/google/protobuf/map_field.h b/contrib/libs/protobuf/src/google/protobuf/map_field.h index f2f80b4a10..f5b7c6177a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field.h @@ -325,7 +325,7 @@ class MapFieldAccessor; class PROTOBUF_EXPORT MapFieldBase { public: MapFieldBase() - : arena_(NULL), repeated_field_(NULL), state_(STATE_MODIFIED_MAP) {} + : arena_(nullptr), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {} // This constructor is for constant initialized global instances. // It uses a linker initialized mutex, so it is not compatible with regular @@ -467,6 +467,10 @@ class PROTOBUF_EXPORT MapFieldBase { // IncreaseIterator() is called by operator++() of MapIterator only. // It implements the ++ operator of MapIterator. virtual void IncreaseIterator(MapIterator* map_iter) const = 0; + + // Swaps state_ with another MapFieldBase + void SwapState(MapFieldBase* other); + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldBase); }; @@ -574,15 +578,15 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> { void InternalSwap(MapField* other); // Used in the implementation of parsing. Caller should take the ownership iff - // arena_ is NULL. + // arena_ is nullptr. EntryType* NewEntry() const { return impl_.NewEntry(); } // Used in the implementation of serializing enum value type. Caller should - // take the ownership iff arena_ is NULL. + // take the ownership iff arena_ is nullptr. EntryType* NewEnumEntryWrapper(const Key& key, const T t) const { return impl_.NewEnumEntryWrapper(key, t); } // Used in the implementation of serializing other value types. Caller should - // take the ownership iff arena_ is NULL. + // take the ownership iff arena_ is nullptr. EntryType* NewEntryWrapper(const Key& key, const T& t) const { return impl_.NewEntryWrapper(key, t); } 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 ab5b1910a6..4d4abd2224 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field_inl.h @@ -138,7 +138,7 @@ template <typename Key, typename T> void TypeDefinedMapFieldBase<Key, T>::InitializeIterator( MapIterator* map_iter) const { map_iter->iter_ = new typename Map<Key, T>::const_iterator; - GOOGLE_CHECK(map_iter->iter_ != NULL); + GOOGLE_CHECK(map_iter->iter_ != nullptr); } template <typename Key, typename T> @@ -304,7 +304,7 @@ template <typename Derived, typename Key, typename T, WireFormatLite::FieldType kValueFieldType> void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType>::SyncRepeatedFieldWithMapNoLock() const { - if (this->MapFieldBase::repeated_field_ == NULL) { + if (this->MapFieldBase::repeated_field_ == nullptr) { this->MapFieldBase::repeated_field_ = Arena::CreateMessage<RepeatedPtrField<Message> >( this->MapFieldBase::arena_); @@ -341,7 +341,7 @@ void MapField<Derived, Key, T, kKeyFieldType, RepeatedPtrField<EntryType>* repeated_field = reinterpret_cast<RepeatedPtrField<EntryType>*>( this->MapFieldBase::repeated_field_); - GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != NULL); + GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != nullptr); map->clear(); for (typename RepeatedPtrField<EntryType>::iterator it = repeated_field->begin(); @@ -361,7 +361,7 @@ template <typename Derived, typename Key, typename T, size_t MapField<Derived, Key, T, kKeyFieldType, kValueFieldType>::SpaceUsedExcludingSelfNoLock() const { size_t size = 0; - if (this->MapFieldBase::repeated_field_ != NULL) { + if (this->MapFieldBase::repeated_field_ != nullptr) { size += this->MapFieldBase::repeated_field_->SpaceUsedExcludingSelfLong(); } size += impl_.GetMap().SpaceUsedExcludingSelfLong(); 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 7cff25945a..c86e4af824 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_field_lite.h @@ -84,17 +84,17 @@ class MapFieldLite { void InternalSwap(MapFieldLite* other) { map_.InternalSwap(other->map_); } // Used in the implementation of parsing. Caller should take the ownership iff - // arena_ is NULL. + // arena_ is nullptr. EntryType* NewEntry() const { return Arena::CreateMessage<EntryType>(map_.arena()); } // Used in the implementation of serializing enum value type. Caller should - // take the ownership iff arena_ is NULL. + // take the ownership iff arena_ is nullptr. EntryType* NewEnumEntryWrapper(const Key& key, const T t) const { return EntryType::EnumWrap(key, t, map_.arena_); } // Used in the implementation of serializing other value types. Caller should - // take the ownership iff arena_ is NULL. + // take the ownership iff arena_ is nullptr. EntryType* NewEntryWrapper(const Key& key, const T& t) const { return EntryType::Wrap(key, t, map_.arena_); } 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 3a3c41259b..db7f6fdbb3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h +++ b/contrib/libs/protobuf/src/google/protobuf/map_type_handler.h @@ -510,7 +510,7 @@ inline size_t MapTypeHandler<WireFormatLite::TYPE_MESSAGE, template <typename Type> inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Clear( Type** value, Arena* /* arena */) { - if (*value != NULL) (*value)->Clear(); + if (*value != nullptr) (*value)->Clear(); } template <typename Type> inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Merge( @@ -533,7 +533,7 @@ constexpr auto MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Constinit() template <typename Type> inline Type* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::EnsureMutable( Type** value, Arena* arena) { - if (*value == NULL) { + if (*value == nullptr) { *value = MapArenaMessageCreator< Type, Arena::is_arena_constructable<Type>::type::value>::CreateMessage(arena); @@ -545,7 +545,7 @@ template <typename Type> inline const Type& MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::DefaultIfNotInitialized( const Type* value) { - return value != NULL ? *value : *Type::internal_default_instance(); + return value != nullptr ? *value : *Type::internal_default_instance(); } template <typename Type> diff --git a/contrib/libs/protobuf/src/google/protobuf/message.cc b/contrib/libs/protobuf/src/google/protobuf/message.cc index 536fbe052d..e049807c23 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message.cc @@ -321,35 +321,35 @@ const Message* GeneratedMessageFactory::GetPrototype(const Descriptor* type) { { ReaderMutexLock lock(&mutex_); const Message* result = FindPtrOrNull(type_map_, type); - if (result != NULL) return result; + if (result != nullptr) return result; } // If the type is not in the generated pool, then we can't possibly handle // it. - if (type->file()->pool() != DescriptorPool::generated_pool()) return NULL; + if (type->file()->pool() != DescriptorPool::generated_pool()) return nullptr; // Apparently the file hasn't been registered yet. Let's do that now. const internal::DescriptorTable* registration_data = FindPtrOrNull(file_map_, type->file()->name().c_str()); - if (registration_data == NULL) { + if (registration_data == nullptr) { GOOGLE_LOG(DFATAL) << "File appears to be in generated pool but wasn't " "registered: " << type->file()->name(); - return NULL; + return nullptr; } WriterMutexLock lock(&mutex_); // Check if another thread preempted us. const Message* result = FindPtrOrNull(type_map_, type); - if (result == NULL) { + if (result == nullptr) { // Nope. OK, register everything. internal::RegisterFileLevelMetadata(registration_data); // Should be here now. result = FindPtrOrNull(type_map_, type); } - if (result == NULL) { + if (result == nullptr) { GOOGLE_LOG(DFATAL) << "Type appears to be in generated pool but wasn't " << "registered: " << type->full_name(); } @@ -413,7 +413,7 @@ const internal::RepeatedFieldAccessor* Reflection::RepeatedFieldAccessor( } } GOOGLE_LOG(FATAL) << "Should not reach here."; - return NULL; + return nullptr; } namespace internal { diff --git a/contrib/libs/protobuf/src/google/protobuf/message.h b/contrib/libs/protobuf/src/google/protobuf/message.h index 531cd7c9c0..a94688c248 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.h +++ b/contrib/libs/protobuf/src/google/protobuf/message.h @@ -160,7 +160,7 @@ struct DescriptorTable; class MapFieldBase; class SwapFieldHelper; class CachedSize; -} +} // namespace internal class UnknownFieldSet; // unknown_field_set.h namespace io { class ZeroCopyInputStream; // zero_copy_stream.h @@ -171,7 +171,7 @@ class CodedOutputStream; // coded_stream.h namespace python { class MapReflectionFriend; // scalar_map_container.h class MessageReflectionFriend; -} +} // namespace python namespace expr { class CelMapReflectionFriend; // field_backed_map_impl.cc } @@ -246,18 +246,11 @@ class PROTOBUF_EXPORT Message : public MessageLite { // Construct a new instance of the same type. Ownership is passed to the // caller. (This is also defined in MessageLite, but is defined again here // for return-type covariance.) - Message* New() const override = 0; + Message* New() const { return New(nullptr); } // Construct a new instance on the arena. Ownership is passed to the caller - // if arena is a nullptr. Default implementation allows for API compatibility - // during the Arena transition. - Message* New(Arena* arena) const override { - Message* message = New(); - if (arena != nullptr) { - arena->Own(message); - } - return message; - } + // if arena is a nullptr. + Message* New(Arena* arena) const override = 0; // Make this message into a copy of the given message. The given message // must have the same descriptor, but need not necessarily be the same class. @@ -295,7 +288,7 @@ class PROTOBUF_EXPORT Message : public MessageLite { // method after parsing. // // See Reflection::GetUnknownFields() for more on unknown fields. - virtual void DiscardUnknownFields(); + void DiscardUnknownFields(); // Computes (an estimate of) the total number of bytes currently used for // storing the message in memory. The default implementation calls the @@ -530,8 +523,8 @@ class PROTOBUF_EXPORT Reflection final { void RemoveLast(Message* message, const FieldDescriptor* field) const; // Removes the last element of a repeated message field, and returns the // pointer to the caller. Caller takes ownership of the returned pointer. - PROTOBUF_MUST_USE_RESULT Message* ReleaseLast( - Message* message, const FieldDescriptor* field) const; + PROTOBUF_NODISCARD 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 @@ -685,7 +678,7 @@ class PROTOBUF_EXPORT Reflection final { // If the field existed (HasField() is true), then the returned pointer will // be the same as the pointer returned by MutableMessage(). // This function has the same effect as ClearField(). - PROTOBUF_MUST_USE_RESULT Message* ReleaseMessage( + PROTOBUF_NODISCARD Message* ReleaseMessage( Message* message, const FieldDescriptor* field, MessageFactory* factory = nullptr) const; @@ -1043,6 +1036,11 @@ class PROTOBUF_EXPORT Reflection final { IsEagerlyVerifiedLazyField(field); } + // Returns true if the field is lazy extension. It is meant to allow python + // reparse lazy field until b/157559327 is fixed. + bool IsLazyExtension(const Message& message, + const FieldDescriptor* field) const; + bool IsLazilyVerifiedLazyField(const FieldDescriptor* field) const; bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const; diff --git a/contrib/libs/protobuf/src/google/protobuf/message_lite.cc b/contrib/libs/protobuf/src/google/protobuf/message_lite.cc index 2fa7c51fb7..f644dd834d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message_lite.cc @@ -125,6 +125,7 @@ inline StringPiece as_string_view(const void* data, int size) { inline bool CheckFieldPresence(const internal::ParseContext& ctx, const MessageLite& msg, MessageLite::ParseFlags parse_flags) { + (void)ctx; // Parameter is used by Google-internal code. if (PROTOBUF_PREDICT_FALSE((parse_flags & MessageLite::kMergePartial) != 0)) { return true; } @@ -199,14 +200,6 @@ template bool MergeFromImpl<true>(BoundedZCIS input, MessageLite* msg, } // namespace internal -MessageLite* MessageLite::New(Arena* arena) const { - MessageLite* message = New(); - if (arena != NULL) { - arena->Own(message); - } - return message; -} - class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream { public: ZeroCopyCodedInputStream(io::CodedInputStream* cis) : cis_(cis) {} diff --git a/contrib/libs/protobuf/src/google/protobuf/message_lite.h b/contrib/libs/protobuf/src/google/protobuf/message_lite.h index e9c1b32b11..78f85a8d13 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/message_lite.h @@ -46,13 +46,16 @@ #include <google/protobuf/stubs/logging.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> +#include <google/protobuf/explicitly_constructed.h> #include <google/protobuf/metadata_lite.h> #include <google/protobuf/stubs/once.h> #include <google/protobuf/port.h> #include <google/protobuf/stubs/strutil.h> +// clang-format off #include <google/protobuf/port_def.inc> +// clang-format on #ifdef SWIG #error "You cannot SWIG proto headers" @@ -92,7 +95,7 @@ class ParseContext; class ExtensionSet; class LazyField; class RepeatedPtrFieldBase; -class TcParserBase; +class TcParser; class WireFormatLite; class WeakFieldMap; @@ -126,43 +129,6 @@ inline int ToIntSize(size_t size) { return static_cast<int>(size); } -// This type wraps a variable whose constructor and destructor are explicitly -// called. It is particularly useful for a global variable, without its -// constructor and destructor run on start and end of the program lifetime. -// This circumvents the initial construction order fiasco, while keeping -// the address of the empty string a compile time constant. -// -// Pay special attention to the initialization state of the object. -// 1. The object is "uninitialized" to begin with. -// 2. Call Construct() or DefaultConstruct() only if the object is -// uninitialized. After the call, the object becomes "initialized". -// 3. Call get() and get_mutable() only if the object is initialized. -// 4. Call Destruct() only if the object is initialized. -// After the call, the object becomes uninitialized. -template <typename T> -class ExplicitlyConstructed { - public: - void DefaultConstruct() { new (&union_) T(); } - - template <typename... Args> - void Construct(Args&&... args) { - new (&union_) T(std::forward<Args>(args)...); - } - - void Destruct() { get_mutable()->~T(); } - - constexpr const T& get() const { return reinterpret_cast<const T&>(union_); } - T* get_mutable() { return reinterpret_cast<T*>(&union_); } - - private: - // Prefer c++14 aligned_storage, but for compatibility this will do. - union AlignedUnion { - alignas(T) char space[sizeof(T)]; - arc_i64 align_to_int64; - void* align_to_ptr; - } union_; -}; - // Default empty string object. Don't use this directly. Instead, call // GetEmptyString() to get the reference. PROTOBUF_EXPORT extern ExplicitlyConstructed<TProtoStringType> @@ -215,28 +181,15 @@ class PROTOBUF_EXPORT MessageLite { // Construct a new instance of the same type. Ownership is passed to the // caller. - virtual MessageLite* New() const = 0; + MessageLite* New() const { return New(nullptr); } // Construct a new instance on the arena. Ownership is passed to the caller - // if arena is a NULL. Default implementation for backwards compatibility. - virtual MessageLite* New(Arena* arena) const; + // if arena is a nullptr. + virtual MessageLite* New(Arena* arena) const = 0; // Same as GetOwningArena. Arena* GetArena() const { return GetOwningArena(); } - // Get a pointer that may be equal to this message's arena, or may not be. - // If the value returned by this method is equal to some arena pointer, then - // this message is on that arena; however, if this message is on some arena, - // this method may or may not return that arena's pointer. As a tradeoff, - // this method may be more efficient than GetArena(). The intent is to allow - // underlying representations that use e.g. tagged pointers to sometimes - // store the arena pointer directly, and sometimes in a more indirect way, - // and allow a fastpath comparison against the arena pointer when it's easy - // to obtain. - void* GetMaybeArenaPointer() const { - return _internal_metadata_.raw_arena_ptr(); - } - // Clear all fields of the message and set them to their default values. // Clear() avoids freeing memory, assuming that any memory allocated // to hold parts of the message will be needed again to hold the next @@ -281,65 +234,65 @@ class PROTOBUF_EXPORT MessageLite { // format. A successful return does not indicate the entire input is // consumed, ensure you call ConsumedEntireMessage() to check that if // applicable. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromCodedStream( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromCodedStream( io::CodedInputStream* input); // Like ParseFromCodedStream(), but accepts messages that are missing // required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromCodedStream( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromCodedStream( io::CodedInputStream* input); // Read a protocol buffer from the given zero-copy input stream. If // successful, the entire input will be consumed. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromZeroCopyStream( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromZeroCopyStream( io::ZeroCopyInputStream* input); // Like ParseFromZeroCopyStream(), but accepts messages that are missing // required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromZeroCopyStream( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromZeroCopyStream( io::ZeroCopyInputStream* input); // Parse a protocol buffer from a file descriptor. If successful, the entire // input will be consumed. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromFileDescriptor( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromFileDescriptor( int file_descriptor); // Like ParseFromFileDescriptor(), but accepts messages that are missing // required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromFileDescriptor( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromFileDescriptor( int file_descriptor); // Parse a protocol buffer from a C++ istream. If successful, the entire // input will be consumed. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromIstream(std::istream* input); + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromIstream(std::istream* input); // Like ParseFromIstream(), but accepts messages that are missing // required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromIstream( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromIstream( std::istream* input); // Read a protocol buffer from the given zero-copy input stream, expecting // the message to be exactly "size" bytes long. If successful, exactly // this many bytes will have been consumed from the input. - PROTOBUF_MUST_USE_RESULT bool MergePartialFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, + bool MergePartialFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, int size); // Like ParseFromBoundedZeroCopyStream(), but accepts messages that are // missing required fields. - PROTOBUF_MUST_USE_RESULT bool MergeFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, int size); - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromBoundedZeroCopyStream( + bool MergeFromBoundedZeroCopyStream(io::ZeroCopyInputStream* input, int size); + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromBoundedZeroCopyStream( io::ZeroCopyInputStream* input, int size); // Like ParseFromBoundedZeroCopyStream(), but accepts messages that are // missing required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromBoundedZeroCopyStream( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromBoundedZeroCopyStream( io::ZeroCopyInputStream* input, int size); // Parses a protocol buffer contained in a string. Returns true on success. // This function takes a string in the (non-human-readable) binary wire // format, matching the encoding output by MessageLite::SerializeToString(). // If you'd like to convert a human-readable string into a protocol buffer // object, see google::protobuf::TextFormat::ParseFromString(). - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromString(ConstStringParam data); + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromString(ConstStringParam data); // Like ParseFromString(), but accepts messages that are missing // required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromString( + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromString( ConstStringParam data); // Parse a protocol buffer contained in an array of bytes. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParseFromArray(const void* data, + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParseFromArray(const void* data, int size); // Like ParseFromArray(), but accepts messages that are missing // required fields. - PROTOBUF_ATTRIBUTE_REINITIALIZES PROTOBUF_MUST_USE_RESULT bool ParsePartialFromArray(const void* data, + PROTOBUF_ATTRIBUTE_REINITIALIZES bool ParsePartialFromArray(const void* data, int size); @@ -354,17 +307,17 @@ class PROTOBUF_EXPORT MessageLite { // // ParseFromCodedStream() is implemented as Clear() followed by // MergeFromCodedStream(). - PROTOBUF_MUST_USE_RESULT bool MergeFromCodedStream(io::CodedInputStream* input); + bool MergeFromCodedStream(io::CodedInputStream* input); // Like MergeFromCodedStream(), but succeeds even if required fields are // missing in the input. // // MergeFromCodedStream() is just implemented as MergePartialFromCodedStream() // followed by IsInitialized(). - PROTOBUF_MUST_USE_RESULT bool MergePartialFromCodedStream(io::CodedInputStream* input); + bool MergePartialFromCodedStream(io::CodedInputStream* input); // Merge a protocol buffer contained in a string. - PROTOBUF_MUST_USE_RESULT bool MergeFromString(ConstStringParam data); + bool MergeFromString(ConstStringParam data); // Serialization --------------------------------------------------- @@ -374,24 +327,24 @@ class PROTOBUF_EXPORT MessageLite { // Write a protocol buffer of this message to the given output. Returns // false on a write error. If the message is missing required fields, // this may GOOGLE_CHECK-fail. - PROTOBUF_MUST_USE_RESULT bool SerializeToCodedStream(io::CodedOutputStream* output) const; + bool SerializeToCodedStream(io::CodedOutputStream* output) const; // Like SerializeToCodedStream(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool SerializePartialToCodedStream(io::CodedOutputStream* output) const; + bool SerializePartialToCodedStream(io::CodedOutputStream* output) const; // Write the message to the given zero-copy output stream. All required // fields must be set. - PROTOBUF_MUST_USE_RESULT bool SerializeToZeroCopyStream(io::ZeroCopyOutputStream* output) const; + bool SerializeToZeroCopyStream(io::ZeroCopyOutputStream* output) const; // Like SerializeToZeroCopyStream(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool SerializePartialToZeroCopyStream(io::ZeroCopyOutputStream* output) const; + bool SerializePartialToZeroCopyStream(io::ZeroCopyOutputStream* output) const; // Serialize the message and store it in the given string. All required // fields must be set. - PROTOBUF_MUST_USE_RESULT bool SerializeToString(TProtoStringType* output) const; + bool SerializeToString(TProtoStringType* output) const; // Like SerializeToString(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool SerializePartialToString(TProtoStringType* output) const; + bool SerializePartialToString(TProtoStringType* output) const; // Serialize the message and store it in the given byte array. All required // fields must be set. - PROTOBUF_MUST_USE_RESULT bool SerializeToArray(void* data, int size) const; + bool SerializeToArray(void* data, int size) const; // Like SerializeToArray(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool SerializePartialToArray(void* data, int size) const; + bool SerializePartialToArray(void* data, int size) const; // Make a string encoding the message. Is equivalent to calling // SerializeToString() on a string and using that. Returns the empty @@ -405,20 +358,20 @@ class PROTOBUF_EXPORT MessageLite { // Serialize the message and write it to the given file descriptor. All // required fields must be set. - PROTOBUF_MUST_USE_RESULT bool SerializeToFileDescriptor(int file_descriptor) const; + bool SerializeToFileDescriptor(int file_descriptor) const; // Like SerializeToFileDescriptor(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool SerializePartialToFileDescriptor(int file_descriptor) const; + bool SerializePartialToFileDescriptor(int file_descriptor) const; // Serialize the message and write it to the given C++ ostream. All // required fields must be set. - PROTOBUF_MUST_USE_RESULT bool SerializeToOstream(std::ostream* output) const; + bool SerializeToOstream(std::ostream* output) const; // Like SerializeToOstream(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool SerializePartialToOstream(std::ostream* output) const; + bool SerializePartialToOstream(std::ostream* output) const; // Like SerializeToString(), but appends to the data to the string's // existing contents. All required fields must be set. - PROTOBUF_MUST_USE_RESULT bool AppendToString(TProtoStringType* output) const; + bool AppendToString(TProtoStringType* output) const; // Like AppendToString(), but allows missing required fields. - PROTOBUF_MUST_USE_RESULT bool AppendPartialToString(TProtoStringType* output) const; + bool AppendPartialToString(TProtoStringType* output) const; // Computes the serialized size of the message. This recursively calls @@ -528,7 +481,7 @@ class PROTOBUF_EXPORT MessageLite { private: // TODO(gerbens) make this a pure abstract function - virtual const void* InternalGetTable() const { return NULL; } + virtual const void* InternalGetTable() const { return nullptr; } friend class FastReflectionMessageMutator; friend class FastReflectionStringSetter; @@ -537,7 +490,7 @@ class PROTOBUF_EXPORT MessageLite { friend class internal::ExtensionSet; friend class internal::LazyField; friend class internal::SwapFieldHelper; - friend class internal::TcParserBase; + friend class internal::TcParser; friend class internal::WeakFieldMap; friend class internal::WireFormatLite; @@ -600,7 +553,7 @@ bool MergeFromImpl(const SourceWrapper<T>& input, MessageLite* msg, } // namespace internal template <MessageLite::ParseFlags flags, typename T> -PROTOBUF_MUST_USE_RESULT bool MessageLite::ParseFrom(const T& input) { +bool MessageLite::ParseFrom(const T& input) { if (flags & kParse) Clear(); constexpr bool alias = (flags & kMergeWithAliasing) != 0; return internal::MergeFromImpl<alias>(input, this, flags); diff --git a/contrib/libs/protobuf/src/google/protobuf/metadata_lite.h b/contrib/libs/protobuf/src/google/protobuf/metadata_lite.h index a08adaeb0e..d180bcda91 100644 --- a/contrib/libs/protobuf/src/google/protobuf/metadata_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/metadata_lite.h @@ -188,7 +188,7 @@ class InternalMetadata { template <typename T> PROTOBUF_NOINLINE void DeleteOutOfLineHelper() { - if (arena() == NULL) { + if (arena() == nullptr) { delete PtrValue<Container<T>>(); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.cc b/contrib/libs/protobuf/src/google/protobuf/parse_context.cc index b469b49da1..a1995b6c1e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.cc +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.cc @@ -205,7 +205,7 @@ std::pair<const char*, bool> EpsCopyInputStream::DoneFallback(int overrun, } const char* EpsCopyInputStream::SkipFallback(const char* ptr, int size) { - return AppendSize(ptr, size, [](const char* p, int s) {}); + return AppendSize(ptr, size, [](const char* /*p*/, int /*s*/) {}); } const char* EpsCopyInputStream::ReadStringFallback(const char* ptr, int size, @@ -237,7 +237,7 @@ const char* EpsCopyInputStream::AppendStringFallback(const char* ptr, int size, template <int> void byteswap(void* p); template <> -void byteswap<1>(void* p) {} +void byteswap<1>(void* /*p*/) {} template <> void byteswap<4>(void* p) { *static_cast<arc_ui32*>(p) = bswap_32(*static_cast<arc_ui32*>(p)); @@ -460,7 +460,6 @@ const char* PackedBoolParser(void* object, const char* ptr, ParseContext* ctx) { template <typename T> const char* FixedParser(void* object, const char* ptr, ParseContext* ctx) { int size = ReadSize(&ptr); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); return ctx->ReadPackedFixed(ptr, size, static_cast<RepeatedField<T>*>(object)); } diff --git a/contrib/libs/protobuf/src/google/protobuf/parse_context.h b/contrib/libs/protobuf/src/google/protobuf/parse_context.h index 7738fd159a..8d726894c9 100644 --- a/contrib/libs/protobuf/src/google/protobuf/parse_context.h +++ b/contrib/libs/protobuf/src/google/protobuf/parse_context.h @@ -125,7 +125,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { } // If return value is negative it's an error - PROTOBUF_MUST_USE_RESULT int PushLimit(const char* ptr, int limit) { + PROTOBUF_NODISCARD int PushLimit(const char* ptr, int limit) { GOOGLE_DCHECK(limit >= 0 && limit <= INT_MAX - kSlopBytes); // This add is safe due to the invariant above, because // ptr - buffer_end_ <= kSlopBytes. @@ -136,7 +136,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return old_limit - limit; } - PROTOBUF_MUST_USE_RESULT bool PopLimit(int delta) { + PROTOBUF_NODISCARD bool PopLimit(int delta) { if (PROTOBUF_PREDICT_FALSE(!EndedAtLimit())) return false; limit_ = limit_ + delta; // TODO(gerbens) We could remove this line and hoist the code to @@ -145,22 +145,22 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return true; } - PROTOBUF_MUST_USE_RESULT const char* Skip(const char* ptr, int size) { + PROTOBUF_NODISCARD const char* Skip(const char* ptr, int size) { if (size <= buffer_end_ + kSlopBytes - ptr) { return ptr + size; } return SkipFallback(ptr, size); } - PROTOBUF_MUST_USE_RESULT const char* ReadString(const char* ptr, int size, - TProtoStringType* s) { + PROTOBUF_NODISCARD const char* ReadString(const char* ptr, int size, + TProtoStringType* s) { if (size <= buffer_end_ + kSlopBytes - ptr) { s->assign(ptr, size); return ptr + size; } return ReadStringFallback(ptr, size, s); } - PROTOBUF_MUST_USE_RESULT const char* AppendString(const char* ptr, int size, - TProtoStringType* s) { + PROTOBUF_NODISCARD const char* AppendString(const char* ptr, int size, + TProtoStringType* s) { if (size <= buffer_end_ + kSlopBytes - ptr) { s->append(ptr, size); return ptr + size; @@ -168,22 +168,20 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return AppendStringFallback(ptr, size, s); } // Implemented in arenastring.cc - PROTOBUF_MUST_USE_RESULT const char* ReadArenaString(const char* ptr, - ArenaStringPtr* s, - Arena* arena); + PROTOBUF_NODISCARD const char* ReadArenaString(const char* ptr, + ArenaStringPtr* s, + Arena* arena); template <typename Tag, typename T> - PROTOBUF_MUST_USE_RESULT const char* ReadRepeatedFixed(const char* ptr, - Tag expected_tag, - RepeatedField<T>* out); + PROTOBUF_NODISCARD const char* ReadRepeatedFixed(const char* ptr, + Tag expected_tag, + RepeatedField<T>* out); template <typename T> - PROTOBUF_MUST_USE_RESULT const char* ReadPackedFixed(const char* ptr, - int size, - RepeatedField<T>* out); + PROTOBUF_NODISCARD const char* ReadPackedFixed(const char* ptr, int size, + RepeatedField<T>* out); template <typename Add> - PROTOBUF_MUST_USE_RESULT const char* ReadPackedVarint(const char* ptr, - Add add); + PROTOBUF_NODISCARD const char* ReadPackedVarint(const char* ptr, Add add); arc_ui32 LastTag() const { return last_tag_minus_1_ + 1; } bool ConsumeEndGroup(arc_ui32 start_tag) { @@ -364,8 +362,8 @@ class PROTOBUF_EXPORT EpsCopyInputStream { return end; } - PROTOBUF_MUST_USE_RESULT const char* AppendString(const char* ptr, - TProtoStringType* str) { + PROTOBUF_NODISCARD const char* AppendString(const char* ptr, + TProtoStringType* str) { return AppendUntilEnd( ptr, [str](const char* p, ptrdiff_t s) { str->append(p, s); }); } @@ -407,10 +405,10 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { 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); + PROTOBUF_NODISCARD const char* ParseMessage(T* msg, const char* ptr); template <typename T> - PROTOBUF_MUST_USE_RESULT PROTOBUF_NDEBUG_INLINE const char* ParseGroup( + PROTOBUF_NODISCARD PROTOBUF_NDEBUG_INLINE const char* ParseGroup( T* msg, const char* ptr, arc_ui32 tag) { if (--depth_ < 0) return nullptr; group_depth_++; @@ -430,8 +428,8 @@ class PROTOBUF_EXPORT ParseContext : public EpsCopyInputStream { // if (!ptr) return nullptr; // int old = PushLimit(ptr, size); // if (--depth_ < 0) return nullptr; - PROTOBUF_MUST_USE_RESULT const char* ReadSizeAndPushLimitAndDepth( - const char* ptr, int* old_limit); + PROTOBUF_NODISCARD const char* ReadSizeAndPushLimitAndDepth(const char* ptr, + int* old_limit); // The context keeps an internal stack to keep track of the recursive // part of the parse state. @@ -526,7 +524,7 @@ inline const char* VarintParseSlow(const char* p, arc_ui32 res, arc_ui64* out) { } template <typename T> -PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) { +PROTOBUF_NODISCARD const char* VarintParse(const char* p, T* out) { auto ptr = reinterpret_cast<const uint8_t*>(p); arc_ui32 res = ptr[0]; if (!(res & 0x80)) { @@ -660,8 +658,8 @@ inline arc_i32 ReadVarintZigZag32(const char** p) { 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) { +PROTOBUF_NODISCARD const char* ParseContext::ParseMessage(T* msg, + const char* ptr) { int old; ptr = ReadSizeAndPushLimitAndDepth(ptr, &old); ptr = ptr ? msg->_InternalParse(ptr, this) : nullptr; @@ -682,9 +680,22 @@ const char* EpsCopyInputStream::ReadRepeatedFixed(const char* ptr, return ptr; } +// Add any of the following lines to debug which parse function is failing. + +#define GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, ret) \ + if (!(predicate)) { \ + /* ::raise(SIGINT); */ \ + /* GOOGLE_LOG(ERROR) << "Parse failure"; */ \ + return ret; \ + } + +#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate) \ + GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr) + template <typename T> const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size, RepeatedField<T>* out) { + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); int nbytes = buffer_end_ + kSlopBytes - ptr; while (size > nbytes) { int num = nbytes / sizeof(T); @@ -734,7 +745,7 @@ const char* ReadPackedVarintArray(const char* ptr, const char* end, Add add) { template <typename Add> const char* EpsCopyInputStream::ReadPackedVarint(const char* ptr, Add add) { int size = ReadSize(&ptr); - if (ptr == nullptr) return nullptr; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); int chunk_size = buffer_end_ - ptr; while (size > chunk_size) { ptr = ReadPackedVarintArray(ptr, buffer_end_, add); @@ -776,26 +787,13 @@ inline bool VerifyUTF8(const TProtoStringType* s, const char* field_name) { } // All the string parsers with or without UTF checking and for all CTypes. -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* InlineGreedyStringParser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* InlineGreedyStringParser( TProtoStringType* s, const char* ptr, ParseContext* ctx); -// Add any of the following lines to debug which parse function is failing. - -#define GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, ret) \ - if (!(predicate)) { \ - /* ::raise(SIGINT); */ \ - /* GOOGLE_LOG(ERROR) << "Parse failure"; */ \ - return ret; \ - } - -#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate) \ - GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr) - template <typename T> -PROTOBUF_MUST_USE_RESULT const char* FieldParser(arc_ui64 tag, T& field_parser, - const char* ptr, - ParseContext* ctx) { +PROTOBUF_NODISCARD const char* FieldParser(arc_ui64 tag, T& field_parser, + const char* ptr, ParseContext* ctx) { arc_ui32 number = tag >> 3; GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0); using WireType = internal::WireFormatLite::WireType; @@ -840,9 +838,9 @@ PROTOBUF_MUST_USE_RESULT const char* FieldParser(arc_ui64 tag, T& field_parser, } template <typename T> -PROTOBUF_MUST_USE_RESULT const char* WireFormatParser(T& field_parser, - const char* ptr, - ParseContext* ctx) { +PROTOBUF_NODISCARD const char* WireFormatParser(T& field_parser, + const char* ptr, + ParseContext* ctx) { while (!ctx->Done(&ptr)) { arc_ui32 tag; ptr = ReadTag(ptr, &tag); @@ -861,25 +859,27 @@ PROTOBUF_MUST_USE_RESULT const char* WireFormatParser(T& field_parser, // corresponding field // These are packed varints -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedInt32Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedInt32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedUInt32Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedUInt32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedInt64Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedInt64Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedUInt64Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedUInt64Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSInt32Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSInt32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSInt64Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSInt64Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedEnumParser( void* object, const char* ptr, ParseContext* ctx); template <typename T> -PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser( - void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int), - InternalMetadata* metadata, int field_num) { +PROTOBUF_NODISCARD 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](arc_ui64 val) { if (is_valid(val)) { @@ -891,7 +891,7 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser( } template <typename T> -PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg( +PROTOBUF_NODISCARD const char* PackedEnumParserArg( void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(const void*, int), const void* data, InternalMetadata* metadata, int field_num) { @@ -905,28 +905,28 @@ PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg( }); } -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedBoolParser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedBoolParser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedFixed32Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedFixed32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSFixed32Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSFixed32Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedFixed64Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedFixed64Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSFixed64Parser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSFixed64Parser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedFloatParser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedFloatParser( void* object, const char* ptr, ParseContext* ctx); -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedDoubleParser( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedDoubleParser( void* object, const char* ptr, ParseContext* ctx); // This is the only recursive parser. -PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownGroupLiteParse( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* UnknownGroupLiteParse( TProtoStringType* unknown, const char* ptr, ParseContext* ctx); // This is a helper to for the UnknownGroupLiteParse but is actually also // 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( +PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* UnknownFieldParse( arc_ui32 tag, TProtoStringType* unknown, const char* ptr, ParseContext* ctx); } // namespace internal diff --git a/contrib/libs/protobuf/src/google/protobuf/port_def.inc b/contrib/libs/protobuf/src/google/protobuf/port_def.inc index ba0fdc3f8f..4859701206 100644 --- a/contrib/libs/protobuf/src/google/protobuf/port_def.inc +++ b/contrib/libs/protobuf/src/google/protobuf/port_def.inc @@ -153,17 +153,17 @@ #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 3018003 +#define PROTOBUF_VERSION 3019000 #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 3018000 +#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3019000 #ifdef PROTOBUF_MIN_PROTOC_VERSION #error PROTOBUF_MIN_PROTOC_VERSION was previously defined #endif -#define PROTOBUF_MIN_PROTOC_VERSION 3018000 +#define PROTOBUF_MIN_PROTOC_VERSION 3019000 #ifdef PROTOBUF_VERSION_SUFFIX #error PROTOBUF_VERSION_SUFFIX was previously defined @@ -293,7 +293,12 @@ #ifdef PROTOBUF_SECTION_VARIABLE #error PROTOBUF_SECTION_VARIABLE was previously defined #endif -#define PROTOBUF_SECTION_VARIABLE(x) +#if (__has_attribute(section) || defined(__GNUC__)) && defined(__ELF__) +// Place a variable in the given ELF section. +# define PROTOBUF_SECTION_VARIABLE(x) __attribute__((section(#x))) +#else +# define PROTOBUF_SECTION_VARIABLE(x) +#endif #if defined(PROTOBUF_DEPRECATED) #error PROTOBUF_DEPRECATED was previously defined @@ -338,7 +343,7 @@ // The minimum library version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3018000 +#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3019000 #ifdef PROTOBUF_RTTI #error PROTOBUF_RTTI was previously defined @@ -382,7 +387,7 @@ // choose 16 rather than some other number just in case the compiler would // be confused by an unaligned pointer. #define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) \ - static_cast< ::google::protobuf::uint32>(reinterpret_cast<const char*>( \ + static_cast< ::arc_ui32>(reinterpret_cast<const char*>( \ &reinterpret_cast<const TYPE*>(16)->FIELD) - \ reinterpret_cast<const char*>(16)) #endif @@ -438,14 +443,16 @@ # define PROTOBUF_PREDICT_FALSE(x) (x) #endif -#ifdef PROTOBUF_MUST_USE_RESULT -#error PROTOBUF_MUST_USE_RESULT was previously defined +#ifdef PROTOBUF_NODISCARD +#error PROTOBUF_NODISCARD was previously defined +#endif +#if __has_cpp_attribute(nodiscard) +#define PROTOBUF_NODISCARD [[nodiscard]] +#elif __has_attribute(warn_unused_result) || PROTOBUF_GNUC_MIN(4, 8) +#define PROTOBUF_NODISCARD __attribute__((warn_unused_result)) +#else +#define PROTOBUF_NODISCARD #endif -#if !defined(MSVC_COMPILER) && __has_cpp_attribute(warn_unused_result) -# define PROTOBUF_MUST_USE_RESULT __attribute__((warn_unused_result)) -# else -# define PROTOBUF_MUST_USE_RESULT -# endif #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE #error PROTOBUF_FORCE_COPY_IN_RELEASE was previously defined @@ -459,6 +466,12 @@ #error PROTOBUF_FORCE_COPY_IN_MOVE was previously defined #endif +// Force copy the default string to a string field so that non-optimized builds +// have harder-to-rely-on address stability. +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING +#error PROTOBUF_FORCE_COPY_DEFAULT_STRING was previously defined +#endif + #ifdef PROTOBUF_FALLTHROUGH_INTENDED #error PROTOBUF_FALLTHROUGH_INTENDED was previously defined #endif @@ -553,7 +566,8 @@ // https://github.com/protocolbuffers/protobuf/issues/8310 // Does not work yet with Visual Studio 2019 Update 16.10 #define PROTOBUF_CONSTINIT constinit -#elif __has_cpp_attribute(clang::require_constant_initialization) +#elif !defined(_MSC_VER) && \ + __has_cpp_attribute(clang::require_constant_initialization) #define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]] #else #define PROTOBUF_CONSTINIT @@ -581,7 +595,7 @@ #ifdef PROTOBUF_ATTRIBUTE_INIT_PRIORITY #error PROTOBUF_ATTRIBUTE_INIT_PRIORITY was previously defined #endif -#if PROTOBUF_GNUC_MIN(3, 0) && (!defined(__APPLE__) || defined(__clang__)) +#if PROTOBUF_GNUC_MIN(3, 0) && (!defined(__APPLE__) || defined(__clang__)) && !((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))) #define PROTOBUF_ATTRIBUTE_INIT_PRIORITY __attribute__((init_priority((102)))) #else #define PROTOBUF_ATTRIBUTE_INIT_PRIORITY @@ -631,8 +645,17 @@ # define PROTOBUF_MSAN 1 # endif #elif PROTOBUF_GNUC_MIN(3, 0) -# define PROTOBUF_ASAN __SANITIZE_ADDRESS__ -# define PROTOBUF_TSAN __SANITIZE_THREAD__ +// Double-guard is needed for -Wundef: +# ifdef __SANITIZE_ADDRESS__ +# if __SANITIZE_ADDRESS__ +# define PROTOBUF_ASAN 1 +# endif +# endif +# ifdef __SANITIZE_THREAD__ +# if __SANITIZE_THREAD__ +# define PROTOBUF_TSAN 1 +# endif +# endif #endif // Tail call table-driven parsing can be enabled by defining @@ -661,7 +684,7 @@ #define PROTOBUF_TC_PARAM_DECL \ ::google::protobuf::MessageLite *msg, const char *ptr, \ ::google::protobuf::internal::ParseContext *ctx, \ - const ::google::protobuf::internal::TailCallParseTableBase *table, \ + const ::google::protobuf::internal::TcParseTableBase *table, \ arc_ui64 hasbits, ::google::protobuf::internal::TcFieldData data #ifdef PROTOBUF_UNUSED @@ -759,6 +782,10 @@ #pragma warning(disable : 4073) // To silence the fact that we will pop this push from another file #pragma warning(disable : 5031) +// Conditional expression is constant +#pragma warning(disable: 4127) +// decimal digit terminates octal escape sequence +#pragma warning(disable: 4125) #endif // We don't want code outside port_def doing complex testing, so diff --git a/contrib/libs/protobuf/src/google/protobuf/port_undef.inc b/contrib/libs/protobuf/src/google/protobuf/port_undef.inc index 16a951d2fd..c410730ef1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/port_undef.inc +++ b/contrib/libs/protobuf/src/google/protobuf/port_undef.inc @@ -63,10 +63,11 @@ #undef PROTOBUF_FALLTHROUGH_INTENDED #undef PROTOBUF_EXPORT #undef PROTOC_EXPORT -#undef PROTOBUF_MUST_USE_RESULT +#undef PROTOBUF_NODISCARD #undef PROTOBUF_FORCE_COPY_IN_RELEASE #undef PROTOBUF_FORCE_COPY_IN_SWAP #undef PROTOBUF_FORCE_COPY_IN_MOVE +#undef PROTOBUF_FORCE_COPY_DEFAULT_STRING #undef PROTOBUF_NAMESPACE_OPEN #undef PROTOBUF_NAMESPACE_CLOSE #undef PROTOBUF_UNUSED diff --git a/contrib/libs/protobuf/src/google/protobuf/reflection.h b/contrib/libs/protobuf/src/google/protobuf/reflection.h index 62ef6e1d82..859724aab2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/reflection.h +++ b/contrib/libs/protobuf/src/google/protobuf/reflection.h @@ -92,7 +92,7 @@ class RepeatedFieldRef< const Reflection* reflection = message.GetReflection(); data_ = reflection->RepeatedFieldData(const_cast<Message*>(&message), field, internal::RefTypeTraits<T>::cpp_type, - NULL); + nullptr); accessor_ = reflection->RepeatedFieldAccessor(field); } @@ -143,7 +143,7 @@ class MutableRepeatedFieldRef< MutableRepeatedFieldRef(Message* message, const FieldDescriptor* field) { const Reflection* reflection = message->GetReflection(); data_ = reflection->RepeatedFieldData( - message, field, internal::RefTypeTraits<T>::cpp_type, NULL); + message, field, internal::RefTypeTraits<T>::cpp_type, nullptr); accessor_ = reflection->RepeatedFieldAccessor(field); } @@ -504,7 +504,7 @@ struct RefTypeTraits< typedef T* IteratorPointerType; static constexpr FieldDescriptor::CppType cpp_type = PrimitiveTraits<T>::cpp_type; - static const Descriptor* GetMessageFieldDescriptor() { return NULL; } + static const Descriptor* GetMessageFieldDescriptor() { return nullptr; } }; template <typename T> @@ -518,7 +518,7 @@ struct RefTypeTraits< typedef arc_i32* IteratorPointerType; static constexpr FieldDescriptor::CppType cpp_type = FieldDescriptor::CPPTYPE_ENUM; - static const Descriptor* GetMessageFieldDescriptor() { return NULL; } + static const Descriptor* GetMessageFieldDescriptor() { return nullptr; } }; template <typename T> @@ -531,7 +531,7 @@ struct RefTypeTraits< typedef const TProtoStringType* IteratorPointerType; static constexpr FieldDescriptor::CppType cpp_type = FieldDescriptor::CPPTYPE_STRING; - static const Descriptor* GetMessageFieldDescriptor() { return NULL; } + static const Descriptor* GetMessageFieldDescriptor() { return nullptr; } }; template <typename T> @@ -542,7 +542,7 @@ struct MessageDescriptorGetter { }; template <> struct MessageDescriptorGetter<Message> { - static const Descriptor* get() { return NULL; } + static const Descriptor* get() { return nullptr; } }; template <typename T> diff --git a/contrib/libs/protobuf/src/google/protobuf/reflection_internal.h b/contrib/libs/protobuf/src/google/protobuf/reflection_internal.h index a3f3d6c1cc..0035db23a5 100644 --- a/contrib/libs/protobuf/src/google/protobuf/reflection_internal.h +++ b/contrib/libs/protobuf/src/google/protobuf/reflection_internal.h @@ -43,25 +43,26 @@ namespace internal { // corresponding random-access methods. class RandomAccessRepeatedFieldAccessor : public RepeatedFieldAccessor { public: - Iterator* BeginIterator(const Field* data) const override { + Iterator* BeginIterator(const Field* /*data*/) const override { return PositionToIterator(0); } Iterator* EndIterator(const Field* data) const override { return PositionToIterator(this->Size(data)); } - Iterator* CopyIterator(const Field* data, + Iterator* CopyIterator(const Field* /*data*/, const Iterator* iterator) const override { return const_cast<Iterator*>(iterator); } - Iterator* AdvanceIterator(const Field* data, + Iterator* AdvanceIterator(const Field* /*data*/, Iterator* iterator) const override { return PositionToIterator(IteratorToPosition(iterator) + 1); } - bool EqualsIterator(const Field* data, const Iterator* a, + bool EqualsIterator(const Field* /*data*/, const Iterator* a, const Iterator* b) const override { return a == b; } - void DeleteIterator(const Field* data, Iterator* iterator) const override {} + void DeleteIterator(const Field* /*data*/, + Iterator* /*iterator*/) const override {} const Value* GetIteratorValue(const Field* data, const Iterator* iterator, Value* scratch_space) const override { return Get(data, static_cast<int>(IteratorToPosition(iterator)), @@ -257,7 +258,7 @@ class MapFieldAccessor final : public RandomAccessRepeatedFieldAccessor { // Convert a MapEntry message stored in the underlying MapFieldBase to an // object that will be returned by this accessor. virtual const Value* ConvertFromEntry(const Message& value, - Value* scratch_space) const { + Value* /*scratch_space*/) const { return static_cast<const Value*>(&value); } }; @@ -285,7 +286,7 @@ class RepeatedFieldPrimitiveAccessor final : public RepeatedFieldWrapper<T> { return *static_cast<const T*>(value); } const Value* ConvertFromT(const T& value, - Value* scratch_space) const override { + Value* /*scratch_space*/) const override { return static_cast<const Value*>(&value); } }; @@ -325,7 +326,7 @@ class RepeatedPtrFieldStringAccessor final *result = *static_cast<const TProtoStringType*>(value); } const Value* ConvertFromT(const TProtoStringType& value, - Value* scratch_space) const override { + Value* /*scratch_space*/) const override { return static_cast<const Value*>(&value); } }; @@ -352,7 +353,7 @@ class RepeatedPtrFieldMessageAccessor final result->CopyFrom(*static_cast<const Message*>(value)); } const Value* ConvertFromT(const Message& value, - Value* scratch_space) const override { + Value* /*scratch_space*/) const override { return static_cast<const Value*>(&value); } }; diff --git a/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc b/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc index 3c30edaa6a..a369ddb001 100644 --- a/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc +++ b/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc @@ -214,9 +214,9 @@ bool ReflectionOps::IsInitialized(const Message& message, bool check_fields, reflection->GetMapData(message, field); if (map_field->IsMapValid()) { MapIterator it(const_cast<Message*>(&message), field); - MapIterator end(const_cast<Message*>(&message), field); - for (map_field->MapBegin(&it), map_field->MapEnd(&end); - it != end; ++it) { + MapIterator end_map(const_cast<Message*>(&message), field); + for (map_field->MapBegin(&it), map_field->MapEnd(&end_map); + it != end_map; ++it) { if (!it.GetValueRef().GetMessageValue().IsInitialized()) { return false; } diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc b/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc index 73434c44e9..016cfbc65e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.cc @@ -38,101 +38,12 @@ #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> -#include <google/protobuf/implicit_weak_message.h> #include <google/protobuf/port_def.inc> namespace google { namespace protobuf { -namespace internal { - -void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) { - int new_size = current_size_ + extend_amount; - if (total_size_ >= new_size) { - // N.B.: rep_ is non-NULL because extend_amount is always > 0, hence - // total_size must be non-zero since it is lower-bounded by new_size. - return &rep_->elements[current_size_]; - } - Rep* old_rep = rep_; - Arena* arena = GetArena(); - new_size = std::max(internal::kRepeatedFieldLowerClampLimit, - std::max(total_size_ * 2, new_size)); - GOOGLE_CHECK_LE(static_cast<arc_i64>(new_size), - static_cast<arc_i64>( - (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) { - rep_ = reinterpret_cast<Rep*>(::operator new(bytes)); - } else { - rep_ = reinterpret_cast<Rep*>(Arena::CreateArray<char>(arena, bytes)); - } -#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) - const int old_total_size = total_size_; -#endif - total_size_ = new_size; - if (old_rep && old_rep->allocated_size > 0) { - memcpy(rep_->elements, old_rep->elements, - old_rep->allocated_size * sizeof(rep_->elements[0])); - rep_->allocated_size = old_rep->allocated_size; - } else { - rep_->allocated_size = 0; - } - if (arena == NULL) { -#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) - const size_t old_size = - old_total_size * sizeof(rep_->elements[0]) + kRepHeaderSize; - ::operator delete(static_cast<void*>(old_rep), old_size); -#else - ::operator delete(static_cast<void*>(old_rep)); -#endif - } - return &rep_->elements[current_size_]; -} - -void RepeatedPtrFieldBase::Reserve(int new_size) { - if (new_size > current_size_) { - InternalExtend(new_size - current_size_); - } -} - -void* RepeatedPtrFieldBase::AddOutOfLineHelper(void* obj) { - if (!rep_ || rep_->allocated_size == total_size_) { - InternalExtend(1); // Equivalent to "Reserve(total_size_ + 1)" - } - ++rep_->allocated_size; - rep_->elements[current_size_++] = obj; - return obj; -} - -void RepeatedPtrFieldBase::CloseGap(int start, int num) { - if (rep_ == NULL) return; - // Close up a gap of "num" elements starting at offset "start". - for (int i = start + num; i < rep_->allocated_size; ++i) - rep_->elements[i - num] = rep_->elements[i]; - current_size_ -= num; - rep_->allocated_size -= num; -} - -MessageLite* RepeatedPtrFieldBase::AddWeak(const MessageLite* prototype) { - if (rep_ != NULL && current_size_ < rep_->allocated_size) { - return reinterpret_cast<MessageLite*>(rep_->elements[current_size_++]); - } - if (!rep_ || rep_->allocated_size == total_size_) { - Reserve(total_size_ + 1); - } - ++rep_->allocated_size; - MessageLite* result = prototype - ? prototype->New(arena_) - : Arena::CreateMessage<ImplicitWeakMessage>(arena_); - rep_->elements[current_size_++] = result; - return result; -} - -} // namespace internal - template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<bool>; template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<arc_i32>; diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h index 1a77fea295..2b7fe6135d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h @@ -42,6 +42,8 @@ // Typically, clients should not need to access RepeatedField objects directly, // but should instead use the accessor functions generated automatically by the // protocol compiler. +// +// This header covers RepeatedField. #ifndef GOOGLE_PROTOBUF_REPEATED_FIELD_H__ #define GOOGLE_PROTOBUF_REPEATED_FIELD_H__ @@ -59,11 +61,10 @@ #include <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> +#include <google/protobuf/repeated_ptr_field.h> #include <google/protobuf/arena.h> #include <google/protobuf/message_lite.h> #include <google/protobuf/port.h> -#include <google/protobuf/stubs/casts.h> -#include <type_traits> // Must be included last. @@ -77,16 +78,9 @@ namespace google { namespace protobuf { class Message; -class Reflection; - -template <typename T> -struct WeakRepeatedPtrField; namespace internal { -class MergePartialFromCodedStreamHelper; -class SwapFieldHelper; - // kRepeatedFieldLowerClampLimit is the smallest size that will be allocated // when growing a repeated field. constexpr int kRepeatedFieldLowerClampLimit = 4; @@ -98,9 +92,6 @@ constexpr int kRepeatedFieldLowerClampLimit = 4; constexpr int kRepeatedFieldUpperClampLimit = (std::numeric_limits<int>::max() / 2) + 1; -// A utility function for logging that doesn't need any template types. -void LogIndexOutOfBounds(int index, int size); - template <typename Iter> inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) { return static_cast<int>(std::distance(begin, end)); @@ -213,7 +204,7 @@ class RepeatedField { void RemoveLast(); // Extract elements with indices in "[start .. start+num-1]". - // Copy them into "elements[0 .. num-1]" if "elements" is not NULL. + // Copy them into "elements[0 .. num-1]" if "elements" is not nullptr. // Caution: implementation also moves elements with indices [start+num ..]. // Calling this routine inside a loop can cause quadratic behavior. void ExtractSubrange(int start, int num, Element* elements); @@ -391,7 +382,7 @@ class RepeatedField { // Internal helper to delete all elements and deallocate the storage. void InternalDeallocate(Rep* rep, int size) { - if (rep != NULL) { + if (rep != nullptr) { Element* e = &rep->elements[0]; if (!std::is_trivial<Element>::value) { Element* limit = &rep->elements[size]; @@ -399,7 +390,7 @@ class RepeatedField { e->~Element(); } } - if (rep->arena == NULL) { + if (rep->arena == nullptr) { #if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) const size_t bytes = size * sizeof(*e) + kRepHeaderSize; ::operator delete(static_cast<void*>(rep), bytes); @@ -497,13 +488,6 @@ class RepeatedField { }; namespace internal { -template <typename It> -class RepeatedPtrIterator; -template <typename It, typename VoidPtr> -class RepeatedPtrOverPtrsIterator; -} // namespace internal - -namespace internal { // This is a helper template to copy an array of elements efficiently when they // have a trivial copy constructor, and correctly otherwise. This really @@ -517,702 +501,6 @@ struct ElementCopier { } // namespace internal -namespace internal { - -// type-traits helper for RepeatedPtrFieldBase: we only want to invoke -// arena-related "copy if on different arena" behavior if the necessary methods -// exist on the contained type. In particular, we rely on MergeFrom() existing -// as a general proxy for the fact that a copy will work, and we also provide a -// specific override for TProtoStringType*. -template <typename T> -struct TypeImplementsMergeBehaviorProbeForMergeFrom { - typedef char HasMerge; - typedef long HasNoMerge; - - // We accept either of: - // - void MergeFrom(const T& other) - // - bool MergeFrom(const T& other) - // - // We mangle these names a bit to avoid compatibility issues in 'unclean' - // include environments that may have, e.g., "#define test ..." (yes, this - // exists). - template <typename U, typename RetType, RetType (U::*)(const U& arg)> - struct CheckType; - template <typename U> - static HasMerge Check(CheckType<U, void, &U::MergeFrom>*); - template <typename U> - static HasMerge Check(CheckType<U, bool, &U::MergeFrom>*); - template <typename U> - static HasNoMerge Check(...); - - // Resolves to either std::true_type or std::false_type. - typedef std::integral_constant<bool, - (sizeof(Check<T>(0)) == sizeof(HasMerge))> - type; -}; - -template <typename T, typename = void> -struct TypeImplementsMergeBehavior - : TypeImplementsMergeBehaviorProbeForMergeFrom<T> {}; - - -template <> -struct TypeImplementsMergeBehavior<TProtoStringType> { - typedef std::true_type type; -}; - -template <typename T> -struct IsMovable - : std::integral_constant<bool, std::is_move_constructible<T>::value && - std::is_move_assignable<T>::value> {}; - -// This is the common base class for RepeatedPtrFields. It deals only in void* -// pointers. Users should not use this interface directly. -// -// The methods of this interface correspond to the methods of RepeatedPtrField, -// but may have a template argument called TypeHandler. Its signature is: -// class TypeHandler { -// public: -// typedef MyType Type; -// static Type* New(); -// static Type* NewFromPrototype(const Type* prototype, -// Arena* arena); -// static void Delete(Type*); -// static void Clear(Type*); -// static void Merge(const Type& from, Type* to); -// -// // Only needs to be implemented if SpaceUsedExcludingSelf() is called. -// static int SpaceUsedLong(const Type&); -// }; -class PROTOBUF_EXPORT RepeatedPtrFieldBase { - protected: - constexpr RepeatedPtrFieldBase(); - explicit RepeatedPtrFieldBase(Arena* arena); - ~RepeatedPtrFieldBase() { -#ifndef NDEBUG - // Try to trigger segfault / asan failure in non-opt builds. If arena_ - // lifetime has ended before the destructor. - if (arena_) (void)arena_->SpaceAllocated(); -#endif - } - - // Must be called from destructor. - template <typename TypeHandler> - void Destroy(); - - bool empty() const; - int size() const; - - template <typename TypeHandler> - const typename TypeHandler::Type& at(int index) const; - template <typename TypeHandler> - typename TypeHandler::Type& at(int index); - - template <typename TypeHandler> - typename TypeHandler::Type* Mutable(int index); - template <typename TypeHandler> - void Delete(int index); - template <typename TypeHandler> - typename TypeHandler::Type* Add(typename TypeHandler::Type* prototype = NULL); - - public: - // The next few methods are public so that they can be called from generated - // code when implicit weak fields are used, but they should never be called by - // application code. - - template <typename TypeHandler> - const typename TypeHandler::Type& Get(int index) const; - - // Creates and adds an element using the given prototype, without introducing - // a link-time dependency on the concrete message type. This method is used to - // implement implicit weak fields. The prototype may be NULL, in which case an - // ImplicitWeakMessage will be used as a placeholder. - MessageLite* AddWeak(const MessageLite* prototype); - - template <typename TypeHandler> - void Clear(); - - template <typename TypeHandler> - void MergeFrom(const RepeatedPtrFieldBase& other); - - inline void InternalSwap(RepeatedPtrFieldBase* other); - - protected: - template < - typename TypeHandler, - typename std::enable_if<TypeHandler::Movable::value>::type* = nullptr> - void Add(typename TypeHandler::Type&& value); - - template <typename TypeHandler> - void RemoveLast(); - template <typename TypeHandler> - void CopyFrom(const RepeatedPtrFieldBase& other); - - void CloseGap(int start, int num); - - void Reserve(int new_size); - - template<typename TypeHandler> - void Truncate(int new_size) { - GOOGLE_DCHECK_LE(new_size, current_size_); - for (int i = new_size; i < current_size_; i++) { - TypeHandler::Clear(cast<TypeHandler>(rep_->elements[i])); - } - current_size_ = new_size; - } - - int Capacity() const; - - template <typename TypeHandler> - static inline typename TypeHandler::Type* copy( - typename TypeHandler::Type* value) { - auto* new_value = TypeHandler::NewFromPrototype(value, nullptr); - TypeHandler::Merge(*value, new_value); - return new_value; - } - - // Used for constructing iterators. - void* const* raw_data() const; - void** raw_mutable_data() const; - - template <typename TypeHandler> - typename TypeHandler::Type** mutable_data(); - template <typename TypeHandler> - const typename TypeHandler::Type* const* data() const; - - template <typename TypeHandler> - PROTOBUF_NDEBUG_INLINE void Swap(RepeatedPtrFieldBase* other); - - void SwapElements(int index1, int index2); - - template <typename TypeHandler> - size_t SpaceUsedExcludingSelfLong() const; - - // Advanced memory management -------------------------------------- - - // Like Add(), but if there are no cleared objects to use, returns NULL. - template <typename TypeHandler> - typename TypeHandler::Type* AddFromCleared(); - - template <typename TypeHandler> - void AddAllocated(typename TypeHandler::Type* value) { - typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t; - AddAllocatedInternal<TypeHandler>(value, t); - } - - template <typename TypeHandler> - void UnsafeArenaAddAllocated(typename TypeHandler::Type* value); - - template <typename TypeHandler> - PROTOBUF_MUST_USE_RESULT typename TypeHandler::Type* ReleaseLast() { - typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t; - return ReleaseLastInternal<TypeHandler>(t); - } - - // Releases last element and returns it, but does not do out-of-arena copy. - // And just returns the raw pointer to the contained element in the arena. - template <typename TypeHandler> - typename TypeHandler::Type* UnsafeArenaReleaseLast(); - - int ClearedCount() const; - template <typename TypeHandler> - void AddCleared(typename TypeHandler::Type* value); - template <typename TypeHandler> - PROTOBUF_MUST_USE_RESULT typename TypeHandler::Type* ReleaseCleared(); - - template <typename TypeHandler> - void AddAllocatedInternal(typename TypeHandler::Type* value, std::true_type); - template <typename TypeHandler> - void AddAllocatedInternal(typename TypeHandler::Type* value, std::false_type); - - template <typename TypeHandler> - PROTOBUF_NOINLINE void AddAllocatedSlowWithCopy( - typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena); - template <typename TypeHandler> - PROTOBUF_NOINLINE void AddAllocatedSlowWithoutCopy( - typename TypeHandler::Type* value); - - template <typename TypeHandler> - typename TypeHandler::Type* ReleaseLastInternal(std::true_type); - template <typename TypeHandler> - typename TypeHandler::Type* ReleaseLastInternal(std::false_type); - - template <typename TypeHandler> - PROTOBUF_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other); - - inline Arena* GetArena() const { return arena_; } - - private: - static constexpr int kInitialSize = 0; - // A few notes on internal representation: - // - // We use an indirected approach, with struct Rep, to keep - // sizeof(RepeatedPtrFieldBase) equivalent to what it was before arena support - // was added, namely, 3 8-byte machine words on x86-64. An instance of Rep is - // allocated only when the repeated field is non-empty, and it is a - // dynamically-sized struct (the header is directly followed by elements[]). - // We place arena_ and current_size_ directly in the object to avoid cache - // misses due to the indirection, because these fields are checked frequently. - // Placing all fields directly in the RepeatedPtrFieldBase instance costs - // significant performance for memory-sensitive workloads. - Arena* arena_; - int current_size_; - int total_size_; - struct Rep { - int allocated_size; - // Here we declare a huge array as a way of approximating C's "flexible - // array member" feature without relying on undefined behavior. - void* elements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) / - sizeof(void*)]; - }; - static constexpr size_t kRepHeaderSize = offsetof(Rep, elements); - Rep* rep_; - - template <typename TypeHandler> - static inline typename TypeHandler::Type* cast(void* element) { - return reinterpret_cast<typename TypeHandler::Type*>(element); - } - template <typename TypeHandler> - static inline const typename TypeHandler::Type* cast(const void* element) { - return reinterpret_cast<const typename TypeHandler::Type*>(element); - } - - // Non-templated inner function to avoid code duplication. Takes a function - // pointer to the type-specific (templated) inner allocate/merge loop. - void MergeFromInternal(const RepeatedPtrFieldBase& other, - void (RepeatedPtrFieldBase::*inner_loop)(void**, - void**, int, - int)); - - template <typename TypeHandler> - PROTOBUF_NOINLINE void MergeFromInnerLoop(void** our_elems, - void** other_elems, int length, - int already_allocated); - - // Internal helper: extend array space if necessary to contain |extend_amount| - // more elements, and return a pointer to the element immediately following - // the old list of elements. This interface factors out common behavior from - // Reserve() and MergeFrom() to reduce code size. |extend_amount| must be > 0. - void** InternalExtend(int extend_amount); - - // Internal helper for Add: add "obj" as the next element in the - // array, including potentially resizing the array with Reserve if - // needed - void* AddOutOfLineHelper(void* obj); - - // The reflection implementation needs to call protected methods directly, - // reinterpreting pointers as being to Message instead of a specific Message - // subclass. - friend class ::PROTOBUF_NAMESPACE_ID::Reflection; - friend class ::PROTOBUF_NAMESPACE_ID::internal::SwapFieldHelper; - - // ExtensionSet stores repeated message extensions as - // RepeatedPtrField<MessageLite>, but non-lite ExtensionSets need to implement - // SpaceUsedLong(), and thus need to call SpaceUsedExcludingSelfLong() - // reinterpreting MessageLite as Message. ExtensionSet also needs to make use - // of AddFromCleared(), which is not part of the public interface. - friend class ExtensionSet; - - // The MapFieldBase implementation needs to call protected methods directly, - // reinterpreting pointers as being to Message instead of a specific Message - // subclass. - friend class MapFieldBase; - friend class MapFieldBaseStub; - - // The table-driven MergePartialFromCodedStream implementation needs to - // operate on RepeatedPtrField<MessageLite>. - friend class MergePartialFromCodedStreamHelper; - friend class AccessorHelper; - template <typename T> - friend struct google::protobuf::WeakRepeatedPtrField; - - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase); -}; - -template <typename GenericType> -class GenericTypeHandler { - public: - typedef GenericType Type; - using Movable = IsMovable<GenericType>; - - static inline GenericType* New(Arena* arena) { - return Arena::CreateMaybeMessage<Type>(arena); - } - static inline GenericType* New(Arena* arena, GenericType&& value) { - return Arena::Create<GenericType>(arena, std::move(value)); - } - static inline GenericType* NewFromPrototype(const GenericType* prototype, - Arena* arena = NULL); - static inline void Delete(GenericType* value, Arena* arena) { - if (arena == NULL) { - delete value; - } - } - static inline Arena* GetOwningArena(GenericType* value) { - return Arena::GetOwningArena<Type>(value); - } - - static inline void Clear(GenericType* value) { value->Clear(); } - PROTOBUF_NOINLINE - static void Merge(const GenericType& from, GenericType* to); - static inline size_t SpaceUsedLong(const GenericType& value) { - return value.SpaceUsedLong(); - } -}; - -template <typename GenericType> -GenericType* GenericTypeHandler<GenericType>::NewFromPrototype( - const GenericType* /* prototype */, Arena* arena) { - return New(arena); -} -template <typename GenericType> -void GenericTypeHandler<GenericType>::Merge(const GenericType& from, - GenericType* to) { - to->MergeFrom(from); -} - -// NewFromPrototype() and Merge() are not defined inline here, as we will need -// to do a virtual function dispatch anyways to go from Message* to call -// New/Merge. -template <> -MessageLite* GenericTypeHandler<MessageLite>::NewFromPrototype( - const MessageLite* prototype, Arena* arena); -template <> -inline Arena* GenericTypeHandler<MessageLite>::GetOwningArena( - MessageLite* value) { - return value->GetOwningArena(); -} -template <> -void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from, - MessageLite* to); -template <> -inline void GenericTypeHandler<TProtoStringType>::Clear(TProtoStringType* value) { - value->clear(); -} -template <> -void GenericTypeHandler<TProtoStringType>::Merge(const TProtoStringType& from, - TProtoStringType* to); - -// Message specialization bodies defined in message.cc. This split is necessary -// to allow proto2-lite (which includes this header) to be independent of -// Message. -template <> -PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype( - const Message* prototype, Arena* arena); -template <> -PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetOwningArena( - Message* value); - -class StringTypeHandler { - public: - typedef TProtoStringType Type; - using Movable = IsMovable<Type>; - - static inline TProtoStringType* New(Arena* arena) { - return Arena::Create<TProtoStringType>(arena); - } - static inline TProtoStringType* New(Arena* arena, TProtoStringType&& value) { - return Arena::Create<TProtoStringType>(arena, std::move(value)); - } - static inline TProtoStringType* NewFromPrototype(const TProtoStringType*, - Arena* arena) { - return New(arena); - } - static inline Arena* GetOwningArena(TProtoStringType*) { return nullptr; } - static inline void Delete(TProtoStringType* value, Arena* arena) { - if (arena == NULL) { - delete value; - } - } - static inline void Clear(TProtoStringType* value) { value->clear(); } - static inline void Merge(const TProtoStringType& from, TProtoStringType* to) { - *to = from; - } - static size_t SpaceUsedLong(const TProtoStringType& value) { - return sizeof(value) + StringSpaceUsedExcludingSelfLong(value); - } -}; - -} // namespace internal - -// RepeatedPtrField is like RepeatedField, but used for repeated strings or -// Messages. -template <typename Element> -class RepeatedPtrField : private internal::RepeatedPtrFieldBase { - public: - constexpr RepeatedPtrField(); - explicit RepeatedPtrField(Arena* arena); - - RepeatedPtrField(const RepeatedPtrField& other); - - template <typename Iter, - typename = typename std::enable_if<std::is_constructible< - Element, decltype(*std::declval<Iter>())>::value>::type> - RepeatedPtrField(Iter begin, Iter end); - - ~RepeatedPtrField(); - - RepeatedPtrField& operator=(const RepeatedPtrField& other); - - RepeatedPtrField(RepeatedPtrField&& other) noexcept; - RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept; - - bool empty() const; - int size() const; - - const Element& Get(int index) const; - Element* Mutable(int index); - Element* Add(); - void Add(Element&& value); - // Append elements in the range [begin, end) after reserving - // the appropriate number of elements. - template <typename Iter> - void Add(Iter begin, Iter end); - - const Element& operator[](int index) const { return Get(index); } - Element& operator[](int index) { return *Mutable(index); } - - const Element& at(int index) const; - Element& at(int index); - - // Remove the last element in the array. - // Ownership of the element is retained by the array. - void RemoveLast(); - - // Delete elements with indices in the range [start .. start+num-1]. - // Caution: implementation moves all elements with indices [start+num .. ]. - // Calling this routine inside a loop can cause quadratic behavior. - void DeleteSubrange(int start, int num); - - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear(); - void MergeFrom(const RepeatedPtrField& other); - PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other); - - // Replaces the contents with RepeatedPtrField(begin, end). - template <typename Iter> - 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 - // array is grown, it will always be at least doubled in size. - void Reserve(int new_size); - - void Truncate(int new_size) { - return RepeatedPtrFieldBase::Truncate<TypeHandler>(new_size); - } - - int Capacity() const; - - // Gets the underlying array. This pointer is possibly invalidated by - // any add or remove operation. - Element** mutable_data(); - const Element* const* data() const; - - // Swap entire contents with "other". If they are on separate arenas, then - // copies data. - void Swap(RepeatedPtrField* other); - - // Swap entire contents with "other". Caller should guarantee that either both - // fields are on the same arena or both are on the heap. Swapping between - // different arenas with this function is disallowed and is caught via - // GOOGLE_DCHECK. - void UnsafeArenaSwap(RepeatedPtrField* other); - - // Swap two elements. - void SwapElements(int index1, int index2); - - // STL-like iterator support - typedef internal::RepeatedPtrIterator<Element> iterator; - typedef internal::RepeatedPtrIterator<const Element> const_iterator; - typedef Element value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef int size_type; - typedef ptrdiff_t difference_type; - - iterator begin(); - const_iterator begin() const; - const_iterator cbegin() const; - iterator end(); - const_iterator end() const; - const_iterator cend() const; - - // Reverse iterator support - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - typedef std::reverse_iterator<iterator> reverse_iterator; - reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - // Custom STL-like iterator that iterates over and returns the underlying - // pointers to Element rather than Element itself. - typedef internal::RepeatedPtrOverPtrsIterator<Element*, void*> - pointer_iterator; - typedef internal::RepeatedPtrOverPtrsIterator<const Element* const, - const void* const> - const_pointer_iterator; - pointer_iterator pointer_begin(); - const_pointer_iterator pointer_begin() const; - pointer_iterator pointer_end(); - const_pointer_iterator pointer_end() const; - - // Returns (an estimate of) the number of bytes used by the repeated field, - // excluding sizeof(*this). - size_t SpaceUsedExcludingSelfLong() const; - - int SpaceUsedExcludingSelf() const { - return internal::ToIntSize(SpaceUsedExcludingSelfLong()); - } - - // Advanced memory management -------------------------------------- - // When hardcore memory management becomes necessary -- as it sometimes - // does here at Google -- the following methods may be useful. - - // Add an already-allocated object, passing ownership to the - // RepeatedPtrField. - // - // Note that some special behavior occurs with respect to arenas: - // - // (i) if this field holds submessages, the new submessage will be copied if - // the original is in an arena and this RepeatedPtrField is either in a - // different arena, or on the heap. - // (ii) if this field holds strings, the passed-in string *must* be - // heap-allocated, not arena-allocated. There is no way to dynamically check - // this at runtime, so User Beware. - void AddAllocated(Element* value); - - // Remove the last element and return it, passing ownership to the caller. - // Requires: size() > 0 - // - // If this RepeatedPtrField is on an arena, an object copy is required to pass - // ownership back to the user (for compatible semantics). Use - // UnsafeArenaReleaseLast() if this behavior is undesired. - PROTOBUF_MUST_USE_RESULT Element* ReleaseLast(); - - // Add an already-allocated object, skipping arena-ownership checks. The user - // must guarantee that the given object is in the same arena as this - // RepeatedPtrField. - // It is also useful in legacy code that uses temporary ownership to avoid - // copies. Example: - // RepeatedPtrField<T> temp_field; - // temp_field.UnsafeArenaAddAllocated(new T); - // ... // Do something with temp_field - // 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. 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]". - // The caller assumes ownership of the extracted elements and is responsible - // for deleting them when they are no longer needed. - // If "elements" is non-NULL, then pointers to the extracted elements - // are stored in "elements[0 .. num-1]" for the convenience of the caller. - // If "elements" is NULL, then the caller must use some other mechanism - // to perform any further operations (like deletion) on these elements. - // Caution: implementation also moves elements with indices [start+num ..]. - // Calling this routine inside a loop can cause quadratic behavior. - // - // Memory copying behavior is identical to ReleaseLast(), described above: if - // this RepeatedPtrField is on an arena, an object copy is performed for each - // returned element, so that all returned element pointers are to - // heap-allocated copies. If this copy is not desired, the user should call - // UnsafeArenaExtractSubrange(). - void ExtractSubrange(int start, int num, Element** elements); - - // 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 - // are not actually freed. Instead, they are cleared and kept so that - // they can be reused later. This can save lots of CPU time when - // repeatedly reusing a protocol message for similar purposes. - // - // Hardcore programs may choose to manipulate these cleared objects - // to better optimize memory management using the following routines. - - // Get the number of cleared objects that are currently being kept - // around for reuse. - int ClearedCount() const; - // Add an element to the pool of cleared objects, passing ownership to - // the RepeatedPtrField. The element must be cleared prior to calling - // this method. - // - // This method cannot be called when the repeated field is on an arena or when - // |value| is; both cases will trigger a GOOGLE_DCHECK-failure. - void AddCleared(Element* value); - // Remove a single element from the cleared pool and return it, passing - // ownership to the caller. The element is guaranteed to be cleared. - // Requires: ClearedCount() > 0 - // - // - // This method cannot be called when the repeated field is on an arena; doing - // so will trigger a GOOGLE_DCHECK-failure. - PROTOBUF_MUST_USE_RESULT Element* ReleaseCleared(); - - // Removes the element referenced by position. - // - // Returns an iterator to the element immediately following the removed - // element. - // - // Invalidates all iterators at or after the removed element, including end(). - iterator erase(const_iterator position); - - // Removes the elements in the range [first, last). - // - // Returns an iterator to the element immediately following the removed range. - // - // Invalidates all iterators at or after the removed range, including end(). - iterator erase(const_iterator first, const_iterator last); - - // Gets the arena on which this RepeatedPtrField stores its elements. - inline Arena* GetArena() const; - - // For internal use only. - // - // This is public due to it being called by generated code. - void InternalSwap(RepeatedPtrField* other) { - internal::RepeatedPtrFieldBase::InternalSwap(other); - } - - private: - // Note: RepeatedPtrField SHOULD NOT be subclassed by users. - class TypeHandler; - - // Implementations for ExtractSubrange(). The copying behavior must be - // included only if the type supports the necessary operations (e.g., - // MergeFrom()), so we must resolve this at compile time. ExtractSubrange() - // uses SFINAE to choose one of the below implementations. - void ExtractSubrangeInternal(int start, int num, Element** elements, - std::true_type); - void ExtractSubrangeInternal(int start, int num, Element** elements, - std::false_type); - - friend class Arena; - - template <typename T> - friend struct WeakRepeatedPtrField; - - typedef void InternalArenaConstructable_; - -}; - // implementation ==================================================== template <typename Element> @@ -1443,7 +731,7 @@ void RepeatedField<Element>::ExtractSubrange(int start, int num, GOOGLE_DCHECK_LE(start + num, this->current_size_); // Save the values of the removed elements if requested. - if (elements != NULL) { + if (elements != nullptr) { for (int i = 0; i < num; ++i) elements[i] = this->Get(i + start); } @@ -1618,7 +906,7 @@ inline int CalculateReserveSize(int total_size, int new_size) { template <typename Element> void RepeatedField<Element>::Reserve(int new_size) { if (total_size_ >= new_size) return; - Rep* old_rep = total_size_ > 0 ? rep() : NULL; + Rep* old_rep = total_size_ > 0 ? rep() : nullptr; Rep* new_rep; Arena* arena = GetArena(); new_size = internal::CalculateReserveSize(total_size_, new_size); @@ -1628,7 +916,7 @@ void RepeatedField<Element>::Reserve(int new_size) { << "Requested size is too large to fit into size_t."; size_t bytes = kRepHeaderSize + sizeof(Element) * static_cast<size_t>(new_size); - if (arena == NULL) { + if (arena == nullptr) { new_rep = static_cast<Rep*>(::operator new(bytes)); } else { new_rep = reinterpret_cast<Rep*>(Arena::CreateArray<char>(arena, bytes)); @@ -1705,1053 +993,6 @@ struct ElementCopier<Element, true> { // ------------------------------------------------------------------- -namespace internal { - -constexpr RepeatedPtrFieldBase::RepeatedPtrFieldBase() - : arena_(NULL), current_size_(0), total_size_(0), rep_(NULL) {} - -inline RepeatedPtrFieldBase::RepeatedPtrFieldBase(Arena* arena) - : arena_(arena), current_size_(0), total_size_(0), rep_(NULL) {} - -template <typename TypeHandler> -void RepeatedPtrFieldBase::Destroy() { - if (rep_ != NULL && arena_ == NULL) { - int n = rep_->allocated_size; - void* const* elements = rep_->elements; - for (int i = 0; i < n; i++) { - TypeHandler::Delete(cast<TypeHandler>(elements[i]), NULL); - } -#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) - const size_t size = total_size_ * sizeof(elements[0]) + kRepHeaderSize; - ::operator delete(static_cast<void*>(rep_), size); -#else - ::operator delete(static_cast<void*>(rep_)); -#endif - } - rep_ = NULL; -} - -template <typename TypeHandler> -inline void RepeatedPtrFieldBase::Swap(RepeatedPtrFieldBase* other) { -#ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetArena() != nullptr && GetArena() == other->GetArena()) { -#else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetArena() == other->GetArena()) { -#endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - SwapFallback<TypeHandler>(other); - } -} - -template <typename TypeHandler> -void RepeatedPtrFieldBase::SwapFallback(RepeatedPtrFieldBase* other) { -#ifdef PROTOBUF_FORCE_COPY_IN_SWAP - GOOGLE_DCHECK(GetArena() == nullptr || other->GetArena() != GetArena()); -#else // PROTOBUF_FORCE_COPY_IN_SWAP - GOOGLE_DCHECK(other->GetArena() != GetArena()); -#endif // !PROTOBUF_FORCE_COPY_IN_SWAP - - // Copy semantics in this case. We try to improve efficiency by placing the - // temporary on |other|'s arena so that messages are copied twice rather than - // three times. - RepeatedPtrFieldBase temp(other->GetArena()); - temp.MergeFrom<TypeHandler>(*this); - this->Clear<TypeHandler>(); - this->MergeFrom<TypeHandler>(*other); - other->InternalSwap(&temp); - temp.Destroy<TypeHandler>(); // Frees rep_ if `other` had no arena. -} - -inline bool RepeatedPtrFieldBase::empty() const { return current_size_ == 0; } - -inline int RepeatedPtrFieldBase::size() const { return current_size_; } - -template <typename TypeHandler> -inline const typename TypeHandler::Type& RepeatedPtrFieldBase::Get( - int index) const { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); - return *cast<TypeHandler>(rep_->elements[index]); -} - -template <typename TypeHandler> -inline const typename TypeHandler::Type& RepeatedPtrFieldBase::at( - int index) const { - GOOGLE_CHECK_GE(index, 0); - GOOGLE_CHECK_LT(index, current_size_); - return *cast<TypeHandler>(rep_->elements[index]); -} - -template <typename TypeHandler> -inline typename TypeHandler::Type& RepeatedPtrFieldBase::at(int index) { - GOOGLE_CHECK_GE(index, 0); - GOOGLE_CHECK_LT(index, current_size_); - return *cast<TypeHandler>(rep_->elements[index]); -} - -template <typename TypeHandler> -inline typename TypeHandler::Type* RepeatedPtrFieldBase::Mutable(int index) { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); - return cast<TypeHandler>(rep_->elements[index]); -} - -template <typename TypeHandler> -inline void RepeatedPtrFieldBase::Delete(int index) { - GOOGLE_DCHECK_GE(index, 0); - GOOGLE_DCHECK_LT(index, current_size_); - TypeHandler::Delete(cast<TypeHandler>(rep_->elements[index]), arena_); -} - -template <typename TypeHandler> -inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add( - typename TypeHandler::Type* prototype) { - if (rep_ != NULL && current_size_ < rep_->allocated_size) { - return cast<TypeHandler>(rep_->elements[current_size_++]); - } - typename TypeHandler::Type* result = - TypeHandler::NewFromPrototype(prototype, arena_); - return reinterpret_cast<typename TypeHandler::Type*>( - AddOutOfLineHelper(result)); -} - -template <typename TypeHandler, - typename std::enable_if<TypeHandler::Movable::value>::type*> -inline void RepeatedPtrFieldBase::Add(typename TypeHandler::Type&& value) { - if (rep_ != NULL && current_size_ < rep_->allocated_size) { - *cast<TypeHandler>(rep_->elements[current_size_++]) = std::move(value); - return; - } - if (!rep_ || rep_->allocated_size == total_size_) { - Reserve(total_size_ + 1); - } - ++rep_->allocated_size; - typename TypeHandler::Type* result = - TypeHandler::New(arena_, std::move(value)); - rep_->elements[current_size_++] = result; -} - -template <typename TypeHandler> -inline void RepeatedPtrFieldBase::RemoveLast() { - GOOGLE_DCHECK_GT(current_size_, 0); - TypeHandler::Clear(cast<TypeHandler>(rep_->elements[--current_size_])); -} - -template <typename TypeHandler> -void RepeatedPtrFieldBase::Clear() { - const int n = current_size_; - GOOGLE_DCHECK_GE(n, 0); - if (n > 0) { - void* const* elements = rep_->elements; - int i = 0; - do { - TypeHandler::Clear(cast<TypeHandler>(elements[i++])); - } while (i < n); - current_size_ = 0; - } -} - -// To avoid unnecessary code duplication and reduce binary size, we use a -// layered approach to implementing MergeFrom(). The toplevel method is -// templated, so we get a small thunk per concrete message type in the binary. -// This calls a shared implementation with most of the logic, passing a function -// pointer to another type-specific piece of code that calls the object-allocate -// and merge handlers. -template <typename TypeHandler> -inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) { - GOOGLE_DCHECK_NE(&other, this); - if (other.current_size_ == 0) return; - MergeFromInternal(other, - &RepeatedPtrFieldBase::MergeFromInnerLoop<TypeHandler>); -} - -inline void RepeatedPtrFieldBase::MergeFromInternal( - const RepeatedPtrFieldBase& other, - void (RepeatedPtrFieldBase::*inner_loop)(void**, void**, int, int)) { - // Note: wrapper has already guaranteed that other.rep_ != NULL here. - int other_size = other.current_size_; - void** other_elements = other.rep_->elements; - void** new_elements = InternalExtend(other_size); - int allocated_elems = rep_->allocated_size - current_size_; - (this->*inner_loop)(new_elements, other_elements, other_size, - allocated_elems); - current_size_ += other_size; - if (rep_->allocated_size < current_size_) { - rep_->allocated_size = current_size_; - } -} - -// Merges other_elems to our_elems. -template <typename TypeHandler> -void RepeatedPtrFieldBase::MergeFromInnerLoop(void** our_elems, - void** other_elems, int length, - int already_allocated) { - if (already_allocated < length) { - Arena* arena = GetArena(); - typename TypeHandler::Type* elem_prototype = - reinterpret_cast<typename TypeHandler::Type*>(other_elems[0]); - for (int i = already_allocated; i < length; i++) { - // Allocate a new empty element that we'll merge into below - typename TypeHandler::Type* new_elem = - TypeHandler::NewFromPrototype(elem_prototype, arena); - our_elems[i] = new_elem; - } - } - // Main loop that does the actual merging - for (int i = 0; i < length; i++) { - // Already allocated: use existing element. - typename TypeHandler::Type* other_elem = - reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]); - typename TypeHandler::Type* new_elem = - reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]); - TypeHandler::Merge(*other_elem, new_elem); - } -} - -template <typename TypeHandler> -inline void RepeatedPtrFieldBase::CopyFrom(const RepeatedPtrFieldBase& other) { - if (&other == this) return; - RepeatedPtrFieldBase::Clear<TypeHandler>(); - RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other); -} - -inline int RepeatedPtrFieldBase::Capacity() const { return total_size_; } - -inline void* const* RepeatedPtrFieldBase::raw_data() const { - return rep_ ? rep_->elements : NULL; -} - -inline void** RepeatedPtrFieldBase::raw_mutable_data() const { - return rep_ ? const_cast<void**>(rep_->elements) : NULL; -} - -template <typename TypeHandler> -inline typename TypeHandler::Type** RepeatedPtrFieldBase::mutable_data() { - // TODO(kenton): Breaks C++ aliasing rules. We should probably remove this - // method entirely. - return reinterpret_cast<typename TypeHandler::Type**>(raw_mutable_data()); -} - -template <typename TypeHandler> -inline const typename TypeHandler::Type* const* RepeatedPtrFieldBase::data() - const { - // TODO(kenton): Breaks C++ aliasing rules. We should probably remove this - // method entirely. - return reinterpret_cast<const typename TypeHandler::Type* const*>(raw_data()); -} - -inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { - using std::swap; // enable ADL with fallback - swap(rep_->elements[index1], rep_->elements[index2]); -} - -template <typename TypeHandler> -inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const { - size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*); - if (rep_ != NULL) { - for (int i = 0; i < rep_->allocated_size; ++i) { - allocated_bytes += - TypeHandler::SpaceUsedLong(*cast<TypeHandler>(rep_->elements[i])); - } - allocated_bytes += kRepHeaderSize; - } - return allocated_bytes; -} - -template <typename TypeHandler> -inline typename TypeHandler::Type* RepeatedPtrFieldBase::AddFromCleared() { - if (rep_ != NULL && current_size_ < rep_->allocated_size) { - return cast<TypeHandler>(rep_->elements[current_size_++]); - } else { - return NULL; - } -} - -// AddAllocated version that implements arena-safe copying behavior. -template <typename TypeHandler> -void RepeatedPtrFieldBase::AddAllocatedInternal( - typename TypeHandler::Type* value, std::true_type) { - Arena* element_arena = - reinterpret_cast<Arena*>(TypeHandler::GetOwningArena(value)); - Arena* arena = GetArena(); - if (arena == element_arena && rep_ && rep_->allocated_size < total_size_) { - // Fast path: underlying arena representation (tagged pointer) is equal to - // our arena pointer, and we can add to array without resizing it (at least - // one slot that is not allocated). - void** elems = rep_->elements; - if (current_size_ < rep_->allocated_size) { - // Make space at [current] by moving first allocated element to end of - // allocated list. - elems[rep_->allocated_size] = elems[current_size_]; - } - elems[current_size_] = value; - current_size_ = current_size_ + 1; - rep_->allocated_size = rep_->allocated_size + 1; - } else { - AddAllocatedSlowWithCopy<TypeHandler>(value, element_arena, arena); - } -} - -// Slowpath handles all cases, copying if necessary. -template <typename TypeHandler> -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) { - // 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). - if (my_arena != NULL && value_arena == NULL) { - my_arena->Own(value); - } else if (my_arena != value_arena) { - typename TypeHandler::Type* new_value = - TypeHandler::NewFromPrototype(value, my_arena); - TypeHandler::Merge(*value, new_value); - TypeHandler::Delete(value, value_arena); - value = new_value; - } - - UnsafeArenaAddAllocated<TypeHandler>(value); -} - -// AddAllocated version that does not implement arena-safe copying behavior. -template <typename TypeHandler> -void RepeatedPtrFieldBase::AddAllocatedInternal( - typename TypeHandler::Type* value, std::false_type) { - if (rep_ && rep_->allocated_size < total_size_) { - // Fast path: underlying arena representation (tagged pointer) is equal to - // our arena pointer, and we can add to array without resizing it (at least - // one slot that is not allocated). - void** elems = rep_->elements; - if (current_size_ < rep_->allocated_size) { - // Make space at [current] by moving first allocated element to end of - // allocated list. - elems[rep_->allocated_size] = elems[current_size_]; - } - elems[current_size_] = value; - current_size_ = current_size_ + 1; - ++rep_->allocated_size; - } else { - UnsafeArenaAddAllocated<TypeHandler>(value); - } -} - -template <typename TypeHandler> -void RepeatedPtrFieldBase::UnsafeArenaAddAllocated( - typename TypeHandler::Type* value) { - // Make room for the new pointer. - if (!rep_ || current_size_ == total_size_) { - // The array is completely full with no cleared objects, so grow it. - Reserve(total_size_ + 1); - ++rep_->allocated_size; - } else if (rep_->allocated_size == total_size_) { - // There is no more space in the pointer array because it contains some - // cleared objects awaiting reuse. We don't want to grow the array in this - // case because otherwise a loop calling AddAllocated() followed by Clear() - // would leak memory. - TypeHandler::Delete(cast<TypeHandler>(rep_->elements[current_size_]), - arena_); - } else if (current_size_ < rep_->allocated_size) { - // We have some cleared objects. We don't care about their order, so we - // can just move the first one to the end to make space. - rep_->elements[rep_->allocated_size] = rep_->elements[current_size_]; - ++rep_->allocated_size; - } else { - // There are no cleared objects. - ++rep_->allocated_size; - } - - rep_->elements[current_size_++] = value; -} - -// ReleaseLast() for types that implement merge/copy behavior. -template <typename TypeHandler> -inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal( - std::true_type) { - // First, release an element. - typename TypeHandler::Type* result = UnsafeArenaReleaseLast<TypeHandler>(); - // Now perform a copy if we're on an arena. - Arena* arena = GetArena(); - - typename TypeHandler::Type* new_result; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - new_result = copy<TypeHandler>(result); - if (arena == nullptr) delete result; -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - new_result = (arena == nullptr) ? result : copy<TypeHandler>(result); -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return new_result; -} - -// ReleaseLast() for types that *do not* implement merge/copy behavior -- this -// is the same as UnsafeArenaReleaseLast(). Note that we GOOGLE_DCHECK-fail if we're on -// an arena, since the user really should implement the copy operation in this -// case. -template <typename TypeHandler> -inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal( - std::false_type) { - GOOGLE_DCHECK(GetArena() == nullptr) - << "ReleaseLast() called on a RepeatedPtrField that is on an arena, " - << "with a type that does not implement MergeFrom. This is unsafe; " - << "please implement MergeFrom for your type."; - return UnsafeArenaReleaseLast<TypeHandler>(); -} - -template <typename TypeHandler> -inline typename TypeHandler::Type* -RepeatedPtrFieldBase::UnsafeArenaReleaseLast() { - GOOGLE_DCHECK_GT(current_size_, 0); - typename TypeHandler::Type* result = - cast<TypeHandler>(rep_->elements[--current_size_]); - --rep_->allocated_size; - if (current_size_ < rep_->allocated_size) { - // There are cleared elements on the end; replace the removed element - // with the last allocated element. - rep_->elements[current_size_] = rep_->elements[rep_->allocated_size]; - } - return result; -} - -inline int RepeatedPtrFieldBase::ClearedCount() const { - return rep_ ? (rep_->allocated_size - current_size_) : 0; -} - -template <typename TypeHandler> -inline void RepeatedPtrFieldBase::AddCleared( - typename TypeHandler::Type* value) { - GOOGLE_DCHECK(GetArena() == NULL) - << "AddCleared() can only be used on a RepeatedPtrField not on an arena."; - GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr) - << "AddCleared() can only accept values not on an arena."; - if (!rep_ || rep_->allocated_size == total_size_) { - Reserve(total_size_ + 1); - } - rep_->elements[rep_->allocated_size++] = value; -} - -template <typename TypeHandler> -inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseCleared() { - GOOGLE_DCHECK(GetArena() == NULL) - << "ReleaseCleared() can only be used on a RepeatedPtrField not on " - << "an arena."; - GOOGLE_DCHECK(GetArena() == NULL); - GOOGLE_DCHECK(rep_ != NULL); - GOOGLE_DCHECK_GT(rep_->allocated_size, current_size_); - return cast<TypeHandler>(rep_->elements[--rep_->allocated_size]); -} - -} // namespace internal - -// ------------------------------------------------------------------- - -template <typename Element> -class RepeatedPtrField<Element>::TypeHandler - : public internal::GenericTypeHandler<Element> {}; - -template <> -class RepeatedPtrField<TProtoStringType>::TypeHandler - : public internal::StringTypeHandler {}; - -template <typename Element> -constexpr RepeatedPtrField<Element>::RepeatedPtrField() - : RepeatedPtrFieldBase() {} - -template <typename Element> -inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena) - : RepeatedPtrFieldBase(arena) {} - -template <typename Element> -inline RepeatedPtrField<Element>::RepeatedPtrField( - const RepeatedPtrField& other) - : RepeatedPtrFieldBase() { - MergeFrom(other); -} - -template <typename Element> -template <typename Iter, typename> -inline RepeatedPtrField<Element>::RepeatedPtrField(Iter begin, Iter end) { - Add(begin, end); -} - -template <typename Element> -RepeatedPtrField<Element>::~RepeatedPtrField() { - Destroy<TypeHandler>(); -} - -template <typename Element> -inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( - const RepeatedPtrField& other) { - if (this != &other) CopyFrom(other); - return *this; -} - -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. - if (other.GetArena()) { - CopyFrom(other); - } else { - InternalSwap(&other); - } -#endif // !PROTOBUF_FORCE_COPY_IN_MOVE -} - -template <typename Element> -inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( - RepeatedPtrField&& other) noexcept { - // 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 (GetArena() != other.GetArena() -#ifdef PROTOBUF_FORCE_COPY_IN_MOVE - || GetArena() == nullptr -#endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - CopyFrom(other); - } else { - InternalSwap(&other); - } - } - return *this; -} - -template <typename Element> -inline bool RepeatedPtrField<Element>::empty() const { - return RepeatedPtrFieldBase::empty(); -} - -template <typename Element> -inline int RepeatedPtrField<Element>::size() const { - return RepeatedPtrFieldBase::size(); -} - -template <typename Element> -inline const Element& RepeatedPtrField<Element>::Get(int index) const { - return RepeatedPtrFieldBase::Get<TypeHandler>(index); -} - -template <typename Element> -inline const Element& RepeatedPtrField<Element>::at(int index) const { - return RepeatedPtrFieldBase::at<TypeHandler>(index); -} - -template <typename Element> -inline Element& RepeatedPtrField<Element>::at(int index) { - return RepeatedPtrFieldBase::at<TypeHandler>(index); -} - - -template <typename Element> -inline Element* RepeatedPtrField<Element>::Mutable(int index) { - return RepeatedPtrFieldBase::Mutable<TypeHandler>(index); -} - -template <typename Element> -inline Element* RepeatedPtrField<Element>::Add() { - return RepeatedPtrFieldBase::Add<TypeHandler>(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::Add(Element&& value) { - RepeatedPtrFieldBase::Add<TypeHandler>(std::move(value)); -} - -template <typename Element> -template <typename Iter> -inline void RepeatedPtrField<Element>::Add(Iter begin, Iter end) { - int reserve = internal::CalculateReserve(begin, end); - if (reserve != -1) { - Reserve(size() + reserve); - } - for (; begin != end; ++begin) { - *Add() = *begin; - } -} - -template <typename Element> -inline void RepeatedPtrField<Element>::RemoveLast() { - RepeatedPtrFieldBase::RemoveLast<TypeHandler>(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::DeleteSubrange(int start, int num) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, size()); - for (int i = 0; i < num; ++i) { - RepeatedPtrFieldBase::Delete<TypeHandler>(start + i); - } - UnsafeArenaExtractSubrange(start, num, nullptr); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::ExtractSubrange(int start, int num, - Element** elements) { - typename internal::TypeImplementsMergeBehavior< - typename TypeHandler::Type>::type t; - ExtractSubrangeInternal(start, num, elements, t); -} - -// ExtractSubrange() implementation for types that implement merge/copy -// behavior. -template <typename Element> -inline void RepeatedPtrField<Element>::ExtractSubrangeInternal( - int start, int num, Element** elements, std::true_type) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, size()); - - if (num == 0) return; - - GOOGLE_DCHECK_NE(elements, nullptr) - << "Releasing elements without transferring ownership is an unsafe " - "operation. Use UnsafeArenaExtractSubrange."; - if (elements == nullptr) { - CloseGap(start, num); - return; - } - - Arena* arena = GetArena(); -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - // Always copy. - for (int i = 0; i < num; ++i) { - elements[i] = copy<TypeHandler>( - RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start)); - } - if (arena == nullptr) { - for (int i = 0; i < num; ++i) { - delete RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start); - } - } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - // If we're on an arena, we perform a copy for each element so that the - // returned elements are heap-allocated. Otherwise, just forward it. - if (arena != nullptr) { - for (int i = 0; i < num; ++i) { - elements[i] = copy<TypeHandler>( - RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start)); - } - } else { - for (int i = 0; i < num; ++i) { - elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start); - } - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - CloseGap(start, num); -} - -// ExtractSubrange() implementation for types that do not implement merge/copy -// behavior. -template <typename Element> -inline void RepeatedPtrField<Element>::ExtractSubrangeInternal( - int start, int num, Element** elements, std::false_type) { - // This case is identical to UnsafeArenaExtractSubrange(). However, since - // ExtractSubrange() must return heap-allocated objects by contract, and we - // cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that - // we are not on an arena. - GOOGLE_DCHECK(GetArena() == NULL) - << "ExtractSubrange() when arena is non-NULL is only supported when " - << "the Element type supplies a MergeFrom() operation to make copies."; - UnsafeArenaExtractSubrange(start, num, elements); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::UnsafeArenaExtractSubrange( - int start, int num, Element** elements) { - GOOGLE_DCHECK_GE(start, 0); - GOOGLE_DCHECK_GE(num, 0); - GOOGLE_DCHECK_LE(start + num, size()); - - if (num > 0) { - // Save the values of the removed elements if requested. - if (elements != NULL) { - for (int i = 0; i < num; ++i) { - elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start); - } - } - CloseGap(start, num); - } -} - -template <typename Element> -inline void RepeatedPtrField<Element>::Clear() { - RepeatedPtrFieldBase::Clear<TypeHandler>(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::MergeFrom( - const RepeatedPtrField& other) { - RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::CopyFrom(const RepeatedPtrField& other) { - RepeatedPtrFieldBase::CopyFrom<TypeHandler>(other); -} - -template <typename Element> -template <typename Iter> -inline void RepeatedPtrField<Element>::Assign(Iter begin, Iter end) { - Clear(); - Add(begin, end); -} - -template <typename Element> -inline typename RepeatedPtrField<Element>::iterator -RepeatedPtrField<Element>::erase(const_iterator position) { - return erase(position, position + 1); -} - -template <typename Element> -inline typename RepeatedPtrField<Element>::iterator -RepeatedPtrField<Element>::erase(const_iterator first, const_iterator last) { - size_type pos_offset = std::distance(cbegin(), first); - size_type last_offset = std::distance(cbegin(), last); - DeleteSubrange(pos_offset, last_offset - pos_offset); - return begin() + pos_offset; -} - -template <typename Element> -inline Element** RepeatedPtrField<Element>::mutable_data() { - return RepeatedPtrFieldBase::mutable_data<TypeHandler>(); -} - -template <typename Element> -inline const Element* const* RepeatedPtrField<Element>::data() const { - return RepeatedPtrFieldBase::data<TypeHandler>(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::Swap(RepeatedPtrField* other) { - if (this == other) return; - RepeatedPtrFieldBase::Swap<TypeHandler>(other); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::UnsafeArenaSwap( - RepeatedPtrField* other) { - if (this == other) return; - RepeatedPtrFieldBase::InternalSwap(other); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::SwapElements(int index1, int index2) { - RepeatedPtrFieldBase::SwapElements(index1, index2); -} - -template <typename Element> -inline Arena* RepeatedPtrField<Element>::GetArena() const { - return RepeatedPtrFieldBase::GetArena(); -} - -template <typename Element> -inline size_t RepeatedPtrField<Element>::SpaceUsedExcludingSelfLong() const { - return RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong<TypeHandler>(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::AddAllocated(Element* value) { - RepeatedPtrFieldBase::AddAllocated<TypeHandler>(value); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::UnsafeArenaAddAllocated(Element* value) { - RepeatedPtrFieldBase::UnsafeArenaAddAllocated<TypeHandler>(value); -} - -template <typename Element> -inline Element* RepeatedPtrField<Element>::ReleaseLast() { - return RepeatedPtrFieldBase::ReleaseLast<TypeHandler>(); -} - -template <typename Element> -inline Element* RepeatedPtrField<Element>::UnsafeArenaReleaseLast() { - return RepeatedPtrFieldBase::UnsafeArenaReleaseLast<TypeHandler>(); -} - -template <typename Element> -inline int RepeatedPtrField<Element>::ClearedCount() const { - return RepeatedPtrFieldBase::ClearedCount(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::AddCleared(Element* value) { - return RepeatedPtrFieldBase::AddCleared<TypeHandler>(value); -} - -template <typename Element> -inline Element* RepeatedPtrField<Element>::ReleaseCleared() { - return RepeatedPtrFieldBase::ReleaseCleared<TypeHandler>(); -} - -template <typename Element> -inline void RepeatedPtrField<Element>::Reserve(int new_size) { - return RepeatedPtrFieldBase::Reserve(new_size); -} - -template <typename Element> -inline int RepeatedPtrField<Element>::Capacity() const { - return RepeatedPtrFieldBase::Capacity(); -} - -// ------------------------------------------------------------------- - -namespace internal { - -// STL-like iterator implementation for RepeatedPtrField. You should not -// refer to this class directly; use RepeatedPtrField<T>::iterator instead. -// -// The iterator for RepeatedPtrField<T>, RepeatedPtrIterator<T>, is -// very similar to iterator_ptr<T**> in util/gtl/iterator_adaptors.h, -// but adds random-access operators and is modified to wrap a void** base -// iterator (since RepeatedPtrField stores its array as a void* array and -// casting void** to T** would violate C++ aliasing rules). -// -// This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin -// (jyasskin@google.com). -template <typename Element> -class RepeatedPtrIterator { - public: - using iterator = RepeatedPtrIterator<Element>; - using iterator_category = std::random_access_iterator_tag; - using value_type = typename std::remove_const<Element>::type; - using difference_type = std::ptrdiff_t; - using pointer = Element*; - using reference = Element&; - - RepeatedPtrIterator() : it_(NULL) {} - explicit RepeatedPtrIterator(void* const* it) : it_(it) {} - - // Allow "upcasting" from RepeatedPtrIterator<T**> to - // RepeatedPtrIterator<const T*const*>. - template <typename OtherElement> - RepeatedPtrIterator(const RepeatedPtrIterator<OtherElement>& other) - : it_(other.it_) { - // Force a compiler error if the other type is not convertible to ours. - if (false) { - implicit_cast<Element*>(static_cast<OtherElement*>(nullptr)); - } - } - - // dereferenceable - reference operator*() const { return *reinterpret_cast<Element*>(*it_); } - pointer operator->() const { return &(operator*()); } - - // {inc,dec}rementable - iterator& operator++() { - ++it_; - return *this; - } - iterator operator++(int) { return iterator(it_++); } - iterator& operator--() { - --it_; - return *this; - } - iterator operator--(int) { return iterator(it_--); } - - // equality_comparable - bool operator==(const iterator& x) const { return it_ == x.it_; } - bool operator!=(const iterator& x) const { return it_ != x.it_; } - - // less_than_comparable - bool operator<(const iterator& x) const { return it_ < x.it_; } - bool operator<=(const iterator& x) const { return it_ <= x.it_; } - bool operator>(const iterator& x) const { return it_ > x.it_; } - bool operator>=(const iterator& x) const { return it_ >= x.it_; } - - // addable, subtractable - iterator& operator+=(difference_type d) { - it_ += d; - return *this; - } - friend iterator operator+(iterator it, const difference_type d) { - it += d; - return it; - } - friend iterator operator+(const difference_type d, iterator it) { - it += d; - return it; - } - iterator& operator-=(difference_type d) { - it_ -= d; - return *this; - } - friend iterator operator-(iterator it, difference_type d) { - it -= d; - return it; - } - - // indexable - reference operator[](difference_type d) const { return *(*this + d); } - - // random access iterator - difference_type operator-(const iterator& x) const { return it_ - x.it_; } - - private: - template <typename OtherElement> - friend class RepeatedPtrIterator; - - // The internal iterator. - void* const* it_; -}; - -// Provide an iterator that operates on pointers to the underlying objects -// rather than the objects themselves as RepeatedPtrIterator does. -// Consider using this when working with stl algorithms that change -// the array. -// The VoidPtr template parameter holds the type-agnostic pointer value -// referenced by the iterator. It should either be "void *" for a mutable -// iterator, or "const void* const" for a constant iterator. -template <typename Element, typename VoidPtr> -class RepeatedPtrOverPtrsIterator { - public: - using iterator = RepeatedPtrOverPtrsIterator<Element, VoidPtr>; - using iterator_category = std::random_access_iterator_tag; - using value_type = typename std::remove_const<Element>::type; - using difference_type = std::ptrdiff_t; - using pointer = Element*; - using reference = Element&; - - RepeatedPtrOverPtrsIterator() : it_(NULL) {} - explicit RepeatedPtrOverPtrsIterator(VoidPtr* it) : it_(it) {} - - // dereferenceable - reference operator*() const { return *reinterpret_cast<Element*>(it_); } - pointer operator->() const { return &(operator*()); } - - // {inc,dec}rementable - iterator& operator++() { - ++it_; - return *this; - } - iterator operator++(int) { return iterator(it_++); } - iterator& operator--() { - --it_; - return *this; - } - iterator operator--(int) { return iterator(it_--); } - - // equality_comparable - bool operator==(const iterator& x) const { return it_ == x.it_; } - bool operator!=(const iterator& x) const { return it_ != x.it_; } - - // less_than_comparable - bool operator<(const iterator& x) const { return it_ < x.it_; } - bool operator<=(const iterator& x) const { return it_ <= x.it_; } - bool operator>(const iterator& x) const { return it_ > x.it_; } - bool operator>=(const iterator& x) const { return it_ >= x.it_; } - - // addable, subtractable - iterator& operator+=(difference_type d) { - it_ += d; - return *this; - } - friend iterator operator+(iterator it, difference_type d) { - it += d; - return it; - } - friend iterator operator+(difference_type d, iterator it) { - it += d; - return it; - } - iterator& operator-=(difference_type d) { - it_ -= d; - return *this; - } - friend iterator operator-(iterator it, difference_type d) { - it -= d; - return it; - } - - // indexable - reference operator[](difference_type d) const { return *(*this + d); } - - // random access iterator - difference_type operator-(const iterator& x) const { return it_ - x.it_; } - - private: - template <typename OtherElement> - friend class RepeatedPtrIterator; - - // The internal iterator. - VoidPtr* it_; -}; - -void RepeatedPtrFieldBase::InternalSwap(RepeatedPtrFieldBase* other) { - GOOGLE_DCHECK(this != other); - - // Swap all fields at once. - static_assert(std::is_standard_layout<RepeatedPtrFieldBase>::value, - "offsetof() requires standard layout before c++17"); - internal::memswap<offsetof(RepeatedPtrFieldBase, rep_) + sizeof(this->rep_) - - offsetof(RepeatedPtrFieldBase, arena_)>( - reinterpret_cast<char*>(this) + offsetof(RepeatedPtrFieldBase, arena_), - reinterpret_cast<char*>(other) + offsetof(RepeatedPtrFieldBase, arena_)); -} - -} // namespace internal - -template <typename Element> -inline typename RepeatedPtrField<Element>::iterator -RepeatedPtrField<Element>::begin() { - return iterator(raw_data()); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::const_iterator -RepeatedPtrField<Element>::begin() const { - return iterator(raw_data()); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::const_iterator -RepeatedPtrField<Element>::cbegin() const { - return begin(); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::iterator -RepeatedPtrField<Element>::end() { - return iterator(raw_data() + size()); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::const_iterator -RepeatedPtrField<Element>::end() const { - return iterator(raw_data() + size()); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::const_iterator -RepeatedPtrField<Element>::cend() const { - return end(); -} - -template <typename Element> -inline typename RepeatedPtrField<Element>::pointer_iterator -RepeatedPtrField<Element>::pointer_begin() { - return pointer_iterator(raw_mutable_data()); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::const_pointer_iterator -RepeatedPtrField<Element>::pointer_begin() const { - return const_pointer_iterator(const_cast<const void* const*>(raw_data())); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::pointer_iterator -RepeatedPtrField<Element>::pointer_end() { - return pointer_iterator(raw_mutable_data() + size()); -} -template <typename Element> -inline typename RepeatedPtrField<Element>::const_pointer_iterator -RepeatedPtrField<Element>::pointer_end() const { - return const_pointer_iterator( - const_cast<const void* const*>(raw_data() + size())); -} - // Iterators and helper functions that follow the spirit of the STL // std::back_insert_iterator and std::back_inserter but are tailor-made // for RepeatedField and RepeatedPtrField. Typical usage would be: @@ -2789,104 +1030,6 @@ class RepeatedFieldBackInsertIterator { RepeatedField<T>* field_; }; -// A back inserter for RepeatedPtrField objects. -template <typename 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) { - *field_->Add() = value; - return *this; - } - RepeatedPtrFieldBackInsertIterator<T>& operator=( - const T* const ptr_to_value) { - *field_->Add() = *ptr_to_value; - return *this; - } - RepeatedPtrFieldBackInsertIterator<T>& operator=(T&& value) { - *field_->Add() = std::move(value); - return *this; - } - RepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; } - RepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; } - RepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) { - return *this; - } - - private: - RepeatedPtrField<T>* field_; -}; - -// A back inserter for RepeatedPtrFields that inserts by transferring ownership -// of a pointer. -template <typename 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) {} - AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=( - T* const ptr_to_value) { - field_->AddAllocated(ptr_to_value); - return *this; - } - AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; } - AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; } - AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) { - return *this; - } - - private: - RepeatedPtrField<T>* field_; -}; - -// Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one -// uses the UnsafeArenaAddAllocated instead. -template <typename 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) {} - UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=( - T const* const ptr_to_value) { - field_->UnsafeArenaAddAllocated(const_cast<T*>(ptr_to_value)); - return *this; - } - UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() { - return *this; - } - UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() { - return *this; - } - UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++( - int /* unused */) { - return *this; - } - - private: - RepeatedPtrField<T>* field_; -}; - } // namespace internal // Provides a back insert iterator for RepeatedField instances, @@ -2897,53 +1040,6 @@ internal::RepeatedFieldBackInsertIterator<T> RepeatedFieldBackInserter( return internal::RepeatedFieldBackInsertIterator<T>(mutable_field); } -// Provides a back insert iterator for RepeatedPtrField instances, -// similar to std::back_inserter(). -template <typename T> -internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedPtrFieldBackInserter( - RepeatedPtrField<T>* const mutable_field) { - return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field); -} - -// Special back insert iterator for RepeatedPtrField instances, just in -// case someone wants to write generic template code that can access both -// RepeatedFields and RepeatedPtrFields using a common name. -template <typename T> -internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedFieldBackInserter( - RepeatedPtrField<T>* const mutable_field) { - return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field); -} - -// Provides a back insert iterator for RepeatedPtrField instances -// similar to std::back_inserter() which transfers the ownership while -// copying elements. -template <typename T> -internal::AllocatedRepeatedPtrFieldBackInsertIterator<T> -AllocatedRepeatedPtrFieldBackInserter( - RepeatedPtrField<T>* const mutable_field) { - return internal::AllocatedRepeatedPtrFieldBackInsertIterator<T>( - mutable_field); -} - -// Similar to AllocatedRepeatedPtrFieldBackInserter, using -// UnsafeArenaAddAllocated instead of AddAllocated. -// 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.UnsafeArenaAddAllocated(new T); -// ... // Do something with temp_field -// 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. -template <typename T> -internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T> -UnsafeArenaAllocatedRepeatedPtrFieldBackInserter( - RepeatedPtrField<T>* const mutable_field) { - return internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>( - mutable_field); -} - // 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<arc_i32>; @@ -2952,8 +1048,6 @@ extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<arc_i64>; extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<arc_ui64>; 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 - RepeatedPtrField<TProtoStringType>; } // namespace protobuf } // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.cc b/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.cc new file mode 100644 index 0000000000..b94b094d48 --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.cc @@ -0,0 +1,157 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include <google/protobuf/repeated_field.h> + +#include <algorithm> + +#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/implicit_weak_message.h> + +#include <google/protobuf/port_def.inc> + +namespace google { +namespace protobuf { + +namespace internal { + +void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) { + int new_size = current_size_ + extend_amount; + if (total_size_ >= new_size) { + // N.B.: rep_ is non-nullptr because extend_amount is always > 0, hence + // total_size must be non-zero since it is lower-bounded by new_size. + return &rep_->elements[current_size_]; + } + Rep* old_rep = rep_; + Arena* arena = GetArena(); + new_size = std::max(internal::kRepeatedFieldLowerClampLimit, + std::max(total_size_ * 2, new_size)); + GOOGLE_CHECK_LE(static_cast<arc_i64>(new_size), + static_cast<arc_i64>( + (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 == nullptr) { + rep_ = reinterpret_cast<Rep*>(::operator new(bytes)); + } else { + rep_ = reinterpret_cast<Rep*>(Arena::CreateArray<char>(arena, bytes)); + } +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + const int old_total_size = total_size_; +#endif + total_size_ = new_size; + if (old_rep && old_rep->allocated_size > 0) { + memcpy(rep_->elements, old_rep->elements, + old_rep->allocated_size * sizeof(rep_->elements[0])); + rep_->allocated_size = old_rep->allocated_size; + } else { + rep_->allocated_size = 0; + } + if (arena == nullptr) { +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + const size_t old_size = + old_total_size * sizeof(rep_->elements[0]) + kRepHeaderSize; + ::operator delete(static_cast<void*>(old_rep), old_size); +#else + ::operator delete(static_cast<void*>(old_rep)); +#endif + } + return &rep_->elements[current_size_]; +} + +void RepeatedPtrFieldBase::Reserve(int new_size) { + if (new_size > current_size_) { + InternalExtend(new_size - current_size_); + } +} + +void RepeatedPtrFieldBase::DestroyProtos() { + GOOGLE_DCHECK(rep_); + GOOGLE_DCHECK(arena_ == nullptr); + int n = rep_->allocated_size; + void* const* elements = rep_->elements; + for (int i = 0; i < n; i++) { + delete static_cast<MessageLite*>(elements[i]); + } +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + const size_t size = total_size_ * sizeof(elements[0]) + kRepHeaderSize; + ::operator delete(static_cast<void*>(rep_), size); + rep_ = nullptr; +#else + ::operator delete(static_cast<void*>(rep_)); + rep_ = nullptr; +#endif +} + +void* RepeatedPtrFieldBase::AddOutOfLineHelper(void* obj) { + if (!rep_ || rep_->allocated_size == total_size_) { + InternalExtend(1); // Equivalent to "Reserve(total_size_ + 1)" + } + ++rep_->allocated_size; + rep_->elements[current_size_++] = obj; + return obj; +} + +void RepeatedPtrFieldBase::CloseGap(int start, int num) { + if (rep_ == nullptr) return; + // Close up a gap of "num" elements starting at offset "start". + for (int i = start + num; i < rep_->allocated_size; ++i) + rep_->elements[i - num] = rep_->elements[i]; + current_size_ -= num; + rep_->allocated_size -= num; +} + +MessageLite* RepeatedPtrFieldBase::AddWeak(const MessageLite* prototype) { + if (rep_ != nullptr && current_size_ < rep_->allocated_size) { + return reinterpret_cast<MessageLite*>(rep_->elements[current_size_++]); + } + if (!rep_ || rep_->allocated_size == total_size_) { + Reserve(total_size_ + 1); + } + ++rep_->allocated_size; + MessageLite* result = prototype + ? prototype->New(arena_) + : Arena::CreateMessage<ImplicitWeakMessage>(arena_); + rep_->elements[current_size_++] = result; + return result; +} + +} // namespace internal + +} // namespace protobuf +} // namespace google + +#include <google/protobuf/port_undef.inc> diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.h b/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.h new file mode 100644 index 0000000000..6c38172fd3 --- /dev/null +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_ptr_field.h @@ -0,0 +1,2027 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// RepeatedField and RepeatedPtrField are used by generated protocol message +// classes to manipulate repeated fields. These classes are very similar to +// STL's vector, but include a number of optimizations found to be useful +// specifically in the case of Protocol Buffers. RepeatedPtrField is +// particularly different from STL vector as it manages ownership of the +// pointers that it contains. +// +// Typically, clients should not need to access RepeatedField objects directly, +// but should instead use the accessor functions generated automatically by the +// protocol compiler. +// +// This header covers RepeatedPtrField. + +#ifndef GOOGLE_PROTOBUF_REPEATED_PTR_FIELD_H__ +#define GOOGLE_PROTOBUF_REPEATED_PTR_FIELD_H__ + +#include <utility> +#ifdef _MSC_VER +// This is required for min/max on VS2013 only. +#include <algorithm> +#endif + +#include <iterator> +#include <limits> +#include <string> +#include <type_traits> + +#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/message_lite.h> +#include <google/protobuf/port.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 Message; +class Reflection; + +template <typename T> +struct WeakRepeatedPtrField; + +namespace internal { + +class MergePartialFromCodedStreamHelper; +class SwapFieldHelper; + + +} // namespace internal + +namespace internal { +template <typename It> +class RepeatedPtrIterator; +template <typename It, typename VoidPtr> +class RepeatedPtrOverPtrsIterator; +} // namespace internal + +namespace internal { + +// type-traits helper for RepeatedPtrFieldBase: we only want to invoke +// arena-related "copy if on different arena" behavior if the necessary methods +// exist on the contained type. In particular, we rely on MergeFrom() existing +// as a general proxy for the fact that a copy will work, and we also provide a +// specific override for TProtoStringType*. +template <typename T> +struct TypeImplementsMergeBehaviorProbeForMergeFrom { + typedef char HasMerge; + typedef long HasNoMerge; + + // We accept either of: + // - void MergeFrom(const T& other) + // - bool MergeFrom(const T& other) + // + // We mangle these names a bit to avoid compatibility issues in 'unclean' + // include environments that may have, e.g., "#define test ..." (yes, this + // exists). + template <typename U, typename RetType, RetType (U::*)(const U& arg)> + struct CheckType; + template <typename U> + static HasMerge Check(CheckType<U, void, &U::MergeFrom>*); + template <typename U> + static HasMerge Check(CheckType<U, bool, &U::MergeFrom>*); + template <typename U> + static HasNoMerge Check(...); + + // Resolves to either std::true_type or std::false_type. + typedef std::integral_constant<bool, + (sizeof(Check<T>(0)) == sizeof(HasMerge))> + type; +}; + +template <typename T, typename = void> +struct TypeImplementsMergeBehavior + : TypeImplementsMergeBehaviorProbeForMergeFrom<T> {}; + + +template <> +struct TypeImplementsMergeBehavior<TProtoStringType> { + typedef std::true_type type; +}; + +template <typename T> +struct IsMovable + : std::integral_constant<bool, std::is_move_constructible<T>::value && + std::is_move_assignable<T>::value> {}; + +// This is the common base class for RepeatedPtrFields. It deals only in void* +// pointers. Users should not use this interface directly. +// +// The methods of this interface correspond to the methods of RepeatedPtrField, +// but may have a template argument called TypeHandler. Its signature is: +// class TypeHandler { +// public: +// typedef MyType Type; +// static Type* New(); +// static Type* NewFromPrototype(const Type* prototype, +// Arena* arena); +// static void Delete(Type*); +// static void Clear(Type*); +// static void Merge(const Type& from, Type* to); +// +// // Only needs to be implemented if SpaceUsedExcludingSelf() is called. +// static int SpaceUsedLong(const Type&); +// }; +class PROTOBUF_EXPORT RepeatedPtrFieldBase { + protected: + constexpr RepeatedPtrFieldBase(); + explicit RepeatedPtrFieldBase(Arena* arena); + ~RepeatedPtrFieldBase() { +#ifndef NDEBUG + // Try to trigger segfault / asan failure in non-opt builds. If arena_ + // lifetime has ended before the destructor. + if (arena_) (void)arena_->SpaceAllocated(); +#endif + } + + // Must be called from destructor. + template <typename TypeHandler> + void Destroy(); + bool NeedsDestroy() const { return rep_ != nullptr && arena_ == nullptr; } + void DestroyProtos(); + + bool empty() const; + int size() const; + + template <typename TypeHandler> + const typename TypeHandler::Type& at(int index) const; + template <typename TypeHandler> + typename TypeHandler::Type& at(int index); + + template <typename TypeHandler> + typename TypeHandler::Type* Mutable(int index); + template <typename TypeHandler> + void Delete(int index); + template <typename TypeHandler> + typename TypeHandler::Type* Add( + typename TypeHandler::Type* prototype = nullptr); + + public: + // The next few methods are public so that they can be called from generated + // code when implicit weak fields are used, but they should never be called by + // application code. + + template <typename TypeHandler> + const typename TypeHandler::Type& Get(int index) const; + + // Creates and adds an element using the given prototype, without introducing + // a link-time dependency on the concrete message type. This method is used to + // implement implicit weak fields. The prototype may be nullptr, in which case + // an ImplicitWeakMessage will be used as a placeholder. + MessageLite* AddWeak(const MessageLite* prototype); + + template <typename TypeHandler> + void Clear(); + + template <typename TypeHandler> + void MergeFrom(const RepeatedPtrFieldBase& other); + + inline void InternalSwap(RepeatedPtrFieldBase*); + + protected: + template < + typename TypeHandler, + typename std::enable_if<TypeHandler::Movable::value>::type* = nullptr> + void Add(typename TypeHandler::Type&& value); + + template <typename TypeHandler> + void RemoveLast(); + template <typename TypeHandler> + void CopyFrom(const RepeatedPtrFieldBase& other); + + void CloseGap(int start, int num); + + void Reserve(int new_size); + + template<typename TypeHandler> + void Truncate(int new_size) { + GOOGLE_DCHECK_LE(new_size, current_size_); + for (int i = new_size; i < current_size_; i++) { + TypeHandler::Clear(cast<TypeHandler>(rep_->elements[i])); + } + current_size_ = new_size; + } + + int Capacity() const; + + template <typename TypeHandler> + static inline typename TypeHandler::Type* copy( + typename TypeHandler::Type* value) { + auto* new_value = TypeHandler::NewFromPrototype(value, nullptr); + TypeHandler::Merge(*value, new_value); + return new_value; + } + + // Used for constructing iterators. + void* const* raw_data() const; + void** raw_mutable_data() const; + + template <typename TypeHandler> + typename TypeHandler::Type** mutable_data(); + template <typename TypeHandler> + const typename TypeHandler::Type* const* data() const; + + template <typename TypeHandler> + PROTOBUF_NDEBUG_INLINE void Swap(RepeatedPtrFieldBase* other); + + void SwapElements(int index1, int index2); + + template <typename TypeHandler> + size_t SpaceUsedExcludingSelfLong() const; + + // Advanced memory management -------------------------------------- + + // Like Add(), but if there are no cleared objects to use, returns nullptr. + template <typename TypeHandler> + typename TypeHandler::Type* AddFromCleared(); + + template <typename TypeHandler> + void AddAllocated(typename TypeHandler::Type* value) { + typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t; + AddAllocatedInternal<TypeHandler>(value, t); + } + + template <typename TypeHandler> + void UnsafeArenaAddAllocated(typename TypeHandler::Type* value); + + template <typename TypeHandler> + PROTOBUF_NODISCARD typename TypeHandler::Type* ReleaseLast() { + typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t; + return ReleaseLastInternal<TypeHandler>(t); + } + + // Releases last element and returns it, but does not do out-of-arena copy. + // And just returns the raw pointer to the contained element in the arena. + template <typename TypeHandler> + typename TypeHandler::Type* UnsafeArenaReleaseLast(); + + int ClearedCount() const; + template <typename TypeHandler> + void AddCleared(typename TypeHandler::Type* value); + template <typename TypeHandler> + PROTOBUF_NODISCARD typename TypeHandler::Type* ReleaseCleared(); + + template <typename TypeHandler> + void AddAllocatedInternal(typename TypeHandler::Type* value, std::true_type); + template <typename TypeHandler> + void AddAllocatedInternal(typename TypeHandler::Type* value, std::false_type); + + template <typename TypeHandler> + PROTOBUF_NOINLINE void AddAllocatedSlowWithCopy( + typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena); + template <typename TypeHandler> + PROTOBUF_NOINLINE void AddAllocatedSlowWithoutCopy( + typename TypeHandler::Type* value); + + template <typename TypeHandler> + typename TypeHandler::Type* ReleaseLastInternal(std::true_type); + template <typename TypeHandler> + typename TypeHandler::Type* ReleaseLastInternal(std::false_type); + + template <typename TypeHandler> + PROTOBUF_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other); + + inline Arena* GetArena() const { return arena_; } + + private: + static constexpr int kInitialSize = 0; + // A few notes on internal representation: + // + // We use an indirected approach, with struct Rep, to keep + // sizeof(RepeatedPtrFieldBase) equivalent to what it was before arena support + // was added, namely, 3 8-byte machine words on x86-64. An instance of Rep is + // allocated only when the repeated field is non-empty, and it is a + // dynamically-sized struct (the header is directly followed by elements[]). + // We place arena_ and current_size_ directly in the object to avoid cache + // misses due to the indirection, because these fields are checked frequently. + // Placing all fields directly in the RepeatedPtrFieldBase instance costs + // significant performance for memory-sensitive workloads. + Arena* arena_; + int current_size_; + int total_size_; + struct Rep { + int allocated_size; + // Here we declare a huge array as a way of approximating C's "flexible + // array member" feature without relying on undefined behavior. + void* elements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) / + sizeof(void*)]; + }; + static constexpr size_t kRepHeaderSize = offsetof(Rep, elements); + Rep* rep_; + + template <typename TypeHandler> + static inline typename TypeHandler::Type* cast(void* element) { + return reinterpret_cast<typename TypeHandler::Type*>(element); + } + template <typename TypeHandler> + static inline const typename TypeHandler::Type* cast(const void* element) { + return reinterpret_cast<const typename TypeHandler::Type*>(element); + } + + // Non-templated inner function to avoid code duplication. Takes a function + // pointer to the type-specific (templated) inner allocate/merge loop. + void MergeFromInternal(const RepeatedPtrFieldBase& other, + void (RepeatedPtrFieldBase::*inner_loop)(void**, + void**, int, + int)); + + template <typename TypeHandler> + PROTOBUF_NOINLINE void MergeFromInnerLoop(void** our_elems, + void** other_elems, int length, + int already_allocated); + + // Internal helper: extend array space if necessary to contain |extend_amount| + // more elements, and return a pointer to the element immediately following + // the old list of elements. This interface factors out common behavior from + // Reserve() and MergeFrom() to reduce code size. |extend_amount| must be > 0. + void** InternalExtend(int extend_amount); + + // Internal helper for Add: add "obj" as the next element in the + // array, including potentially resizing the array with Reserve if + // needed + void* AddOutOfLineHelper(void* obj); + + // The reflection implementation needs to call protected methods directly, + // reinterpreting pointers as being to Message instead of a specific Message + // subclass. + friend class ::PROTOBUF_NAMESPACE_ID::Reflection; + friend class ::PROTOBUF_NAMESPACE_ID::internal::SwapFieldHelper; + + // ExtensionSet stores repeated message extensions as + // RepeatedPtrField<MessageLite>, but non-lite ExtensionSets need to implement + // SpaceUsedLong(), and thus need to call SpaceUsedExcludingSelfLong() + // reinterpreting MessageLite as Message. ExtensionSet also needs to make use + // of AddFromCleared(), which is not part of the public interface. + friend class ExtensionSet; + + // The MapFieldBase implementation needs to call protected methods directly, + // reinterpreting pointers as being to Message instead of a specific Message + // subclass. + friend class MapFieldBase; + friend class MapFieldBaseStub; + + // The table-driven MergePartialFromCodedStream implementation needs to + // operate on RepeatedPtrField<MessageLite>. + friend class MergePartialFromCodedStreamHelper; + friend class AccessorHelper; + template <typename T> + friend struct google::protobuf::WeakRepeatedPtrField; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase); +}; + +template <typename GenericType> +class GenericTypeHandler { + public: + typedef GenericType Type; + using Movable = IsMovable<GenericType>; + + static inline GenericType* New(Arena* arena) { + return Arena::CreateMaybeMessage<Type>(arena); + } + static inline GenericType* New(Arena* arena, GenericType&& value) { + return Arena::Create<GenericType>(arena, std::move(value)); + } + static inline GenericType* NewFromPrototype(const GenericType* prototype, + Arena* arena = nullptr); + static inline void Delete(GenericType* value, Arena* arena) { + if (arena == nullptr) { + delete value; + } + } + static inline Arena* GetOwningArena(GenericType* value) { + return Arena::GetOwningArena<Type>(value); + } + + static inline void Clear(GenericType* value) { value->Clear(); } + PROTOBUF_NOINLINE + static void Merge(const GenericType& from, GenericType* to); + static inline size_t SpaceUsedLong(const GenericType& value) { + return value.SpaceUsedLong(); + } +}; + +template <typename GenericType> +GenericType* GenericTypeHandler<GenericType>::NewFromPrototype( + const GenericType* /* prototype */, Arena* arena) { + return New(arena); +} +template <typename GenericType> +void GenericTypeHandler<GenericType>::Merge(const GenericType& from, + GenericType* to) { + to->MergeFrom(from); +} + +// NewFromPrototype() and Merge() are not defined inline here, as we will need +// to do a virtual function dispatch anyways to go from Message* to call +// New/Merge. +template <> +MessageLite* GenericTypeHandler<MessageLite>::NewFromPrototype( + const MessageLite* prototype, Arena* arena); +template <> +inline Arena* GenericTypeHandler<MessageLite>::GetOwningArena( + MessageLite* value) { + return value->GetOwningArena(); +} +template <> +void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from, + MessageLite* to); +template <> +inline void GenericTypeHandler<TProtoStringType>::Clear(TProtoStringType* value) { + value->clear(); +} +template <> +void GenericTypeHandler<TProtoStringType>::Merge(const TProtoStringType& from, + TProtoStringType* to); + +// Message specialization bodies defined in message.cc. This split is necessary +// to allow proto2-lite (which includes this header) to be independent of +// Message. +template <> +PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype( + const Message* prototype, Arena* arena); +template <> +PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetOwningArena( + Message* value); + +class StringTypeHandler { + public: + typedef TProtoStringType Type; + using Movable = IsMovable<Type>; + + static inline TProtoStringType* New(Arena* arena) { + return Arena::Create<TProtoStringType>(arena); + } + static inline TProtoStringType* New(Arena* arena, TProtoStringType&& value) { + return Arena::Create<TProtoStringType>(arena, std::move(value)); + } + static inline TProtoStringType* NewFromPrototype(const TProtoStringType*, + Arena* arena) { + return New(arena); + } + static inline Arena* GetOwningArena(TProtoStringType*) { return nullptr; } + static inline void Delete(TProtoStringType* value, Arena* arena) { + if (arena == nullptr) { + delete value; + } + } + static inline void Clear(TProtoStringType* value) { value->clear(); } + static inline void Merge(const TProtoStringType& from, TProtoStringType* to) { + *to = from; + } + static size_t SpaceUsedLong(const TProtoStringType& value) { + return sizeof(value) + StringSpaceUsedExcludingSelfLong(value); + } +}; + +} // namespace internal + +// RepeatedPtrField is like RepeatedField, but used for repeated strings or +// Messages. +template <typename Element> +class RepeatedPtrField : private internal::RepeatedPtrFieldBase { + public: + constexpr RepeatedPtrField(); + explicit RepeatedPtrField(Arena* arena); + + RepeatedPtrField(const RepeatedPtrField& other); + + template <typename Iter, + typename = typename std::enable_if<std::is_constructible< + Element, decltype(*std::declval<Iter>())>::value>::type> + RepeatedPtrField(Iter begin, Iter end); + + ~RepeatedPtrField(); + + RepeatedPtrField& operator=(const RepeatedPtrField& other); + + RepeatedPtrField(RepeatedPtrField&& other) noexcept; + RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept; + + bool empty() const; + int size() const; + + const Element& Get(int index) const; + Element* Mutable(int index); + Element* Add(); + void Add(Element&& value); + // Append elements in the range [begin, end) after reserving + // the appropriate number of elements. + template <typename Iter> + void Add(Iter begin, Iter end); + + const Element& operator[](int index) const { return Get(index); } + Element& operator[](int index) { return *Mutable(index); } + + const Element& at(int index) const; + Element& at(int index); + + // Remove the last element in the array. + // Ownership of the element is retained by the array. + void RemoveLast(); + + // Delete elements with indices in the range [start .. start+num-1]. + // Caution: implementation moves all elements with indices [start+num .. ]. + // Calling this routine inside a loop can cause quadratic behavior. + void DeleteSubrange(int start, int num); + + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear(); + void MergeFrom(const RepeatedPtrField& other); + PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other); + + // Replaces the contents with RepeatedPtrField(begin, end). + template <typename Iter> + 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 + // array is grown, it will always be at least doubled in size. + void Reserve(int new_size); + + void Truncate(int new_size) { + return RepeatedPtrFieldBase::Truncate<TypeHandler>(new_size); + } + + int Capacity() const; + + // Gets the underlying array. This pointer is possibly invalidated by + // any add or remove operation. + Element** mutable_data(); + const Element* const* data() const; + + // Swap entire contents with "other". If they are on separate arenas, then + // copies data. + void Swap(RepeatedPtrField* other); + + // Swap entire contents with "other". Caller should guarantee that either both + // fields are on the same arena or both are on the heap. Swapping between + // different arenas with this function is disallowed and is caught via + // GOOGLE_DCHECK. + void UnsafeArenaSwap(RepeatedPtrField* other); + + // Swap two elements. + void SwapElements(int index1, int index2); + + // STL-like iterator support + typedef internal::RepeatedPtrIterator<Element> iterator; + typedef internal::RepeatedPtrIterator<const Element> const_iterator; + typedef Element value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef int size_type; + typedef ptrdiff_t difference_type; + + iterator begin(); + const_iterator begin() const; + const_iterator cbegin() const; + iterator end(); + const_iterator end() const; + const_iterator cend() const; + + // Reverse iterator support + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + // Custom STL-like iterator that iterates over and returns the underlying + // pointers to Element rather than Element itself. + typedef internal::RepeatedPtrOverPtrsIterator<Element*, void*> + pointer_iterator; + typedef internal::RepeatedPtrOverPtrsIterator<const Element* const, + const void* const> + const_pointer_iterator; + pointer_iterator pointer_begin(); + const_pointer_iterator pointer_begin() const; + pointer_iterator pointer_end(); + const_pointer_iterator pointer_end() const; + + // Returns (an estimate of) the number of bytes used by the repeated field, + // excluding sizeof(*this). + size_t SpaceUsedExcludingSelfLong() const; + + int SpaceUsedExcludingSelf() const { + return internal::ToIntSize(SpaceUsedExcludingSelfLong()); + } + + // Advanced memory management -------------------------------------- + // When hardcore memory management becomes necessary -- as it sometimes + // does here at Google -- the following methods may be useful. + + // Add an already-allocated object, passing ownership to the + // RepeatedPtrField. + // + // Note that some special behavior occurs with respect to arenas: + // + // (i) if this field holds submessages, the new submessage will be copied if + // the original is in an arena and this RepeatedPtrField is either in a + // different arena, or on the heap. + // (ii) if this field holds strings, the passed-in string *must* be + // heap-allocated, not arena-allocated. There is no way to dynamically check + // this at runtime, so User Beware. + void AddAllocated(Element* value); + + // Remove the last element and return it, passing ownership to the caller. + // Requires: size() > 0 + // + // If this RepeatedPtrField is on an arena, an object copy is required to pass + // ownership back to the user (for compatible semantics). Use + // UnsafeArenaReleaseLast() if this behavior is undesired. + PROTOBUF_NODISCARD Element* ReleaseLast(); + + // Add an already-allocated object, skipping arena-ownership checks. The user + // must guarantee that the given object is in the same arena as this + // RepeatedPtrField. + // It is also useful in legacy code that uses temporary ownership to avoid + // copies. Example: + // RepeatedPtrField<T> temp_field; + // temp_field.UnsafeArenaAddAllocated(new T); + // ... // Do something with temp_field + // 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. 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]". + // The caller assumes ownership of the extracted elements and is responsible + // for deleting them when they are no longer needed. + // If "elements" is non-nullptr, then pointers to the extracted elements + // are stored in "elements[0 .. num-1]" for the convenience of the caller. + // If "elements" is nullptr, then the caller must use some other mechanism + // to perform any further operations (like deletion) on these elements. + // Caution: implementation also moves elements with indices [start+num ..]. + // Calling this routine inside a loop can cause quadratic behavior. + // + // Memory copying behavior is identical to ReleaseLast(), described above: if + // this RepeatedPtrField is on an arena, an object copy is performed for each + // returned element, so that all returned element pointers are to + // heap-allocated copies. If this copy is not desired, the user should call + // UnsafeArenaExtractSubrange(). + void ExtractSubrange(int start, int num, Element** elements); + + // 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 + // are not actually freed. Instead, they are cleared and kept so that + // they can be reused later. This can save lots of CPU time when + // repeatedly reusing a protocol message for similar purposes. + // + // Hardcore programs may choose to manipulate these cleared objects + // to better optimize memory management using the following routines. + + // Get the number of cleared objects that are currently being kept + // around for reuse. + int ClearedCount() const; +#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES + // Add an element to the pool of cleared objects, passing ownership to + // the RepeatedPtrField. The element must be cleared prior to calling + // this method. + // + // This method cannot be called when the repeated field is on an arena or when + // |value| is; both cases will trigger a GOOGLE_DCHECK-failure. + void AddCleared(Element* value); + // Remove a single element from the cleared pool and return it, passing + // ownership to the caller. The element is guaranteed to be cleared. + // Requires: ClearedCount() > 0 + // + // + // This method cannot be called when the repeated field is on an arena; doing + // so will trigger a GOOGLE_DCHECK-failure. + PROTOBUF_NODISCARD Element* ReleaseCleared(); +#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES + + // Removes the element referenced by position. + // + // Returns an iterator to the element immediately following the removed + // element. + // + // Invalidates all iterators at or after the removed element, including end(). + iterator erase(const_iterator position); + + // Removes the elements in the range [first, last). + // + // Returns an iterator to the element immediately following the removed range. + // + // Invalidates all iterators at or after the removed range, including end(). + iterator erase(const_iterator first, const_iterator last); + + // Gets the arena on which this RepeatedPtrField stores its elements. + inline Arena* GetArena() const; + + // For internal use only. + // + // This is public due to it being called by generated code. + void InternalSwap(RepeatedPtrField* other) { + internal::RepeatedPtrFieldBase::InternalSwap(other); + } + + private: + // Note: RepeatedPtrField SHOULD NOT be subclassed by users. + class TypeHandler; + + // Implementations for ExtractSubrange(). The copying behavior must be + // included only if the type supports the necessary operations (e.g., + // MergeFrom()), so we must resolve this at compile time. ExtractSubrange() + // uses SFINAE to choose one of the below implementations. + void ExtractSubrangeInternal(int start, int num, Element** elements, + std::true_type); + void ExtractSubrangeInternal(int start, int num, Element** elements, + std::false_type); + + friend class Arena; + + template <typename T> + friend struct WeakRepeatedPtrField; + + typedef void InternalArenaConstructable_; + +}; + +// implementation ==================================================== + +namespace internal { + +constexpr RepeatedPtrFieldBase::RepeatedPtrFieldBase() + : arena_(nullptr), current_size_(0), total_size_(0), rep_(nullptr) {} + +inline RepeatedPtrFieldBase::RepeatedPtrFieldBase(Arena* arena) + : arena_(arena), current_size_(0), total_size_(0), rep_(nullptr) {} + +template <typename TypeHandler> +void RepeatedPtrFieldBase::Destroy() { + if (rep_ != nullptr && arena_ == nullptr) { + int n = rep_->allocated_size; + void* const* elements = rep_->elements; + for (int i = 0; i < n; i++) { + TypeHandler::Delete(cast<TypeHandler>(elements[i]), nullptr); + } +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + const size_t size = total_size_ * sizeof(elements[0]) + kRepHeaderSize; + ::operator delete(static_cast<void*>(rep_), size); +#else + ::operator delete(static_cast<void*>(rep_)); +#endif + } + rep_ = nullptr; +} + +template <typename TypeHandler> +inline void RepeatedPtrFieldBase::Swap(RepeatedPtrFieldBase* other) { +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() != nullptr && GetArena() == other->GetArena()) { +#else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetArena() == other->GetArena()) { +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + SwapFallback<TypeHandler>(other); + } +} + +template <typename TypeHandler> +void RepeatedPtrFieldBase::SwapFallback(RepeatedPtrFieldBase* other) { +#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + GOOGLE_DCHECK(GetArena() == nullptr || other->GetArena() != GetArena()); +#else // PROTOBUF_FORCE_COPY_IN_SWAP + GOOGLE_DCHECK(other->GetArena() != GetArena()); +#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + + // Copy semantics in this case. We try to improve efficiency by placing the + // temporary on |other|'s arena so that messages are copied twice rather than + // three times. + RepeatedPtrFieldBase temp(other->GetArena()); + temp.MergeFrom<TypeHandler>(*this); + this->Clear<TypeHandler>(); + this->MergeFrom<TypeHandler>(*other); + other->InternalSwap(&temp); + temp.Destroy<TypeHandler>(); // Frees rep_ if `other` had no arena. +} + +inline bool RepeatedPtrFieldBase::empty() const { return current_size_ == 0; } + +inline int RepeatedPtrFieldBase::size() const { return current_size_; } + +template <typename TypeHandler> +inline const typename TypeHandler::Type& RepeatedPtrFieldBase::Get( + int index) const { + GOOGLE_DCHECK_GE(index, 0); + GOOGLE_DCHECK_LT(index, current_size_); + return *cast<TypeHandler>(rep_->elements[index]); +} + +template <typename TypeHandler> +inline const typename TypeHandler::Type& RepeatedPtrFieldBase::at( + int index) const { + GOOGLE_CHECK_GE(index, 0); + GOOGLE_CHECK_LT(index, current_size_); + return *cast<TypeHandler>(rep_->elements[index]); +} + +template <typename TypeHandler> +inline typename TypeHandler::Type& RepeatedPtrFieldBase::at(int index) { + GOOGLE_CHECK_GE(index, 0); + GOOGLE_CHECK_LT(index, current_size_); + return *cast<TypeHandler>(rep_->elements[index]); +} + +template <typename TypeHandler> +inline typename TypeHandler::Type* RepeatedPtrFieldBase::Mutable(int index) { + GOOGLE_DCHECK_GE(index, 0); + GOOGLE_DCHECK_LT(index, current_size_); + return cast<TypeHandler>(rep_->elements[index]); +} + +template <typename TypeHandler> +inline void RepeatedPtrFieldBase::Delete(int index) { + GOOGLE_DCHECK_GE(index, 0); + GOOGLE_DCHECK_LT(index, current_size_); + TypeHandler::Delete(cast<TypeHandler>(rep_->elements[index]), arena_); +} + +template <typename TypeHandler> +inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add( + typename TypeHandler::Type* prototype) { + if (rep_ != nullptr && current_size_ < rep_->allocated_size) { + return cast<TypeHandler>(rep_->elements[current_size_++]); + } + typename TypeHandler::Type* result = + TypeHandler::NewFromPrototype(prototype, arena_); + return reinterpret_cast<typename TypeHandler::Type*>( + AddOutOfLineHelper(result)); +} + +template <typename TypeHandler, + typename std::enable_if<TypeHandler::Movable::value>::type*> +inline void RepeatedPtrFieldBase::Add(typename TypeHandler::Type&& value) { + if (rep_ != nullptr && current_size_ < rep_->allocated_size) { + *cast<TypeHandler>(rep_->elements[current_size_++]) = std::move(value); + return; + } + if (!rep_ || rep_->allocated_size == total_size_) { + Reserve(total_size_ + 1); + } + ++rep_->allocated_size; + typename TypeHandler::Type* result = + TypeHandler::New(arena_, std::move(value)); + rep_->elements[current_size_++] = result; +} + +template <typename TypeHandler> +inline void RepeatedPtrFieldBase::RemoveLast() { + GOOGLE_DCHECK_GT(current_size_, 0); + TypeHandler::Clear(cast<TypeHandler>(rep_->elements[--current_size_])); +} + +template <typename TypeHandler> +void RepeatedPtrFieldBase::Clear() { + const int n = current_size_; + GOOGLE_DCHECK_GE(n, 0); + if (n > 0) { + void* const* elements = rep_->elements; + int i = 0; + do { + TypeHandler::Clear(cast<TypeHandler>(elements[i++])); + } while (i < n); + current_size_ = 0; + } +} + +// To avoid unnecessary code duplication and reduce binary size, we use a +// layered approach to implementing MergeFrom(). The toplevel method is +// templated, so we get a small thunk per concrete message type in the binary. +// This calls a shared implementation with most of the logic, passing a function +// pointer to another type-specific piece of code that calls the object-allocate +// and merge handlers. +template <typename TypeHandler> +inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) { + GOOGLE_DCHECK_NE(&other, this); + if (other.current_size_ == 0) return; + MergeFromInternal(other, + &RepeatedPtrFieldBase::MergeFromInnerLoop<TypeHandler>); +} + +inline void RepeatedPtrFieldBase::MergeFromInternal( + const RepeatedPtrFieldBase& other, + void (RepeatedPtrFieldBase::*inner_loop)(void**, void**, int, int)) { + // Note: wrapper has already guaranteed that other.rep_ != nullptr here. + int other_size = other.current_size_; + void** other_elements = other.rep_->elements; + void** new_elements = InternalExtend(other_size); + int allocated_elems = rep_->allocated_size - current_size_; + (this->*inner_loop)(new_elements, other_elements, other_size, + allocated_elems); + current_size_ += other_size; + if (rep_->allocated_size < current_size_) { + rep_->allocated_size = current_size_; + } +} + +// Merges other_elems to our_elems. +template <typename TypeHandler> +void RepeatedPtrFieldBase::MergeFromInnerLoop(void** our_elems, + void** other_elems, int length, + int already_allocated) { + if (already_allocated < length) { + Arena* arena = GetArena(); + typename TypeHandler::Type* elem_prototype = + reinterpret_cast<typename TypeHandler::Type*>(other_elems[0]); + for (int i = already_allocated; i < length; i++) { + // Allocate a new empty element that we'll merge into below + typename TypeHandler::Type* new_elem = + TypeHandler::NewFromPrototype(elem_prototype, arena); + our_elems[i] = new_elem; + } + } + // Main loop that does the actual merging + for (int i = 0; i < length; i++) { + // Already allocated: use existing element. + typename TypeHandler::Type* other_elem = + reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]); + typename TypeHandler::Type* new_elem = + reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]); + TypeHandler::Merge(*other_elem, new_elem); + } +} + +template <typename TypeHandler> +inline void RepeatedPtrFieldBase::CopyFrom(const RepeatedPtrFieldBase& other) { + if (&other == this) return; + RepeatedPtrFieldBase::Clear<TypeHandler>(); + RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other); +} + +inline int RepeatedPtrFieldBase::Capacity() const { return total_size_; } + +inline void* const* RepeatedPtrFieldBase::raw_data() const { + return rep_ ? rep_->elements : nullptr; +} + +inline void** RepeatedPtrFieldBase::raw_mutable_data() const { + return rep_ ? const_cast<void**>(rep_->elements) : nullptr; +} + +template <typename TypeHandler> +inline typename TypeHandler::Type** RepeatedPtrFieldBase::mutable_data() { + // TODO(kenton): Breaks C++ aliasing rules. We should probably remove this + // method entirely. + return reinterpret_cast<typename TypeHandler::Type**>(raw_mutable_data()); +} + +template <typename TypeHandler> +inline const typename TypeHandler::Type* const* RepeatedPtrFieldBase::data() + const { + // TODO(kenton): Breaks C++ aliasing rules. We should probably remove this + // method entirely. + return reinterpret_cast<const typename TypeHandler::Type* const*>(raw_data()); +} + +inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) { + using std::swap; // enable ADL with fallback + swap(rep_->elements[index1], rep_->elements[index2]); +} + +template <typename TypeHandler> +inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const { + size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*); + if (rep_ != nullptr) { + for (int i = 0; i < rep_->allocated_size; ++i) { + allocated_bytes += + TypeHandler::SpaceUsedLong(*cast<TypeHandler>(rep_->elements[i])); + } + allocated_bytes += kRepHeaderSize; + } + return allocated_bytes; +} + +template <typename TypeHandler> +inline typename TypeHandler::Type* RepeatedPtrFieldBase::AddFromCleared() { + if (rep_ != nullptr && current_size_ < rep_->allocated_size) { + return cast<TypeHandler>(rep_->elements[current_size_++]); + } else { + return nullptr; + } +} + +// AddAllocated version that implements arena-safe copying behavior. +template <typename TypeHandler> +void RepeatedPtrFieldBase::AddAllocatedInternal( + typename TypeHandler::Type* value, std::true_type) { + Arena* element_arena = + reinterpret_cast<Arena*>(TypeHandler::GetOwningArena(value)); + Arena* arena = GetArena(); + if (arena == element_arena && rep_ && rep_->allocated_size < total_size_) { + // Fast path: underlying arena representation (tagged pointer) is equal to + // our arena pointer, and we can add to array without resizing it (at least + // one slot that is not allocated). + void** elems = rep_->elements; + if (current_size_ < rep_->allocated_size) { + // Make space at [current] by moving first allocated element to end of + // allocated list. + elems[rep_->allocated_size] = elems[current_size_]; + } + elems[current_size_] = value; + current_size_ = current_size_ + 1; + rep_->allocated_size = rep_->allocated_size + 1; + } else { + AddAllocatedSlowWithCopy<TypeHandler>(value, element_arena, arena); + } +} + +// Slowpath handles all cases, copying if necessary. +template <typename TypeHandler> +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) { + // 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). + if (my_arena != nullptr && value_arena == nullptr) { + my_arena->Own(value); + } else if (my_arena != value_arena) { + typename TypeHandler::Type* new_value = + TypeHandler::NewFromPrototype(value, my_arena); + TypeHandler::Merge(*value, new_value); + TypeHandler::Delete(value, value_arena); + value = new_value; + } + + UnsafeArenaAddAllocated<TypeHandler>(value); +} + +// AddAllocated version that does not implement arena-safe copying behavior. +template <typename TypeHandler> +void RepeatedPtrFieldBase::AddAllocatedInternal( + typename TypeHandler::Type* value, std::false_type) { + if (rep_ && rep_->allocated_size < total_size_) { + // Fast path: underlying arena representation (tagged pointer) is equal to + // our arena pointer, and we can add to array without resizing it (at least + // one slot that is not allocated). + void** elems = rep_->elements; + if (current_size_ < rep_->allocated_size) { + // Make space at [current] by moving first allocated element to end of + // allocated list. + elems[rep_->allocated_size] = elems[current_size_]; + } + elems[current_size_] = value; + current_size_ = current_size_ + 1; + ++rep_->allocated_size; + } else { + UnsafeArenaAddAllocated<TypeHandler>(value); + } +} + +template <typename TypeHandler> +void RepeatedPtrFieldBase::UnsafeArenaAddAllocated( + typename TypeHandler::Type* value) { + // Make room for the new pointer. + if (!rep_ || current_size_ == total_size_) { + // The array is completely full with no cleared objects, so grow it. + Reserve(total_size_ + 1); + ++rep_->allocated_size; + } else if (rep_->allocated_size == total_size_) { + // There is no more space in the pointer array because it contains some + // cleared objects awaiting reuse. We don't want to grow the array in this + // case because otherwise a loop calling AddAllocated() followed by Clear() + // would leak memory. + TypeHandler::Delete(cast<TypeHandler>(rep_->elements[current_size_]), + arena_); + } else if (current_size_ < rep_->allocated_size) { + // We have some cleared objects. We don't care about their order, so we + // can just move the first one to the end to make space. + rep_->elements[rep_->allocated_size] = rep_->elements[current_size_]; + ++rep_->allocated_size; + } else { + // There are no cleared objects. + ++rep_->allocated_size; + } + + rep_->elements[current_size_++] = value; +} + +// ReleaseLast() for types that implement merge/copy behavior. +template <typename TypeHandler> +inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal( + std::true_type) { + // First, release an element. + typename TypeHandler::Type* result = UnsafeArenaReleaseLast<TypeHandler>(); + // Now perform a copy if we're on an arena. + Arena* arena = GetArena(); + + typename TypeHandler::Type* new_result; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + new_result = copy<TypeHandler>(result); + if (arena == nullptr) delete result; +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + new_result = (arena == nullptr) ? result : copy<TypeHandler>(result); +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return new_result; +} + +// ReleaseLast() for types that *do not* implement merge/copy behavior -- this +// is the same as UnsafeArenaReleaseLast(). Note that we GOOGLE_DCHECK-fail if we're on +// an arena, since the user really should implement the copy operation in this +// case. +template <typename TypeHandler> +inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal( + std::false_type) { + GOOGLE_DCHECK(GetArena() == nullptr) + << "ReleaseLast() called on a RepeatedPtrField that is on an arena, " + << "with a type that does not implement MergeFrom. This is unsafe; " + << "please implement MergeFrom for your type."; + return UnsafeArenaReleaseLast<TypeHandler>(); +} + +template <typename TypeHandler> +inline typename TypeHandler::Type* +RepeatedPtrFieldBase::UnsafeArenaReleaseLast() { + GOOGLE_DCHECK_GT(current_size_, 0); + typename TypeHandler::Type* result = + cast<TypeHandler>(rep_->elements[--current_size_]); + --rep_->allocated_size; + if (current_size_ < rep_->allocated_size) { + // There are cleared elements on the end; replace the removed element + // with the last allocated element. + rep_->elements[current_size_] = rep_->elements[rep_->allocated_size]; + } + return result; +} + +inline int RepeatedPtrFieldBase::ClearedCount() const { + return rep_ ? (rep_->allocated_size - current_size_) : 0; +} + +template <typename TypeHandler> +inline void RepeatedPtrFieldBase::AddCleared( + typename TypeHandler::Type* value) { + GOOGLE_DCHECK(GetArena() == nullptr) + << "AddCleared() can only be used on a RepeatedPtrField not on an arena."; + GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr) + << "AddCleared() can only accept values not on an arena."; + if (!rep_ || rep_->allocated_size == total_size_) { + Reserve(total_size_ + 1); + } + rep_->elements[rep_->allocated_size++] = value; +} + +template <typename TypeHandler> +inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseCleared() { + GOOGLE_DCHECK(GetArena() == nullptr) + << "ReleaseCleared() can only be used on a RepeatedPtrField not on " + << "an arena."; + GOOGLE_DCHECK(GetArena() == nullptr); + GOOGLE_DCHECK(rep_ != nullptr); + GOOGLE_DCHECK_GT(rep_->allocated_size, current_size_); + return cast<TypeHandler>(rep_->elements[--rep_->allocated_size]); +} + +} // namespace internal + +// ------------------------------------------------------------------- + +template <typename Element> +class RepeatedPtrField<Element>::TypeHandler + : public internal::GenericTypeHandler<Element> {}; + +template <> +class RepeatedPtrField<TProtoStringType>::TypeHandler + : public internal::StringTypeHandler {}; + +template <typename Element> +constexpr RepeatedPtrField<Element>::RepeatedPtrField() + : RepeatedPtrFieldBase() {} + +template <typename Element> +inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena) + : RepeatedPtrFieldBase(arena) {} + +template <typename Element> +inline RepeatedPtrField<Element>::RepeatedPtrField( + const RepeatedPtrField& other) + : RepeatedPtrFieldBase() { + MergeFrom(other); +} + +template <typename Element> +template <typename Iter, typename> +inline RepeatedPtrField<Element>::RepeatedPtrField(Iter begin, Iter end) { + Add(begin, end); +} + +template <typename Element> +RepeatedPtrField<Element>::~RepeatedPtrField() { +#ifdef __cpp_if_constexpr + if constexpr (std::is_base_of<MessageLite, Element>::value) { +#else + if (std::is_base_of<MessageLite, Element>::value) { +#endif + if (NeedsDestroy()) DestroyProtos(); + } else { + Destroy<TypeHandler>(); + } +} + +template <typename Element> +inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( + const RepeatedPtrField& other) { + if (this != &other) CopyFrom(other); + return *this; +} + +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. + if (other.GetArena()) { + CopyFrom(other); + } else { + InternalSwap(&other); + } +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE +} + +template <typename Element> +inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=( + RepeatedPtrField&& other) noexcept { + // 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 (GetArena() != other.GetArena() +#ifdef PROTOBUF_FORCE_COPY_IN_MOVE + || GetArena() == nullptr +#endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + CopyFrom(other); + } else { + InternalSwap(&other); + } + } + return *this; +} + +template <typename Element> +inline bool RepeatedPtrField<Element>::empty() const { + return RepeatedPtrFieldBase::empty(); +} + +template <typename Element> +inline int RepeatedPtrField<Element>::size() const { + return RepeatedPtrFieldBase::size(); +} + +template <typename Element> +inline const Element& RepeatedPtrField<Element>::Get(int index) const { + return RepeatedPtrFieldBase::Get<TypeHandler>(index); +} + +template <typename Element> +inline const Element& RepeatedPtrField<Element>::at(int index) const { + return RepeatedPtrFieldBase::at<TypeHandler>(index); +} + +template <typename Element> +inline Element& RepeatedPtrField<Element>::at(int index) { + return RepeatedPtrFieldBase::at<TypeHandler>(index); +} + + +template <typename Element> +inline Element* RepeatedPtrField<Element>::Mutable(int index) { + return RepeatedPtrFieldBase::Mutable<TypeHandler>(index); +} + +template <typename Element> +inline Element* RepeatedPtrField<Element>::Add() { + return RepeatedPtrFieldBase::Add<TypeHandler>(); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::Add(Element&& value) { + RepeatedPtrFieldBase::Add<TypeHandler>(std::move(value)); +} + +template <typename Element> +template <typename Iter> +inline void RepeatedPtrField<Element>::Add(Iter begin, Iter end) { + if (std::is_base_of< + std::forward_iterator_tag, + typename std::iterator_traits<Iter>::iterator_category>::value) { + int reserve = std::distance(begin, end); + Reserve(size() + reserve); + } + for (; begin != end; ++begin) { + *Add() = *begin; + } +} + +template <typename Element> +inline void RepeatedPtrField<Element>::RemoveLast() { + RepeatedPtrFieldBase::RemoveLast<TypeHandler>(); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::DeleteSubrange(int start, int num) { + GOOGLE_DCHECK_GE(start, 0); + GOOGLE_DCHECK_GE(num, 0); + GOOGLE_DCHECK_LE(start + num, size()); + for (int i = 0; i < num; ++i) { + RepeatedPtrFieldBase::Delete<TypeHandler>(start + i); + } + UnsafeArenaExtractSubrange(start, num, nullptr); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::ExtractSubrange(int start, int num, + Element** elements) { + typename internal::TypeImplementsMergeBehavior< + typename TypeHandler::Type>::type t; + ExtractSubrangeInternal(start, num, elements, t); +} + +// ExtractSubrange() implementation for types that implement merge/copy +// behavior. +template <typename Element> +inline void RepeatedPtrField<Element>::ExtractSubrangeInternal( + int start, int num, Element** elements, std::true_type) { + GOOGLE_DCHECK_GE(start, 0); + GOOGLE_DCHECK_GE(num, 0); + GOOGLE_DCHECK_LE(start + num, size()); + + if (num == 0) return; + + GOOGLE_DCHECK_NE(elements, nullptr) + << "Releasing elements without transferring ownership is an unsafe " + "operation. Use UnsafeArenaExtractSubrange."; + if (elements == nullptr) { + CloseGap(start, num); + return; + } + + Arena* arena = GetArena(); +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + // Always copy. + for (int i = 0; i < num; ++i) { + elements[i] = copy<TypeHandler>( + RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start)); + } + if (arena == nullptr) { + for (int i = 0; i < num; ++i) { + delete RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start); + } + } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + // If we're on an arena, we perform a copy for each element so that the + // returned elements are heap-allocated. Otherwise, just forward it. + if (arena != nullptr) { + for (int i = 0; i < num; ++i) { + elements[i] = copy<TypeHandler>( + RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start)); + } + } else { + for (int i = 0; i < num; ++i) { + elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start); + } + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + CloseGap(start, num); +} + +// ExtractSubrange() implementation for types that do not implement merge/copy +// behavior. +template <typename Element> +inline void RepeatedPtrField<Element>::ExtractSubrangeInternal( + int start, int num, Element** elements, std::false_type) { + // This case is identical to UnsafeArenaExtractSubrange(). However, since + // ExtractSubrange() must return heap-allocated objects by contract, and we + // cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that + // we are not on an arena. + GOOGLE_DCHECK(GetArena() == nullptr) + << "ExtractSubrange() when arena is non-nullptr is only supported when " + << "the Element type supplies a MergeFrom() operation to make copies."; + UnsafeArenaExtractSubrange(start, num, elements); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::UnsafeArenaExtractSubrange( + int start, int num, Element** elements) { + GOOGLE_DCHECK_GE(start, 0); + GOOGLE_DCHECK_GE(num, 0); + GOOGLE_DCHECK_LE(start + num, size()); + + if (num > 0) { + // Save the values of the removed elements if requested. + if (elements != nullptr) { + for (int i = 0; i < num; ++i) { + elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start); + } + } + CloseGap(start, num); + } +} + +template <typename Element> +inline void RepeatedPtrField<Element>::Clear() { + RepeatedPtrFieldBase::Clear<TypeHandler>(); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::MergeFrom( + const RepeatedPtrField& other) { + RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::CopyFrom(const RepeatedPtrField& other) { + RepeatedPtrFieldBase::CopyFrom<TypeHandler>(other); +} + +template <typename Element> +template <typename Iter> +inline void RepeatedPtrField<Element>::Assign(Iter begin, Iter end) { + Clear(); + Add(begin, end); +} + +template <typename Element> +inline typename RepeatedPtrField<Element>::iterator +RepeatedPtrField<Element>::erase(const_iterator position) { + return erase(position, position + 1); +} + +template <typename Element> +inline typename RepeatedPtrField<Element>::iterator +RepeatedPtrField<Element>::erase(const_iterator first, const_iterator last) { + size_type pos_offset = std::distance(cbegin(), first); + size_type last_offset = std::distance(cbegin(), last); + DeleteSubrange(pos_offset, last_offset - pos_offset); + return begin() + pos_offset; +} + +template <typename Element> +inline Element** RepeatedPtrField<Element>::mutable_data() { + return RepeatedPtrFieldBase::mutable_data<TypeHandler>(); +} + +template <typename Element> +inline const Element* const* RepeatedPtrField<Element>::data() const { + return RepeatedPtrFieldBase::data<TypeHandler>(); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::Swap(RepeatedPtrField* other) { + if (this == other) return; + RepeatedPtrFieldBase::Swap<TypeHandler>(other); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::UnsafeArenaSwap( + RepeatedPtrField* other) { + if (this == other) return; + RepeatedPtrFieldBase::InternalSwap(other); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::SwapElements(int index1, int index2) { + RepeatedPtrFieldBase::SwapElements(index1, index2); +} + +template <typename Element> +inline Arena* RepeatedPtrField<Element>::GetArena() const { + return RepeatedPtrFieldBase::GetArena(); +} + +template <typename Element> +inline size_t RepeatedPtrField<Element>::SpaceUsedExcludingSelfLong() const { + return RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong<TypeHandler>(); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::AddAllocated(Element* value) { + RepeatedPtrFieldBase::AddAllocated<TypeHandler>(value); +} + +template <typename Element> +inline void RepeatedPtrField<Element>::UnsafeArenaAddAllocated(Element* value) { + RepeatedPtrFieldBase::UnsafeArenaAddAllocated<TypeHandler>(value); +} + +template <typename Element> +inline Element* RepeatedPtrField<Element>::ReleaseLast() { + return RepeatedPtrFieldBase::ReleaseLast<TypeHandler>(); +} + +template <typename Element> +inline Element* RepeatedPtrField<Element>::UnsafeArenaReleaseLast() { + return RepeatedPtrFieldBase::UnsafeArenaReleaseLast<TypeHandler>(); +} + +template <typename Element> +inline int RepeatedPtrField<Element>::ClearedCount() const { + return RepeatedPtrFieldBase::ClearedCount(); +} + +#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES +template <typename Element> +inline void RepeatedPtrField<Element>::AddCleared(Element* value) { + return RepeatedPtrFieldBase::AddCleared<TypeHandler>(value); +} + +template <typename Element> +inline Element* RepeatedPtrField<Element>::ReleaseCleared() { + return RepeatedPtrFieldBase::ReleaseCleared<TypeHandler>(); +} +#endif // !PROTOBUF_FUTURE_BREAKING_CHANGES + +template <typename Element> +inline void RepeatedPtrField<Element>::Reserve(int new_size) { + return RepeatedPtrFieldBase::Reserve(new_size); +} + +template <typename Element> +inline int RepeatedPtrField<Element>::Capacity() const { + return RepeatedPtrFieldBase::Capacity(); +} + +// ------------------------------------------------------------------- + +namespace internal { + +// STL-like iterator implementation for RepeatedPtrField. You should not +// refer to this class directly; use RepeatedPtrField<T>::iterator instead. +// +// The iterator for RepeatedPtrField<T>, RepeatedPtrIterator<T>, is +// very similar to iterator_ptr<T**> in util/gtl/iterator_adaptors.h, +// but adds random-access operators and is modified to wrap a void** base +// iterator (since RepeatedPtrField stores its array as a void* array and +// casting void** to T** would violate C++ aliasing rules). +// +// This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin +// (jyasskin@google.com). +template <typename Element> +class RepeatedPtrIterator { + public: + using iterator = RepeatedPtrIterator<Element>; + using iterator_category = std::random_access_iterator_tag; + using value_type = typename std::remove_const<Element>::type; + using difference_type = std::ptrdiff_t; + using pointer = Element*; + using reference = Element&; + + RepeatedPtrIterator() : it_(nullptr) {} + explicit RepeatedPtrIterator(void* const* it) : it_(it) {} + + // Allow "upcasting" from RepeatedPtrIterator<T**> to + // RepeatedPtrIterator<const T*const*>. + template <typename OtherElement> + RepeatedPtrIterator(const RepeatedPtrIterator<OtherElement>& other) + : it_(other.it_) { + // Force a compiler error if the other type is not convertible to ours. + if (false) { + static_cast<void>([](OtherElement* from) -> Element* { return from; }); + } + } + + // dereferenceable + reference operator*() const { return *reinterpret_cast<Element*>(*it_); } + pointer operator->() const { return &(operator*()); } + + // {inc,dec}rementable + iterator& operator++() { + ++it_; + return *this; + } + iterator operator++(int) { return iterator(it_++); } + iterator& operator--() { + --it_; + return *this; + } + iterator operator--(int) { return iterator(it_--); } + + // equality_comparable + bool operator==(const iterator& x) const { return it_ == x.it_; } + bool operator!=(const iterator& x) const { return it_ != x.it_; } + + // less_than_comparable + bool operator<(const iterator& x) const { return it_ < x.it_; } + bool operator<=(const iterator& x) const { return it_ <= x.it_; } + bool operator>(const iterator& x) const { return it_ > x.it_; } + bool operator>=(const iterator& x) const { return it_ >= x.it_; } + + // addable, subtractable + iterator& operator+=(difference_type d) { + it_ += d; + return *this; + } + friend iterator operator+(iterator it, const difference_type d) { + it += d; + return it; + } + friend iterator operator+(const difference_type d, iterator it) { + it += d; + return it; + } + iterator& operator-=(difference_type d) { + it_ -= d; + return *this; + } + friend iterator operator-(iterator it, difference_type d) { + it -= d; + return it; + } + + // indexable + reference operator[](difference_type d) const { return *(*this + d); } + + // random access iterator + difference_type operator-(const iterator& x) const { return it_ - x.it_; } + + private: + template <typename OtherElement> + friend class RepeatedPtrIterator; + + // The internal iterator. + void* const* it_; +}; + +// Provide an iterator that operates on pointers to the underlying objects +// rather than the objects themselves as RepeatedPtrIterator does. +// Consider using this when working with stl algorithms that change +// the array. +// The VoidPtr template parameter holds the type-agnostic pointer value +// referenced by the iterator. It should either be "void *" for a mutable +// iterator, or "const void* const" for a constant iterator. +template <typename Element, typename VoidPtr> +class RepeatedPtrOverPtrsIterator { + public: + using iterator = RepeatedPtrOverPtrsIterator<Element, VoidPtr>; + using iterator_category = std::random_access_iterator_tag; + using value_type = typename std::remove_const<Element>::type; + using difference_type = std::ptrdiff_t; + using pointer = Element*; + using reference = Element&; + + RepeatedPtrOverPtrsIterator() : it_(nullptr) {} + explicit RepeatedPtrOverPtrsIterator(VoidPtr* it) : it_(it) {} + + // dereferenceable + reference operator*() const { return *reinterpret_cast<Element*>(it_); } + pointer operator->() const { return &(operator*()); } + + // {inc,dec}rementable + iterator& operator++() { + ++it_; + return *this; + } + iterator operator++(int) { return iterator(it_++); } + iterator& operator--() { + --it_; + return *this; + } + iterator operator--(int) { return iterator(it_--); } + + // equality_comparable + bool operator==(const iterator& x) const { return it_ == x.it_; } + bool operator!=(const iterator& x) const { return it_ != x.it_; } + + // less_than_comparable + bool operator<(const iterator& x) const { return it_ < x.it_; } + bool operator<=(const iterator& x) const { return it_ <= x.it_; } + bool operator>(const iterator& x) const { return it_ > x.it_; } + bool operator>=(const iterator& x) const { return it_ >= x.it_; } + + // addable, subtractable + iterator& operator+=(difference_type d) { + it_ += d; + return *this; + } + friend iterator operator+(iterator it, difference_type d) { + it += d; + return it; + } + friend iterator operator+(difference_type d, iterator it) { + it += d; + return it; + } + iterator& operator-=(difference_type d) { + it_ -= d; + return *this; + } + friend iterator operator-(iterator it, difference_type d) { + it -= d; + return it; + } + + // indexable + reference operator[](difference_type d) const { return *(*this + d); } + + // random access iterator + difference_type operator-(const iterator& x) const { return it_ - x.it_; } + + private: + template <typename OtherElement> + friend class RepeatedPtrIterator; + + // The internal iterator. + VoidPtr* it_; +}; + +void RepeatedPtrFieldBase::InternalSwap(RepeatedPtrFieldBase* rhs) { + GOOGLE_DCHECK(this != rhs); + + // Swap all fields at once. + auto temp = std::make_tuple(rhs->arena_, rhs->current_size_, rhs->total_size_, + rhs->rep_); + std::tie(rhs->arena_, rhs->current_size_, rhs->total_size_, rhs->rep_) = + std::make_tuple(arena_, current_size_, total_size_, rep_); + std::tie(arena_, current_size_, total_size_, rep_) = temp; +} + +} // namespace internal + +template <typename Element> +inline typename RepeatedPtrField<Element>::iterator +RepeatedPtrField<Element>::begin() { + return iterator(raw_data()); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::const_iterator +RepeatedPtrField<Element>::begin() const { + return iterator(raw_data()); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::const_iterator +RepeatedPtrField<Element>::cbegin() const { + return begin(); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::iterator +RepeatedPtrField<Element>::end() { + return iterator(raw_data() + size()); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::const_iterator +RepeatedPtrField<Element>::end() const { + return iterator(raw_data() + size()); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::const_iterator +RepeatedPtrField<Element>::cend() const { + return end(); +} + +template <typename Element> +inline typename RepeatedPtrField<Element>::pointer_iterator +RepeatedPtrField<Element>::pointer_begin() { + return pointer_iterator(raw_mutable_data()); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::const_pointer_iterator +RepeatedPtrField<Element>::pointer_begin() const { + return const_pointer_iterator(const_cast<const void* const*>(raw_data())); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::pointer_iterator +RepeatedPtrField<Element>::pointer_end() { + return pointer_iterator(raw_mutable_data() + size()); +} +template <typename Element> +inline typename RepeatedPtrField<Element>::const_pointer_iterator +RepeatedPtrField<Element>::pointer_end() const { + return const_pointer_iterator( + const_cast<const void* const*>(raw_data() + size())); +} + +// Iterators and helper functions that follow the spirit of the STL +// std::back_insert_iterator and std::back_inserter but are tailor-made +// for RepeatedField and RepeatedPtrField. Typical usage would be: +// +// std::copy(some_sequence.begin(), some_sequence.end(), +// RepeatedFieldBackInserter(proto.mutable_sequence())); +// +// Ported by johannes from util/gtl/proto-array-iterators.h + +namespace internal { + +// A back inserter for RepeatedPtrField objects. +template <typename 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) { + *field_->Add() = value; + return *this; + } + RepeatedPtrFieldBackInsertIterator<T>& operator=( + const T* const ptr_to_value) { + *field_->Add() = *ptr_to_value; + return *this; + } + RepeatedPtrFieldBackInsertIterator<T>& operator=(T&& value) { + *field_->Add() = std::move(value); + return *this; + } + RepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; } + RepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; } + RepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) { + return *this; + } + + private: + RepeatedPtrField<T>* field_; +}; + +// A back inserter for RepeatedPtrFields that inserts by transferring ownership +// of a pointer. +template <typename 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) {} + AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=( + T* const ptr_to_value) { + field_->AddAllocated(ptr_to_value); + return *this; + } + AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; } + AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; } + AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) { + return *this; + } + + private: + RepeatedPtrField<T>* field_; +}; + +// Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one +// uses the UnsafeArenaAddAllocated instead. +template <typename 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) {} + UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=( + T const* const ptr_to_value) { + field_->UnsafeArenaAddAllocated(const_cast<T*>(ptr_to_value)); + return *this; + } + UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() { + return *this; + } + UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() { + return *this; + } + UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++( + int /* unused */) { + return *this; + } + + private: + RepeatedPtrField<T>* field_; +}; + +} // namespace internal + +// Provides a back insert iterator for RepeatedPtrField instances, +// similar to std::back_inserter(). +template <typename T> +internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedPtrFieldBackInserter( + RepeatedPtrField<T>* const mutable_field) { + return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field); +} + +// Special back insert iterator for RepeatedPtrField instances, just in +// case someone wants to write generic template code that can access both +// RepeatedFields and RepeatedPtrFields using a common name. +template <typename T> +internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedFieldBackInserter( + RepeatedPtrField<T>* const mutable_field) { + return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field); +} + +// Provides a back insert iterator for RepeatedPtrField instances +// similar to std::back_inserter() which transfers the ownership while +// copying elements. +template <typename T> +internal::AllocatedRepeatedPtrFieldBackInsertIterator<T> +AllocatedRepeatedPtrFieldBackInserter( + RepeatedPtrField<T>* const mutable_field) { + return internal::AllocatedRepeatedPtrFieldBackInsertIterator<T>( + mutable_field); +} + +// Similar to AllocatedRepeatedPtrFieldBackInserter, using +// UnsafeArenaAddAllocated instead of AddAllocated. +// 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.UnsafeArenaAddAllocated(new T); +// ... // Do something with temp_field +// 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. +template <typename T> +internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T> +UnsafeArenaAllocatedRepeatedPtrFieldBackInserter( + RepeatedPtrField<T>* const mutable_field) { + return internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>( + mutable_field); +} + +extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE + RepeatedPtrField<TProtoStringType>; + +} // namespace protobuf +} // namespace google + +#include <google/protobuf/port_undef.inc> + +#endif // GOOGLE_PROTOBUF_REPEATED_PTR_FIELD_H__ 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 7748dc365b..15dd5494e8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.cc @@ -34,7 +34,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 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_), ~0u, // no _extensions_ @@ -93,6 +93,9 @@ SourceContext::SourceContext(const SourceContext& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_file_name().empty()) { file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_file_name(), GetArenaForAllocation()); @@ -100,8 +103,11 @@ SourceContext::SourceContext(const SourceContext& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext) } -void SourceContext::SharedCtor() { +inline void SourceContext::SharedCtor() { file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } SourceContext::~SourceContext() { @@ -128,7 +134,7 @@ void SourceContext::SetCachedSize(int size) const { void SourceContext::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceContext) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -139,12 +145,12 @@ void SourceContext::Clear() { const char* SourceContext::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string file_name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_file_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceContext.file_name")); @@ -175,10 +181,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* SourceContext::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* SourceContext::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string file_name = 1; @@ -203,7 +209,7 @@ size_t SourceContext::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceContext) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -233,7 +239,7 @@ void SourceContext::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void SourceContext::MergeFrom(const SourceContext& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceContext) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_file_name().empty()) { 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 3b168cc244..408200d2bf 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -120,7 +120,12 @@ class PROTOBUF_EXPORT SourceContext final : } inline void Swap(SourceContext* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -134,11 +139,7 @@ class PROTOBUF_EXPORT SourceContext final : // implements Message ---------------------------------------------- - inline SourceContext* New() const final { - return new SourceContext(); - } - - SourceContext* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + SourceContext* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<SourceContext>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -153,8 +154,8 @@ class PROTOBUF_EXPORT SourceContext 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -162,6 +163,8 @@ class PROTOBUF_EXPORT SourceContext final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(SourceContext* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.SourceContext"; @@ -192,7 +195,7 @@ class PROTOBUF_EXPORT SourceContext final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_file_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_file_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_file_name(); + PROTOBUF_NODISCARD TProtoStringType* release_file_name(); void set_allocated_file_name(TProtoStringType* file_name); private: const TProtoStringType& _internal_file_name() const; @@ -265,6 +268,11 @@ inline void SourceContext::set_allocated_file_name(TProtoStringType* file_name) } file_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), file_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (file_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name) } diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc b/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc index 5954609883..4596e7b2a5 100644 --- a/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/struct.pb.cc @@ -69,7 +69,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1]; 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) = { +const arc_ui32 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_), ~0u, // no _extensions_ @@ -205,7 +205,7 @@ Struct::Struct(const Struct& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct) } -void Struct::SharedCtor() { +inline void Struct::SharedCtor() { } Struct::~Struct() { @@ -235,7 +235,7 @@ void Struct::SetCachedSize(int size) const { void Struct::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Struct) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -246,12 +246,12 @@ void Struct::Clear() { const char* Struct::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // map<string, .google.protobuf.Value> fields = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -285,10 +285,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Struct::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Struct::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // map<string, .google.protobuf.Value> fields = 1; @@ -345,7 +345,7 @@ size_t Struct::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -377,7 +377,7 @@ void Struct::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Struct::MergeFrom(const Struct& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; fields_.MergeFrom(from.fields_); @@ -498,7 +498,7 @@ Value::Value(const Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Value) } -void Value::SharedCtor() { +inline void Value::SharedCtor() { clear_has_kind(); } @@ -567,7 +567,7 @@ void Value::clear_kind() { void Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -578,13 +578,13 @@ void Value::Clear() { const char* Value::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // .google.protobuf.NullValue null_value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_null_value(static_cast<::PROTOBUF_NAMESPACE_ID::NullValue>(val)); } else @@ -592,7 +592,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // double number_value = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 17)) { _internal_set_number_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr)); ptr += sizeof(double); } else @@ -600,7 +600,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // string string_value = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { auto str = _internal_mutable_string_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Value.string_value")); @@ -610,7 +610,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // bool bool_value = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) { _internal_set_bool_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); CHK_(ptr); } else @@ -618,7 +618,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // .google.protobuf.Struct struct_value = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_struct_value(), ptr); CHK_(ptr); } else @@ -626,7 +626,7 @@ const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // .google.protobuf.ListValue list_value = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { ptr = ctx->ParseMessage(_internal_mutable_list_value(), ptr); CHK_(ptr); } else @@ -655,10 +655,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Value::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // .google.protobuf.NullValue null_value = 1; @@ -718,7 +718,7 @@ size_t Value::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -783,7 +783,7 @@ void Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Value::MergeFrom(const Value& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; switch (from.kind_case()) { @@ -865,7 +865,7 @@ ListValue::ListValue(const ListValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue) } -void ListValue::SharedCtor() { +inline void ListValue::SharedCtor() { } ListValue::~ListValue() { @@ -891,7 +891,7 @@ void ListValue::SetCachedSize(int size) const { void ListValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -902,12 +902,12 @@ void ListValue::Clear() { const char* ListValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .google.protobuf.Value values = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -941,10 +941,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* ListValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* ListValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated .google.protobuf.Value values = 1; @@ -967,7 +967,7 @@ size_t ListValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -997,7 +997,7 @@ void ListValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void ListValue::MergeFrom(const ListValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; values_.MergeFrom(from.values_); diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.pb.h b/contrib/libs/protobuf/src/google/protobuf/struct.pb.h index aa87bdcfd2..b5b4dae602 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -54,7 +54,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fstruct_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fstruct_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -81,8 +81,8 @@ PROTOBUF_NAMESPACE_OPEN enum NullValue : int { NULL_VALUE = 0, - NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), - NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() + NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::min(), + NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::max() }; PROTOBUF_EXPORT bool NullValue_IsValid(int value); constexpr NullValue NullValue_MIN = NULL_VALUE; @@ -185,7 +185,12 @@ class PROTOBUF_EXPORT Struct final : } inline void Swap(Struct* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -199,11 +204,7 @@ class PROTOBUF_EXPORT Struct final : // implements Message ---------------------------------------------- - inline Struct* New() const final { - return new Struct(); - } - - Struct* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Struct* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Struct>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -218,8 +219,8 @@ class PROTOBUF_EXPORT Struct 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -227,6 +228,8 @@ class PROTOBUF_EXPORT Struct final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Struct* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Struct"; @@ -351,7 +354,12 @@ class PROTOBUF_EXPORT Value final : } inline void Swap(Value* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -365,11 +373,7 @@ class PROTOBUF_EXPORT Value final : // implements Message ---------------------------------------------- - inline Value* New() const final { - return new Value(); - } - - Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Value>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -384,8 +388,8 @@ class PROTOBUF_EXPORT Value 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -393,6 +397,8 @@ class PROTOBUF_EXPORT Value final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Value* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Value"; @@ -458,7 +464,7 @@ class PROTOBUF_EXPORT Value final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_string_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_string_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_string_value(); + PROTOBUF_NODISCARD TProtoStringType* release_string_value(); void set_allocated_string_value(TProtoStringType* string_value); private: const TProtoStringType& _internal_string_value() const; @@ -486,7 +492,7 @@ class PROTOBUF_EXPORT Value final : 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_NODISCARD ::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: @@ -504,7 +510,7 @@ class PROTOBUF_EXPORT Value final : 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_NODISCARD ::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: @@ -544,7 +550,7 @@ class PROTOBUF_EXPORT Value final : ::PROTOBUF_NAMESPACE_ID::ListValue* list_value_; } kind_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1]; + arc_ui32 _oneof_case_[1]; friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto; }; @@ -605,7 +611,12 @@ class PROTOBUF_EXPORT ListValue final : } inline void Swap(ListValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -619,11 +630,7 @@ class PROTOBUF_EXPORT ListValue final : // implements Message ---------------------------------------------- - inline ListValue* New() const final { - return new ListValue(); - } - - ListValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + ListValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ListValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -638,8 +645,8 @@ class PROTOBUF_EXPORT ListValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -647,6 +654,8 @@ class PROTOBUF_EXPORT ListValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ListValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.ListValue"; diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.proto b/contrib/libs/protobuf/src/google/protobuf/struct.proto index 545215c252..0ac843ca08 100644 --- a/contrib/libs/protobuf/src/google/protobuf/struct.proto +++ b/contrib/libs/protobuf/src/google/protobuf/struct.proto @@ -55,8 +55,8 @@ message Struct { // `Value` represents a dynamically typed value which can be either // null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. +// list of values. A producer of value is expected to set one of these +// variants. Absence of any variant indicates an error. // // The JSON representation for `Value` is JSON value. message Value { diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc index 1bf0618a79..6f8f8d0172 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc @@ -44,10 +44,6 @@ #endif #include <windows.h> #define snprintf _snprintf // see comment in strutil.cc -#elif defined(HAVE_PTHREAD) -#include <pthread.h> -#else -#error "No suitable threading library available." #endif #if defined(__ANDROID__) #include <android/log.h> diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/common.h b/contrib/libs/protobuf/src/google/protobuf/stubs/common.h index fbd9f558a1..b104f51ef5 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 3018003 +#define GOOGLE_PROTOBUF_VERSION 3019000 // 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 = 3018000; +static const int kMinHeaderVersionForLibrary = 3019000; // The minimum protoc version which works with the current version of the // headers. -#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3018000 +#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3019000 // The minimum header version which works with the current version of // protoc. This constant should only be used in VerifyVersion(). -static const int kMinHeaderVersionForProtoc = 3018000; +static const int kMinHeaderVersionForProtoc = 3019000; // 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() override; + 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/mathutil.h b/contrib/libs/protobuf/src/google/protobuf/stubs/mathutil.h index 7116d2d556..1d16bcedb2 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/mathutil.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/mathutil.h @@ -51,7 +51,7 @@ using MakeUnsignedT = // types. template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0> -bool IsNan(T val) { +bool IsNan(T /*val*/) { return false; } diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h b/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h index 5c025b1496..c4599913be 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/mutex.h @@ -144,10 +144,11 @@ using Mutex = WrappedMutex; // MutexLock(mu) acquires mu when constructed and releases it when destroyed. class GOOGLE_PROTOBUF_SCOPED_CAPABILITY PROTOBUF_EXPORT MutexLock { public: - explicit MutexLock(Mutex *mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) { + 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/port.h b/contrib/libs/protobuf/src/google/protobuf/stubs/port.h index 20496891cf..4d2750814f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/port.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/port.h @@ -65,6 +65,10 @@ #include <machine/endian.h> // __BYTE_ORDER #elif defined(__FreeBSD__) #include <sys/endian.h> // __BYTE_ORDER +#elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)) +#include <sys/isa_defs.h> // __BYTE_ORDER +#elif defined(_AIX) || defined(__TOS_AIX__) +#include <sys/machine.h> // BYTE_ORDER #else #if !defined(__QNX__) #include <endian.h> // __BYTE_ORDER @@ -271,8 +275,7 @@ static inline uint32 bswap_32(uint32 x) { #ifndef bswap_64 static inline uint64 bswap_64(uint64 x) { - return (((x & arc_ui64{0xFFu}) << 56) | - ((x & arc_ui64{0xFF00u}) << 40) | + return (((x & arc_ui64{0xFFu}) << 56) | ((x & arc_ui64{0xFF00u}) << 40) | ((x & arc_ui64{0xFF0000u}) << 24) | ((x & arc_ui64{0xFF000000u}) << 8) | ((x & arc_ui64{0xFF00000000u}) >> 8) | diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/statusor.h b/contrib/libs/protobuf/src/google/protobuf/stubs/statusor.h index a569502bce..20e603ea04 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/statusor.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/statusor.h @@ -166,7 +166,7 @@ class PROTOBUF_EXPORT StatusOrHelper { template<typename T> struct StatusOrHelper::Specialize { // For non-pointer T, a reference can never be nullptr. - static inline bool IsValueNull(const T& t) { return false; } + static inline bool IsValueNull(const T& /*t*/) { return false; } }; template<typename T> diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/stringprintf.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/stringprintf.cc index c8ba06b58c..413578c918 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/stringprintf.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/stringprintf.cc @@ -44,14 +44,11 @@ namespace google { namespace protobuf { #ifdef _MSC_VER -enum { IS_COMPILER_MSVC = 1 }; #ifndef va_copy // Define va_copy for MSVC. This is a hack, assuming va_list is simply a // pointer into the stack and is safe to copy. #define va_copy(dest, src) ((dest) = (src)) #endif -#else -enum { IS_COMPILER_MSVC = 0 }; #endif void StringAppendV(TProtoStringType* dst, const char* format, va_list ap) { @@ -74,13 +71,15 @@ void StringAppendV(TProtoStringType* dst, const char* format, va_list ap) { return; } - if (IS_COMPILER_MSVC) { +#ifdef _MSC_VER + { // Error or MSVC running out of space. MSVC 8.0 and higher // can be asked about space needed with the special idiom below: va_copy(backup_ap, ap); result = vsnprintf(nullptr, 0, format, backup_ap); va_end(backup_ap); } +#endif if (result < 0) { // Just an error. diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc index 1641f148e0..b72f10a3da 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc @@ -1272,8 +1272,8 @@ char* DoubleToBuffer(double value, char* buffer) { // truncated to a double. volatile double parsed_value = internal::NoLocaleStrtod(buffer, nullptr); if (parsed_value != value) { - int snprintf_result = - snprintf(buffer, kDoubleToBufferSize, "%.*g", DBL_DIG+2, value); + snprintf_result = + snprintf(buffer, kDoubleToBufferSize, "%.*g", DBL_DIG + 2, value); // Should never overflow; see above. GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kDoubleToBufferSize); @@ -1384,8 +1384,8 @@ char* FloatToBuffer(float value, char* buffer) { float parsed_value; if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) { - int snprintf_result = - snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+3, value); + snprintf_result = + snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG + 3, value); // Should never overflow; see above. GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize); diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.cc b/contrib/libs/protobuf/src/google/protobuf/text_format.cc index 6df8e39d7c..5b6eadfc19 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.cc @@ -38,6 +38,7 @@ #include <stdio.h> #include <algorithm> +#include <atomic> #include <climits> #include <cmath> #include <limits> @@ -84,11 +85,18 @@ inline bool IsOctNumber(const TProtoStringType& str) { } // namespace +namespace internal { +// Controls insertion of DEBUG_STRING_SILENT_MARKER. +PROTOBUF_EXPORT std::atomic<bool> enable_debug_text_format_marker; +} // namespace internal + TProtoStringType Message::DebugString() const { TProtoStringType debug_string; TextFormat::Printer printer; printer.SetExpandAny(true); + printer.SetInsertSilentMarker(internal::enable_debug_text_format_marker.load( + std::memory_order_relaxed)); printer.PrintToString(*this, &debug_string); @@ -101,6 +109,8 @@ TProtoStringType Message::ShortDebugString() const { TextFormat::Printer printer; printer.SetSingleLineMode(true); printer.SetExpandAny(true); + printer.SetInsertSilentMarker(internal::enable_debug_text_format_marker.load( + std::memory_order_relaxed)); printer.PrintToString(*this, &debug_string); // Single line mode currently might have an extra space at the end. @@ -117,6 +127,8 @@ TProtoStringType Message::Utf8DebugString() const { TextFormat::Printer printer; printer.SetUseUtf8StringEscaping(true); printer.SetExpandAny(true); + printer.SetInsertSilentMarker(internal::enable_debug_text_format_marker.load( + std::memory_order_relaxed)); printer.PrintToString(*this, &debug_string); @@ -348,6 +360,12 @@ class TextFormat::Parser::ParserImpl { } private: + static constexpr arc_i32 kint32max = std::numeric_limits<arc_i32>::max(); + static constexpr arc_ui32 kuint32max = std::numeric_limits<arc_ui32>::max(); + static constexpr arc_i64 kint64min = std::numeric_limits<arc_i64>::min(); + static constexpr arc_i64 kint64max = std::numeric_limits<arc_i64>::max(); + static constexpr arc_ui64 kuint64max = std::numeric_limits<arc_ui64>::max(); + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ParserImpl); // Reports an error with the given message with information indicating @@ -408,14 +426,19 @@ class TextFormat::Parser::ParserImpl { TryConsume("[")) { TProtoStringType full_type_name, prefix; DO(ConsumeAnyTypeUrl(&full_type_name, &prefix)); - DO(Consume("]")); - TryConsume(":"); // ':' is optional between message labels and values. + TProtoStringType prefix_and_full_type_name = + StrCat(prefix, full_type_name); + DO(ConsumeBeforeWhitespace("]")); + TryConsumeWhitespace(prefix_and_full_type_name, "Any"); + // ':' is optional between message labels and values. + TryConsumeBeforeWhitespace(":"); + TryConsumeWhitespace(prefix_and_full_type_name, "Any"); TProtoStringType serialized_value; const Descriptor* value_descriptor = finder_ ? finder_->FindAnyType(*message, prefix, full_type_name) : DefaultFinderFindAnyType(*message, prefix, full_type_name); if (value_descriptor == nullptr) { - ReportError("Could not find type \"" + prefix + full_type_name + + ReportError("Could not find type \"" + prefix_and_full_type_name + "\" stored in google.protobuf.Any."); return false; } @@ -431,14 +454,15 @@ class TextFormat::Parser::ParserImpl { } } reflection->SetString(message, any_type_url_field, - TProtoStringType(prefix + full_type_name)); + prefix_and_full_type_name); reflection->SetString(message, any_value_field, serialized_value); return true; } if (TryConsume("[")) { // Extension. DO(ConsumeFullTypeName(&field_name)); - DO(Consume("]")); + DO(ConsumeBeforeWhitespace("]")); + TryConsumeWhitespace(message->GetTypeName(), "Extension"); field = finder_ ? finder_->FindExtension(message, field_name) : DefaultFinderFindExtension(message, field_name); @@ -457,7 +481,8 @@ class TextFormat::Parser::ParserImpl { } } } else { - DO(ConsumeIdentifier(&field_name)); + DO(ConsumeIdentifierBeforeWhitespace(&field_name)); + TryConsumeWhitespace(message->GetTypeName(), "Normal"); arc_i32 field_number; if (allow_field_number_ && safe_strto32(field_name, &field_number)) { @@ -525,16 +550,19 @@ class TextFormat::Parser::ParserImpl { // start with "{" or "<" which indicates the beginning of a message body. // If there is no ":" or there is a "{" or "<" after ":", this field has // to be a message or the input is ill-formed. - bool skipResult; - if (TryConsume(":") && !LookingAt("{") && !LookingAt("<")) { - skipResult = SkipFieldValue(); + bool skip; + if (TryConsumeBeforeWhitespace(":")) { + TryConsumeWhitespace(message->GetTypeName(), "Unknown/Reserved"); + if (!LookingAt("{") && !LookingAt("<")) { + skip = SkipFieldValue(); + } else { + skip = SkipFieldMessage(); + } } else { - skipResult = SkipFieldMessage(); + skip = SkipFieldMessage(); } - // For historical reasons, fields may optionally be separated by commas or - // semicolons. TryConsume(";") || TryConsume(","); - return skipResult; + return skip; } if (singular_overwrite_policy_ == FORBID_SINGULAR_OVERWRITES) { @@ -564,7 +592,8 @@ class TextFormat::Parser::ParserImpl { // Perform special handling for embedded message types. if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { // ':' is optional here. - bool consumed_semicolon = TryConsume(":"); + bool consumed_semicolon = TryConsumeBeforeWhitespace(":"); + TryConsumeWhitespace(message->GetTypeName(), "Normal"); if (consumed_semicolon && field->options().weak() && LookingAtType(io::Tokenizer::TYPE_STRING)) { // we are getting a bytes string for a weak field. @@ -578,7 +607,8 @@ class TextFormat::Parser::ParserImpl { } } else { // ':' is required here. - DO(Consume(":")); + DO(ConsumeBeforeWhitespace(":")); + TryConsumeWhitespace(message->GetTypeName(), "Normal"); } if (field->is_repeated() && TryConsume("[")) { @@ -632,11 +662,12 @@ class TextFormat::Parser::ParserImpl { if (TryConsume("[")) { // Extension name or type URL. DO(ConsumeTypeUrlOrFullTypeName()); - DO(Consume("]")); + DO(ConsumeBeforeWhitespace("]")); } else { TProtoStringType field_name; - DO(ConsumeIdentifier(&field_name)); + DO(ConsumeIdentifierBeforeWhitespace(&field_name)); } + TryConsumeWhitespace("Unknown/Reserved", "n/a"); // Try to guess the type of this field. // If this field is not a message, there should be a ":" between the @@ -644,8 +675,13 @@ class TextFormat::Parser::ParserImpl { // start with "{" or "<" which indicates the beginning of a message body. // If there is no ":" or there is a "{" or "<" after ":", this field has // to be a message or the input is ill-formed. - if (TryConsume(":") && !LookingAt("{") && !LookingAt("<")) { - DO(SkipFieldValue()); + if (TryConsumeBeforeWhitespace(":")) { + TryConsumeWhitespace("Unknown/Reserved", "n/a"); + if (!LookingAt("{") && !LookingAt("<")) { + DO(SkipFieldValue()); + } else { + DO(SkipFieldMessage()); + } } else { DO(SkipFieldMessage()); } @@ -967,6 +1003,15 @@ class TextFormat::Parser::ParserImpl { return false; } + // Similar to `ConsumeIdentifier`, but any following whitespace token may + // be reported. + bool ConsumeIdentifierBeforeWhitespace(TProtoStringType* identifier) { + tokenizer_.set_report_whitespace(true); + bool result = ConsumeIdentifier(identifier); + tokenizer_.set_report_whitespace(false); + return result; + } + // Consume a string of form "<id1>.<id2>....<idN>". bool ConsumeFullTypeName(TProtoStringType* name) { DO(ConsumeIdentifier(name)); @@ -1194,6 +1239,16 @@ class TextFormat::Parser::ParserImpl { return true; } + // Similar to `Consume`, but the following token may be tokenized as + // TYPE_WHITESPACE. + bool ConsumeBeforeWhitespace(const TProtoStringType& value) { + // Report whitespace after this token, but only once. + tokenizer_.set_report_whitespace(true); + bool result = Consume(value); + tokenizer_.set_report_whitespace(false); + return result; + } + // Attempts to consume the supplied value. Returns false if a the // token found does not match the value specified. bool TryConsume(const TProtoStringType& value) { @@ -1205,6 +1260,26 @@ class TextFormat::Parser::ParserImpl { } } + // Similar to `TryConsume`, but the following token may be tokenized as + // TYPE_WHITESPACE. + bool TryConsumeBeforeWhitespace(const TProtoStringType& value) { + // Report whitespace after this token, but only once. + tokenizer_.set_report_whitespace(true); + bool result = TryConsume(value); + tokenizer_.set_report_whitespace(false); + return result; + } + + bool TryConsumeWhitespace(const TProtoStringType& message_type, + const char* field_type) { + if (LookingAtType(io::Tokenizer::TYPE_WHITESPACE)) { + tokenizer_.Next(); + return true; + } + + return false; + } + // An internal instance of the Tokenizer's error collector, used to // collect any base-level parse errors and feed them to the ParserImpl. class ParserErrorCollector : public io::ErrorCollector { @@ -1438,8 +1513,8 @@ class TextFormat::Printer::TextGenerator class TextFormat::Printer::DebugStringFieldValuePrinter : public TextFormat::FastFieldValuePrinter { public: - void PrintMessageStart(const Message& message, int field_index, - int field_count, bool single_line_mode, + void PrintMessageStart(const Message& /*message*/, int /*field_index*/, + int /*field_count*/, bool single_line_mode, BaseTextGenerator* generator) const override { // This is safe as only TextGenerator is used with // DebugStringFieldValuePrinter. @@ -1490,7 +1565,7 @@ const Descriptor* TextFormat::Finder::FindAnyType( } MessageFactory* TextFormat::Finder::FindExtensionFactory( - const FieldDescriptor* field) const { + const FieldDescriptor* /*field*/) const { return nullptr; } @@ -1553,7 +1628,6 @@ bool TextFormat::Parser::ParseFromString(ConstStringParam input, return Parse(&input_stream, output); } - bool TextFormat::Parser::Merge(io::ZeroCopyInputStream* input, Message* output) { ParserImpl parser(output->GetDescriptor(), input, error_collector_, finder_, @@ -1756,7 +1830,8 @@ void TextFormat::FastFieldValuePrinter::PrintDouble( generator->PrintString(!std::isnan(val) ? SimpleDtoa(val) : "nan"); } void TextFormat::FastFieldValuePrinter::PrintEnum( - arc_i32 val, const TProtoStringType& name, BaseTextGenerator* generator) const { + arc_i32 /*val*/, const TProtoStringType& name, + BaseTextGenerator* generator) const { generator->PrintString(name); } @@ -1771,13 +1846,13 @@ void TextFormat::FastFieldValuePrinter::PrintBytes( PrintString(val, generator); } void TextFormat::FastFieldValuePrinter::PrintFieldName( - const Message& message, int field_index, int field_count, + const Message& message, int /*field_index*/, int /*field_count*/, const Reflection* reflection, const FieldDescriptor* field, BaseTextGenerator* generator) const { PrintFieldName(message, reflection, field, generator); } void TextFormat::FastFieldValuePrinter::PrintFieldName( - const Message& message, const Reflection* reflection, + const Message& /*message*/, const Reflection* /*reflection*/, const FieldDescriptor* field, BaseTextGenerator* generator) const { if (field->is_extension()) { generator->PrintLiteral("["); @@ -1791,7 +1866,7 @@ void TextFormat::FastFieldValuePrinter::PrintFieldName( } } void TextFormat::FastFieldValuePrinter::PrintMessageStart( - const Message& message, int field_index, int field_count, + const Message& /*message*/, int /*field_index*/, int /*field_count*/, bool single_line_mode, BaseTextGenerator* generator) const { if (single_line_mode) { generator->PrintLiteral(" { "); @@ -1800,12 +1875,12 @@ void TextFormat::FastFieldValuePrinter::PrintMessageStart( } } bool TextFormat::FastFieldValuePrinter::PrintMessageContent( - const Message& message, int field_index, int field_count, - bool single_line_mode, BaseTextGenerator* generator) const { + const Message& /*message*/, int /*field_index*/, int /*field_count*/, + bool /*single_line_mode*/, BaseTextGenerator* /*generator*/) const { return false; // Use the default printing function. } void TextFormat::FastFieldValuePrinter::PrintMessageEnd( - const Message& message, int field_index, int field_count, + const Message& /*message*/, int /*field_index*/, int /*field_count*/, bool single_line_mode, BaseTextGenerator* generator) const { if (single_line_mode) { generator->PrintLiteral("} "); @@ -1867,8 +1942,8 @@ class FieldValuePrinterWrapper : public TextFormat::FastFieldValuePrinter { TextFormat::BaseTextGenerator* generator) const override { generator->PrintString(delegate_->PrintEnum(val, name)); } - void PrintFieldName(const Message& message, int field_index, int field_count, - const Reflection* reflection, + void PrintFieldName(const Message& message, int /*field_index*/, + int /*field_count*/, const Reflection* reflection, const FieldDescriptor* field, TextFormat::BaseTextGenerator* generator) const override { generator->PrintString( diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.h b/contrib/libs/protobuf/src/google/protobuf/text_format.h index 1b6adc34e0..70c49f4ed1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.h @@ -213,7 +213,7 @@ class PROTOBUF_EXPORT TextFormat { virtual ~Finder(); // Try to find an extension of *message by fully-qualified field - // name. Returns NULL if no extension is known for this name or number. + // name. Returns nullptr if no extension is known for this name or number. // The base implementation uses the extensions already known by the message. virtual const FieldDescriptor* FindExtension(Message* message, const TProtoStringType& name) const; @@ -224,7 +224,7 @@ class PROTOBUF_EXPORT TextFormat { const Descriptor* descriptor, int number) const; // Find the message type for an Any proto. - // Returns NULL if no message is known for this name. + // Returns nullptr if no message is known for this name. // The base implementation only accepts prefixes of type.googleprod.com/ or // type.googleapis.com/, and searches the DescriptorPool of the parent // message. @@ -365,6 +365,13 @@ class PROTOBUF_EXPORT TextFormat { const MessagePrinter* printer); private: + friend TProtoStringType Message::DebugString() const; + friend TProtoStringType Message::ShortDebugString() const; + friend TProtoStringType Message::Utf8DebugString() const; + + // Sets whether *DebugString should insert a silent marker. + void SetInsertSilentMarker(bool v) { insert_silent_marker_ = v; } + // Forward declaration of an internal class used to print the text // output to the OutputStream (see text_format.cc for implementation). class TextGenerator; @@ -564,18 +571,19 @@ class PROTOBUF_EXPORT TextFormat { // Like TextFormat::MergeFromString(). bool MergeFromString(ConstStringParam input, Message* output); - // Set where to report parse errors. If NULL (the default), errors will + // Set where to report parse errors. If nullptr (the default), errors will // be printed to stderr. void RecordErrorsTo(io::ErrorCollector* error_collector) { error_collector_ = error_collector; } - // Set how parser finds extensions. If NULL (the default), the + // Set how parser finds extensions. If nullptr (the default), the // parser will use the standard Reflection object associated with // the message being parsed. void SetFinder(const Finder* finder) { finder_ = finder; } - // Sets where location information about the parse will be written. If NULL + // Sets where location information about the parse will be written. If + // nullptr // (the default), then no location will be written. void WriteLocationsTo(ParseInfoTree* tree) { parse_info_tree_ = tree; } diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc index d1559b58d2..6f39fd988f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.cc @@ -35,7 +35,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, _internal_metadata_), ~0u, // no _extensions_ @@ -100,7 +100,7 @@ Timestamp::Timestamp(const Timestamp& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) } -void Timestamp::SharedCtor() { +inline void Timestamp::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&seconds_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&nanos_) - @@ -130,7 +130,7 @@ void Timestamp::SetCachedSize(int size) const { void Timestamp::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -143,12 +143,12 @@ void Timestamp::Clear() { const char* Timestamp::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // int64 seconds = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -156,8 +156,8 @@ const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -185,10 +185,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Timestamp::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Timestamp::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // int64 seconds = 1; @@ -215,7 +215,7 @@ size_t Timestamp::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Timestamp) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -248,7 +248,7 @@ void Timestamp::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Timestamp::MergeFrom(const Timestamp& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Timestamp) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_seconds() != 0) { diff --git a/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h b/contrib/libs/protobuf/src/google/protobuf/timestamp.pb.h index a4190b3dae..744cd9a2af 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ftimestamp_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftimestamp_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -120,7 +120,12 @@ class PROTOBUF_EXPORT Timestamp final : } inline void Swap(Timestamp* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -134,11 +139,7 @@ class PROTOBUF_EXPORT Timestamp final : // implements Message ---------------------------------------------- - inline Timestamp* New() const final { - return new Timestamp(); - } - - Timestamp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Timestamp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Timestamp>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -153,8 +154,8 @@ class PROTOBUF_EXPORT Timestamp 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -162,6 +163,8 @@ class PROTOBUF_EXPORT Timestamp final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Timestamp* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Timestamp"; @@ -189,20 +192,20 @@ class PROTOBUF_EXPORT Timestamp final : }; // int64 seconds = 1; void clear_seconds(); - ::PROTOBUF_NAMESPACE_ID::int64 seconds() const; - void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 seconds() const; + void set_seconds(arc_i64 value); private: - ::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const; - void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 _internal_seconds() const; + void _internal_set_seconds(arc_i64 value); public: // int32 nanos = 2; void clear_nanos(); - ::PROTOBUF_NAMESPACE_ID::int32 nanos() const; - void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 nanos() const; + void set_nanos(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const; - void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_nanos() const; + void _internal_set_nanos(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Timestamp) @@ -212,8 +215,8 @@ class PROTOBUF_EXPORT Timestamp final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::int64 seconds_; - ::PROTOBUF_NAMESPACE_ID::int32 nanos_; + arc_i64 seconds_; + arc_i32 nanos_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2ftimestamp_2eproto; }; @@ -232,18 +235,18 @@ class PROTOBUF_EXPORT Timestamp final : inline void Timestamp::clear_seconds() { seconds_ = arc_i64{0}; } -inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::_internal_seconds() const { +inline arc_i64 Timestamp::_internal_seconds() const { return seconds_; } -inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::seconds() const { +inline arc_i64 Timestamp::seconds() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) return _internal_seconds(); } -inline void Timestamp::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Timestamp::_internal_set_seconds(arc_i64 value) { seconds_ = value; } -inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Timestamp::set_seconds(arc_i64 value) { _internal_set_seconds(value); // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) } @@ -252,18 +255,18 @@ inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) { inline void Timestamp::clear_nanos() { nanos_ = 0; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::_internal_nanos() const { +inline arc_i32 Timestamp::_internal_nanos() const { return nanos_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::nanos() const { +inline arc_i32 Timestamp::nanos() const { // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) return _internal_nanos(); } -inline void Timestamp::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Timestamp::_internal_set_nanos(arc_i32 value) { nanos_ = value; } -inline void Timestamp::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Timestamp::set_nanos(arc_i32 value) { _internal_set_nanos(value); // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) } diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.cc b/contrib/libs/protobuf/src/google/protobuf/type.pb.cc index 7e8e795bd8..a12ad27b82 100644 --- a/contrib/libs/protobuf/src/google/protobuf/type.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/type.pb.cc @@ -107,7 +107,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[3]; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftype_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _internal_metadata_), ~0u, // no _extensions_ @@ -272,7 +272,7 @@ bool Field_Kind_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr Field_Kind Field::TYPE_UNKNOWN; constexpr Field_Kind Field::TYPE_DOUBLE; constexpr Field_Kind Field::TYPE_FLOAT; @@ -295,7 +295,7 @@ constexpr Field_Kind Field::TYPE_SINT64; constexpr Field_Kind Field::Kind_MIN; constexpr Field_Kind Field::Kind_MAX; constexpr int Field::Kind_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Field_Cardinality_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[1]; @@ -312,7 +312,7 @@ bool Field_Cardinality_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr Field_Cardinality Field::CARDINALITY_UNKNOWN; constexpr Field_Cardinality Field::CARDINALITY_OPTIONAL; constexpr Field_Cardinality Field::CARDINALITY_REQUIRED; @@ -320,7 +320,7 @@ constexpr Field_Cardinality Field::CARDINALITY_REPEATED; constexpr Field_Cardinality Field::Cardinality_MIN; constexpr Field_Cardinality Field::Cardinality_MAX; constexpr int Field::Cardinality_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Syntax_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[2]; @@ -372,6 +372,9 @@ Type::Type(const Type& from) options_(from.options_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -385,8 +388,11 @@ Type::Type(const Type& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Type) } -void Type::SharedCtor() { +inline void Type::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) - @@ -418,7 +424,7 @@ void Type::SetCachedSize(int size) const { void Type::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Type) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -437,12 +443,12 @@ void Type::Clear() { const char* Type::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Type.name")); @@ -452,7 +458,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // repeated .google.protobuf.Field fields = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -465,7 +471,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // repeated string oneofs = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -480,7 +486,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // repeated .google.protobuf.Option options = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { ptr -= 1; do { ptr += 1; @@ -493,7 +499,7 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // .google.protobuf.SourceContext source_context = 5; case 5: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); } else @@ -501,8 +507,8 @@ const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); } else @@ -531,10 +537,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Type::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Type::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Type) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -600,7 +606,7 @@ size_t Type::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Type) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -665,7 +671,7 @@ void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Type::MergeFrom(const Type& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Type) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; fields_.MergeFrom(from.fields_); @@ -742,21 +748,33 @@ Field::Field(const Field& from) options_(from.options_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_type_url().empty()) { type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(), GetArenaForAllocation()); } json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_json_name().empty()) { json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(), GetArenaForAllocation()); } default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_default_value().empty()) { default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(), GetArenaForAllocation()); @@ -767,11 +785,23 @@ Field::Field(const Field& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Field) } -void Field::SharedCtor() { +inline void Field::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&kind_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&packed_) - @@ -805,7 +835,7 @@ void Field::SetCachedSize(int size) const { void Field::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Field) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -823,13 +853,13 @@ void Field::Clear() { const char* Field::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // .google.protobuf.Field.Kind kind = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_kind(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Kind>(val)); } else @@ -837,8 +867,8 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_cardinality(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Cardinality>(val)); } else @@ -846,15 +876,15 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { + number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // string name = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.name")); @@ -864,7 +894,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // string type_url = 6; case 6: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) { auto str = _internal_mutable_type_url(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.type_url")); @@ -874,15 +904,15 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) { + oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // bool packed = 8; case 8: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) { packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -890,7 +920,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // repeated .google.protobuf.Option options = 9; case 9: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) { ptr -= 1; do { ptr += 1; @@ -903,7 +933,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // string json_name = 10; case 10: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) { auto str = _internal_mutable_json_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.json_name")); @@ -913,7 +943,7 @@ const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inte continue; // string default_value = 11; case 11: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) { auto str = _internal_mutable_default_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.default_value")); @@ -944,10 +974,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Field::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Field::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Field) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // .google.protobuf.Field.Kind kind = 1; @@ -1042,7 +1072,7 @@ size_t Field::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Field) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1127,7 +1157,7 @@ void Field::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Field::MergeFrom(const Field& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Field) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; options_.MergeFrom(from.options_); @@ -1246,6 +1276,9 @@ Enum::Enum(const Enum& from) options_(from.options_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -1259,8 +1292,11 @@ Enum::Enum(const Enum& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Enum) } -void Enum::SharedCtor() { +inline void Enum::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) - @@ -1292,7 +1328,7 @@ void Enum::SetCachedSize(int size) const { void Enum::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Enum) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1310,12 +1346,12 @@ void Enum::Clear() { const char* Enum::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Enum.name")); @@ -1325,7 +1361,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // repeated .google.protobuf.EnumValue enumvalue = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr -= 1; do { ptr += 1; @@ -1338,7 +1374,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // repeated .google.protobuf.Option options = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -1351,7 +1387,7 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter continue; // .google.protobuf.SourceContext source_context = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr); CHK_(ptr); } else @@ -1359,8 +1395,8 @@ const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::inter 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) { + arc_ui64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val)); } else @@ -1389,10 +1425,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Enum::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Enum::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Enum) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -1448,7 +1484,7 @@ size_t Enum::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Enum) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1505,7 +1541,7 @@ void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Enum::MergeFrom(const Enum& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Enum) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; enumvalue_.MergeFrom(from.enumvalue_); @@ -1580,6 +1616,9 @@ EnumValue::EnumValue(const EnumValue& from) options_(from.options_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -1588,8 +1627,11 @@ EnumValue::EnumValue(const EnumValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue) } -void EnumValue::SharedCtor() { +inline void EnumValue::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING number_ = 0; } @@ -1617,7 +1659,7 @@ void EnumValue::SetCachedSize(int size) const { void EnumValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1630,12 +1672,12 @@ void EnumValue::Clear() { const char* EnumValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.EnumValue.name")); @@ -1645,15 +1687,15 @@ const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID:: 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); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { + number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // repeated .google.protobuf.Option options = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr -= 1; do { ptr += 1; @@ -1687,10 +1729,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* EnumValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* EnumValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -1729,7 +1771,7 @@ size_t EnumValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1771,7 +1813,7 @@ void EnumValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void EnumValue::MergeFrom(const EnumValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; options_.MergeFrom(from.options_); @@ -1845,6 +1887,9 @@ Option::Option(const Option& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_name().empty()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); @@ -1857,8 +1902,11 @@ Option::Option(const Option& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Option) } -void Option::SharedCtor() { +inline void Option::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING value_ = nullptr; } @@ -1887,7 +1935,7 @@ void Option::SetCachedSize(int size) const { void Option::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Option) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1902,12 +1950,12 @@ void Option::Clear() { const char* Option::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Option.name")); @@ -1917,7 +1965,7 @@ const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::int continue; // .google.protobuf.Any value = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { ptr = ctx->ParseMessage(_internal_mutable_value(), ptr); CHK_(ptr); } else @@ -1946,10 +1994,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Option::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Option::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Option) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string name = 1; @@ -1982,7 +2030,7 @@ size_t Option::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Option) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -2019,7 +2067,7 @@ void Option::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Option::MergeFrom(const Option& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Option) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_name().empty()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.h b/contrib/libs/protobuf/src/google/protobuf/type.pb.h index c7e2f6dd6f..c3d703ba40 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -53,7 +53,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ftype_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftype_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -102,8 +102,8 @@ enum Field_Kind : int { Field_Kind_TYPE_SFIXED64 = 16, Field_Kind_TYPE_SINT32 = 17, Field_Kind_TYPE_SINT64 = 18, - Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), - Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() + Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::min(), + Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::max() }; PROTOBUF_EXPORT bool Field_Kind_IsValid(int value); constexpr Field_Kind Field_Kind_Kind_MIN = Field_Kind_TYPE_UNKNOWN; @@ -129,8 +129,8 @@ enum Field_Cardinality : int { Field_Cardinality_CARDINALITY_OPTIONAL = 1, Field_Cardinality_CARDINALITY_REQUIRED = 2, Field_Cardinality_CARDINALITY_REPEATED = 3, - Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), - Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() + Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::min(), + Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::max() }; PROTOBUF_EXPORT bool Field_Cardinality_IsValid(int value); constexpr Field_Cardinality Field_Cardinality_Cardinality_MIN = Field_Cardinality_CARDINALITY_UNKNOWN; @@ -154,8 +154,8 @@ inline bool Field_Cardinality_Parse( enum Syntax : int { SYNTAX_PROTO2 = 0, SYNTAX_PROTO3 = 1, - Syntax_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), - Syntax_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() + Syntax_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::min(), + Syntax_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<arc_i32>::max() }; PROTOBUF_EXPORT bool Syntax_IsValid(int value); constexpr Syntax Syntax_MIN = SYNTAX_PROTO2; @@ -233,7 +233,12 @@ class PROTOBUF_EXPORT Type final : } inline void Swap(Type* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -247,11 +252,7 @@ class PROTOBUF_EXPORT Type final : // implements Message ---------------------------------------------- - inline Type* New() const final { - return new Type(); - } - - Type* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Type* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Type>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -266,8 +267,8 @@ class PROTOBUF_EXPORT Type 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -275,6 +276,8 @@ class PROTOBUF_EXPORT Type final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Type* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Type"; @@ -370,7 +373,7 @@ class PROTOBUF_EXPORT Type final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -385,7 +388,7 @@ class PROTOBUF_EXPORT Type final : 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_NODISCARD ::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: @@ -478,7 +481,12 @@ class PROTOBUF_EXPORT Field final : } inline void Swap(Field* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -492,11 +500,7 @@ class PROTOBUF_EXPORT Field final : // implements Message ---------------------------------------------- - inline Field* New() const final { - return new Field(); - } - - Field* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Field* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Field>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -511,8 +515,8 @@ class PROTOBUF_EXPORT Field 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -520,6 +524,8 @@ class PROTOBUF_EXPORT Field final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Field* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Field"; @@ -675,7 +681,7 @@ class PROTOBUF_EXPORT Field final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -689,7 +695,7 @@ class PROTOBUF_EXPORT Field final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_type_url(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_type_url(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_type_url(); + PROTOBUF_NODISCARD TProtoStringType* release_type_url(); void set_allocated_type_url(TProtoStringType* type_url); private: const TProtoStringType& _internal_type_url() const; @@ -703,7 +709,7 @@ class PROTOBUF_EXPORT Field final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_json_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_json_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_json_name(); + PROTOBUF_NODISCARD TProtoStringType* release_json_name(); void set_allocated_json_name(TProtoStringType* json_name); private: const TProtoStringType& _internal_json_name() const; @@ -717,7 +723,7 @@ class PROTOBUF_EXPORT Field final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_default_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_default_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_default_value(); + PROTOBUF_NODISCARD TProtoStringType* release_default_value(); void set_allocated_default_value(TProtoStringType* default_value); private: const TProtoStringType& _internal_default_value() const; @@ -745,20 +751,20 @@ class PROTOBUF_EXPORT Field final : // int32 number = 3; void clear_number(); - ::PROTOBUF_NAMESPACE_ID::int32 number() const; - void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 number() const; + void set_number(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; - void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_number() const; + void _internal_set_number(arc_i32 value); public: // int32 oneof_index = 7; void clear_oneof_index(); - ::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const; - void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 oneof_index() const; + void set_oneof_index(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const; - void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_oneof_index() const; + void _internal_set_oneof_index(arc_i32 value); public: // bool packed = 8; @@ -784,8 +790,8 @@ class PROTOBUF_EXPORT Field final : ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr default_value_; int kind_; int cardinality_; - ::PROTOBUF_NAMESPACE_ID::int32 number_; - ::PROTOBUF_NAMESPACE_ID::int32 oneof_index_; + arc_i32 number_; + arc_i32 oneof_index_; bool packed_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; @@ -847,7 +853,12 @@ class PROTOBUF_EXPORT Enum final : } inline void Swap(Enum* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -861,11 +872,7 @@ class PROTOBUF_EXPORT Enum final : // implements Message ---------------------------------------------- - inline Enum* New() const final { - return new Enum(); - } - - Enum* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Enum* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Enum>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -880,8 +887,8 @@ class PROTOBUF_EXPORT Enum 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -889,6 +896,8 @@ class PROTOBUF_EXPORT Enum final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Enum* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Enum"; @@ -959,7 +968,7 @@ class PROTOBUF_EXPORT Enum final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -974,7 +983,7 @@ class PROTOBUF_EXPORT Enum final : 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_NODISCARD ::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: @@ -1066,7 +1075,12 @@ class PROTOBUF_EXPORT EnumValue final : } inline void Swap(EnumValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1080,11 +1094,7 @@ class PROTOBUF_EXPORT EnumValue final : // implements Message ---------------------------------------------- - inline EnumValue* New() const final { - return new EnumValue(); - } - - EnumValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + EnumValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<EnumValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1099,8 +1109,8 @@ class PROTOBUF_EXPORT EnumValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1108,6 +1118,8 @@ class PROTOBUF_EXPORT EnumValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(EnumValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.EnumValue"; @@ -1158,7 +1170,7 @@ class PROTOBUF_EXPORT EnumValue final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -1168,11 +1180,11 @@ class PROTOBUF_EXPORT EnumValue final : // int32 number = 2; void clear_number(); - ::PROTOBUF_NAMESPACE_ID::int32 number() const; - void set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 number() const; + void set_number(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const; - void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_number() const; + void _internal_set_number(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.EnumValue) @@ -1184,7 +1196,7 @@ class PROTOBUF_EXPORT EnumValue final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - ::PROTOBUF_NAMESPACE_ID::int32 number_; + arc_i32 number_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto; }; @@ -1245,7 +1257,12 @@ class PROTOBUF_EXPORT Option final : } inline void Swap(Option* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1259,11 +1276,7 @@ class PROTOBUF_EXPORT Option final : // implements Message ---------------------------------------------- - inline Option* New() const final { - return new Option(); - } - - Option* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Option* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Option>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1278,8 +1291,8 @@ class PROTOBUF_EXPORT Option 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1287,6 +1300,8 @@ class PROTOBUF_EXPORT Option final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Option* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Option"; @@ -1318,7 +1333,7 @@ class PROTOBUF_EXPORT Option final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -1333,7 +1348,7 @@ class PROTOBUF_EXPORT Option final : public: void clear_value(); const ::PROTOBUF_NAMESPACE_ID::Any& value() const; - PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::Any* release_value(); + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Any* release_value(); ::PROTOBUF_NAMESPACE_ID::Any* mutable_value(); void set_allocated_value(::PROTOBUF_NAMESPACE_ID::Any* value); private: @@ -1410,6 +1425,11 @@ inline void Type::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name) } @@ -1722,18 +1742,18 @@ inline void Field::set_cardinality(::PROTOBUF_NAMESPACE_ID::Field_Cardinality va inline void Field::clear_number() { number_ = 0; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_number() const { +inline arc_i32 Field::_internal_number() const { return number_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Field::number() const { +inline arc_i32 Field::number() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.number) return _internal_number(); } -inline void Field::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Field::_internal_set_number(arc_i32 value) { number_ = value; } -inline void Field::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Field::set_number(arc_i32 value) { _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.number) } @@ -1781,6 +1801,11 @@ inline void Field::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name) } @@ -1827,6 +1852,11 @@ inline void Field::set_allocated_type_url(TProtoStringType* type_url) { } type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url) } @@ -1834,18 +1864,18 @@ inline void Field::set_allocated_type_url(TProtoStringType* type_url) { inline void Field::clear_oneof_index() { oneof_index_ = 0; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_oneof_index() const { +inline arc_i32 Field::_internal_oneof_index() const { return oneof_index_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Field::oneof_index() const { +inline arc_i32 Field::oneof_index() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) return _internal_oneof_index(); } -inline void Field::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Field::_internal_set_oneof_index(arc_i32 value) { oneof_index_ = value; } -inline void Field::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Field::set_oneof_index(arc_i32 value) { _internal_set_oneof_index(value); // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) } @@ -1953,6 +1983,11 @@ inline void Field::set_allocated_json_name(TProtoStringType* json_name) { } json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name) } @@ -1999,6 +2034,11 @@ inline void Field::set_allocated_default_value(TProtoStringType* default_value) } default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value) } @@ -2049,6 +2089,11 @@ inline void Enum::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name) } @@ -2285,6 +2330,11 @@ inline void EnumValue::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name) } @@ -2292,18 +2342,18 @@ inline void EnumValue::set_allocated_name(TProtoStringType* name) { inline void EnumValue::clear_number() { number_ = 0; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::_internal_number() const { +inline arc_i32 EnumValue::_internal_number() const { return number_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::number() const { +inline arc_i32 EnumValue::number() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) return _internal_number(); } -inline void EnumValue::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumValue::_internal_set_number(arc_i32 value) { number_ = value; } -inline void EnumValue::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void EnumValue::set_number(arc_i32 value) { _internal_set_number(value); // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) } @@ -2395,6 +2445,11 @@ inline void Option::set_allocated_name(TProtoStringType* name) { } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name) } 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 941317d7d5..5715434b0f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc +++ b/contrib/libs/protobuf/src/google/protobuf/unknown_field_set.cc @@ -252,6 +252,7 @@ void UnknownField::Delete() { } void UnknownField::DeepCopy(const UnknownField& other) { + (void)other; // Parameter is used by Google-internal code. switch (type()) { case UnknownField::TYPE_LENGTH_DELIMITED: data_.length_delimited_.string_value = diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.cc b/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.cc index 2dd7124845..217013c5ed 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.cc @@ -58,7 +58,7 @@ SimpleFieldComparator::~SimpleFieldComparator() {} FieldComparator::ComparisonResult SimpleFieldComparator::SimpleCompare( const Message& message_1, const Message& message_2, const FieldDescriptor* field, int index_1, int index_2, - const util::FieldContext* field_context) { + const util::FieldContext* /*field_context*/) { const Reflection* reflection_1 = message_1.GetReflection(); const Reflection* reflection_2 = message_2.GetReflection(); @@ -155,7 +155,7 @@ bool SimpleFieldComparator::CompareDouble(const FieldDescriptor& field, return CompareDoubleOrFloat(field, value_1, value_2); } -bool SimpleFieldComparator::CompareEnum(const FieldDescriptor& field, +bool SimpleFieldComparator::CompareEnum(const FieldDescriptor& /*field*/, const EnumValueDescriptor* value_1, const EnumValueDescriptor* value_2) { return value_1->number() == value_2->number(); 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 bb0901eb5b..32db742a2e 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 @@ -62,7 +62,7 @@ bool FieldMaskUtil::SnakeCaseToCamelCase(StringPiece input, TProtoStringType* output) { output->clear(); bool after_underscore = false; - for (const char& input_char : input) { + for (char input_char : input) { if (input_char >= 'A' && input_char <= 'Z') { // The field name must not contain uppercase letters. return false; @@ -385,8 +385,8 @@ void FieldMaskTree::RemovePath(const TProtoStringType& path, if (new_branch_node == nullptr) { new_branch_node = node; } - for (int i = 0; i < current_descriptor->field_count(); ++i) { - node->children[current_descriptor->field(i)->name()] = new Node(); + for (int j = 0; j < current_descriptor->field_count(); ++j) { + node->children[current_descriptor->field(j)->name()] = new Node(); } } if (ContainsKey(node->children, parts[i])) { diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h index ac00149bf4..bdfc92c440 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_mask_util.h @@ -245,7 +245,7 @@ class PROTOBUF_EXPORT FieldMaskUtil::TrimOptions { // When trimming message fields, the default behavior is to trim required // fields of the present message if they are not specified in the field mask. // If you instead want to keep required fields of the present message even - // they are not specified in the field mask, set this flag to true. + // when they are not specified in the field mask, set this flag to true. void set_keep_required_fields(bool value) { keep_required_fields_ = value; } bool keep_required_fields() const { return keep_required_fields_; } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h index 7b4dfcf3ba..0a5bdd74af 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/datapiece.h @@ -97,7 +97,7 @@ class PROTOBUF_EXPORT DataPiece { str_(value), use_strict_base64_decoding_(use_strict_base64_decoding) {} // Constructor for bytes. The second parameter is not used. - DataPiece(StringPiece value, bool dummy, bool use_strict_base64_decoding) + DataPiece(StringPiece value, bool /*dummy*/, bool use_strict_base64_decoding) : type_(TYPE_BYTES), str_(value), use_strict_base64_decoding_(use_strict_base64_decoding) {} 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 f1abe8725f..46b5513d15 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 @@ -423,18 +423,14 @@ DataPiece DefaultValueObjectWriter::FindEnumDefault( 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) { + 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() - << "'"; + GOOGLE_LOG(WARNING) << "Could not find enum value '" << enum_default_value_name + << "' with type '" << field.type_url() << "'"; return DataPiece::NullData(); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/error_listener.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/error_listener.h index 07cb95701d..745b66a952 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/error_listener.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/error_listener.h @@ -83,16 +83,16 @@ class PROTOBUF_EXPORT NoopErrorListener : public ErrorListener { NoopErrorListener() {} ~NoopErrorListener() override {} - void InvalidName(const LocationTrackerInterface& loc, - StringPiece invalid_name, - StringPiece message) override {} + void InvalidName(const LocationTrackerInterface& /*loc*/, + StringPiece /* invalid_name */, + StringPiece /* message */) override {} - void InvalidValue(const LocationTrackerInterface& loc, - StringPiece type_name, - StringPiece value) override {} + void InvalidValue(const LocationTrackerInterface& /*loc*/, + StringPiece /* type_name */, + StringPiece /* value */) override {} - void MissingField(const LocationTrackerInterface& loc, - StringPiece missing_name) override {} + void MissingField(const LocationTrackerInterface& /* loc */, + StringPiece /* missing_name */) override {} private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(NoopErrorListener); 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 0564aee619..62d2a8fe9b 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 @@ -864,6 +864,7 @@ bool JsonStreamParser::IsEmptyNullAllowed(TokenType type) { util::Status JsonStreamParser::ReportFailure(StringPiece message, ParseErrorType parse_code) { + (void)parse_code; // Parameter is used in Google-internal code. static const int kContextLength = 20; const char* p_start = p_.data(); const char* json_start = json_.data(); diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc index d96098a6fd..8a04f7927f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc @@ -252,7 +252,7 @@ util::StatusOr<arc_ui32> ProtoStreamObjectSource::RenderList( } util::StatusOr<arc_ui32> ProtoStreamObjectSource::RenderMap( - const google::protobuf::Field* field, StringPiece name, + const google::protobuf::Field* field, StringPiece /* name */, arc_ui32 list_tag, ObjectWriter* ow) const { const google::protobuf::Type* field_type = typeinfo_->GetTypeByTypeUrl(field->type_url()); @@ -265,16 +265,16 @@ util::StatusOr<arc_ui32> ProtoStreamObjectSource::RenderMap( TProtoStringType map_key; for (arc_ui32 tag = stream_->ReadTag(); tag != 0; tag = stream_->ReadTag()) { - const google::protobuf::Field* field = + const google::protobuf::Field* map_entry_field = FindAndVerifyField(*field_type, tag); - if (field == nullptr) { + if (map_entry_field == nullptr) { WireFormat::SkipField(stream_, tag, nullptr); continue; } // Map field numbers are key = 1 and value = 2 - if (field->number() == 1) { - map_key = ReadFieldValueAsString(*field); - } else if (field->number() == 2) { + if (map_entry_field->number() == 1) { + map_key = ReadFieldValueAsString(*map_entry_field); + } else if (map_entry_field->number() == 2) { if (map_key.empty()) { // An absent map key is treated as the default. const google::protobuf::Field* key_field = @@ -286,7 +286,7 @@ util::StatusOr<arc_ui32> ProtoStreamObjectSource::RenderMap( } ASSIGN_OR_RETURN(map_key, MapKeyDefaultValueAsString(*key_field)); } - RETURN_IF_ERROR(RenderField(field, map_key, ow)); + RETURN_IF_ERROR(RenderField(map_entry_field, map_key, ow)); } else { // The Type info for this map entry is incorrect. It should contain // exactly two fields with field number 1 and 2. @@ -375,7 +375,7 @@ util::Status ProtoStreamObjectSource::RenderDuration( } util::Status ProtoStreamObjectSource::RenderDouble( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui64 buffer64 = 0; // default value of Double wrapper value @@ -388,7 +388,7 @@ util::Status ProtoStreamObjectSource::RenderDouble( } util::Status ProtoStreamObjectSource::RenderFloat( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui32 buffer32 = 0; // default value of Float wrapper value @@ -401,7 +401,7 @@ util::Status ProtoStreamObjectSource::RenderFloat( } util::Status ProtoStreamObjectSource::RenderInt64( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui64 buffer64 = 0; // default value of Int64 wrapper value @@ -414,7 +414,7 @@ util::Status ProtoStreamObjectSource::RenderInt64( } util::Status ProtoStreamObjectSource::RenderUInt64( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui64 buffer64 = 0; // default value of UInt64 wrapper value @@ -427,7 +427,7 @@ util::Status ProtoStreamObjectSource::RenderUInt64( } util::Status ProtoStreamObjectSource::RenderInt32( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui32 buffer32 = 0; // default value of Int32 wrapper value @@ -440,7 +440,7 @@ util::Status ProtoStreamObjectSource::RenderInt32( } util::Status ProtoStreamObjectSource::RenderUInt32( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui32 buffer32 = 0; // default value of UInt32 wrapper value @@ -453,7 +453,7 @@ util::Status ProtoStreamObjectSource::RenderUInt32( } util::Status ProtoStreamObjectSource::RenderBool( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui64 buffer64 = 0; // results in 'false' value as default, which is the @@ -467,7 +467,7 @@ util::Status ProtoStreamObjectSource::RenderBool( } util::Status ProtoStreamObjectSource::RenderString( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui32 buffer32; @@ -482,7 +482,7 @@ util::Status ProtoStreamObjectSource::RenderString( } util::Status ProtoStreamObjectSource::RenderBytes( - const ProtoStreamObjectSource* os, const google::protobuf::Type& type, + const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/, StringPiece field_name, ObjectWriter* ow) { arc_ui32 tag = os->stream_->ReadTag(); arc_ui32 buffer32; diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc deleted file mode 100644 index 2edf372db3..0000000000 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc +++ /dev/null @@ -1,132 +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/util/internal/type_info_test_helper.h> - -#include <memory> -#include <vector> - -#include <google/protobuf/stubs/logging.h> -#include <google/protobuf/stubs/common.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/util/internal/default_value_objectwriter.h> -#include <google/protobuf/util/internal/type_info.h> -#include <google/protobuf/util/internal/constants.h> -#include <google/protobuf/util/internal/protostream_objectsource.h> -#include <google/protobuf/util/internal/protostream_objectwriter.h> -#include <google/protobuf/util/type_resolver.h> -#include <google/protobuf/util/type_resolver_util.h> - -namespace google { -namespace protobuf { -namespace util { -namespace converter { -namespace testing { - - -void TypeInfoTestHelper::ResetTypeInfo( - const std::vector<const Descriptor*>& descriptors) { - switch (type_) { - case USE_TYPE_RESOLVER: { - const DescriptorPool* pool = descriptors[0]->file()->pool(); - for (int i = 1; i < descriptors.size(); ++i) { - GOOGLE_CHECK(pool == descriptors[i]->file()->pool()) - << "Descriptors from different pools are not supported."; - } - type_resolver_.reset( - NewTypeResolverForDescriptorPool(kTypeServiceBaseUrl, pool)); - typeinfo_.reset(TypeInfo::NewTypeInfo(type_resolver_.get())); - return; - } - } - GOOGLE_LOG(FATAL) << "Can not reach here."; -} - -void TypeInfoTestHelper::ResetTypeInfo(const Descriptor* descriptor) { - std::vector<const Descriptor*> descriptors; - descriptors.push_back(descriptor); - ResetTypeInfo(descriptors); -} - -void TypeInfoTestHelper::ResetTypeInfo(const Descriptor* descriptor1, - const Descriptor* descriptor2) { - std::vector<const Descriptor*> descriptors; - descriptors.push_back(descriptor1); - descriptors.push_back(descriptor2); - ResetTypeInfo(descriptors); -} - -TypeInfo* TypeInfoTestHelper::GetTypeInfo() { return typeinfo_.get(); } - -ProtoStreamObjectSource* TypeInfoTestHelper::NewProtoSource( - io::CodedInputStream* coded_input, const TProtoStringType& type_url, - ProtoStreamObjectSource::RenderOptions render_options) { - const google::protobuf::Type* type = typeinfo_->GetTypeByTypeUrl(type_url); - switch (type_) { - case USE_TYPE_RESOLVER: { - return new ProtoStreamObjectSource(coded_input, type_resolver_.get(), - *type, render_options); - } - } - GOOGLE_LOG(FATAL) << "Can not reach here."; - return nullptr; -} - -ProtoStreamObjectWriter* TypeInfoTestHelper::NewProtoWriter( - const TProtoStringType& type_url, strings::ByteSink* output, - ErrorListener* listener, const ProtoStreamObjectWriter::Options& options) { - const google::protobuf::Type* type = typeinfo_->GetTypeByTypeUrl(type_url); - switch (type_) { - case USE_TYPE_RESOLVER: { - return new ProtoStreamObjectWriter(type_resolver_.get(), *type, output, - listener, options); - } - } - GOOGLE_LOG(FATAL) << "Can not reach here."; - return nullptr; -} - -DefaultValueObjectWriter* TypeInfoTestHelper::NewDefaultValueWriter( - const TProtoStringType& type_url, ObjectWriter* writer) { - const google::protobuf::Type* type = typeinfo_->GetTypeByTypeUrl(type_url); - switch (type_) { - case USE_TYPE_RESOLVER: { - return new DefaultValueObjectWriter(type_resolver_.get(), *type, writer); - } - } - GOOGLE_LOG(FATAL) << "Can not reach here."; - return nullptr; -} - -} // namespace testing -} // namespace converter -} // namespace util -} // namespace protobuf -} // namespace google diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h b/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h deleted file mode 100644 index 4beb1b3d57..0000000000 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info_test_helper.h +++ /dev/null @@ -1,96 +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_UTIL_CONVERTER_TYPE_INFO_TEST_HELPER_H__ -#define GOOGLE_PROTOBUF_UTIL_CONVERTER_TYPE_INFO_TEST_HELPER_H__ - -#include <memory> -#include <vector> - -#include <google/protobuf/io/coded_stream.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/util/internal/default_value_objectwriter.h> -#include <google/protobuf/util/internal/type_info.h> -#include <google/protobuf/util/internal/protostream_objectsource.h> -#include <google/protobuf/util/internal/protostream_objectwriter.h> -#include <google/protobuf/util/type_resolver.h> - -namespace google { -namespace protobuf { -namespace util { -namespace converter { -namespace testing { - -enum TypeInfoSource { - USE_TYPE_RESOLVER, -}; - -// In the unit-tests we want to test two scenarios: one with type info from -// ServiceTypeInfo, the other with type info from TypeResolver. This class -// wraps the detail of where the type info is from and provides the same -// interface so the same unit-test code can test both scenarios. -class TypeInfoTestHelper { - public: - explicit TypeInfoTestHelper(TypeInfoSource type) : type_(type) {} - - // Creates a TypeInfo object for the given set of descriptors. - void ResetTypeInfo(const std::vector<const Descriptor*>& descriptors); - - // Convenient overloads. - void ResetTypeInfo(const Descriptor* descriptor); - void ResetTypeInfo(const Descriptor* descriptor1, - const Descriptor* descriptor2); - - // Returns the TypeInfo created after ResetTypeInfo. - TypeInfo* GetTypeInfo(); - - ProtoStreamObjectSource* NewProtoSource( - io::CodedInputStream* coded_input, const TProtoStringType& type_url, - ProtoStreamObjectSource::RenderOptions render_options = {}); - - ProtoStreamObjectWriter* NewProtoWriter( - const TProtoStringType& type_url, strings::ByteSink* output, - ErrorListener* listener, const ProtoStreamObjectWriter::Options& options); - - DefaultValueObjectWriter* NewDefaultValueWriter(const TProtoStringType& type_url, - ObjectWriter* writer); - - private: - TypeInfoSource type_; - std::unique_ptr<TypeInfo> typeinfo_; - std::unique_ptr<TypeResolver> type_resolver_; -}; -} // namespace testing -} // namespace converter -} // namespace util -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_UTIL_CONVERTER_TYPE_INFO_TEST_HELPER_H__ 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 bbefca2368..5c2b9b6f97 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc @@ -78,25 +78,28 @@ class NumDiffsReporter : public google::protobuf::util::MessageDifferencer::Repo // Report that a field has been added into Message2. void ReportAdded( - const google::protobuf::Message& message1, const google::protobuf::Message& message2, + const google::protobuf::Message& /* message1 */, + const google::protobuf::Message& /* message2 */, const std::vector<google::protobuf::util::MessageDifferencer::SpecificField>& - field_path) override { + /*field_path*/) override { ++num_diffs_; } // Report that a field has been deleted from Message1. void ReportDeleted( - const google::protobuf::Message& message1, const google::protobuf::Message& message2, + const google::protobuf::Message& /* message1 */, + const google::protobuf::Message& /* message2 */, const std::vector<google::protobuf::util::MessageDifferencer::SpecificField>& - field_path) override { + /*field_path*/) override { ++num_diffs_; } // Report that the value of a field has been modified. void ReportModified( - const google::protobuf::Message& message1, const google::protobuf::Message& message2, + const google::protobuf::Message& /* message1 */, + const google::protobuf::Message& /* message2 */, const std::vector<google::protobuf::util::MessageDifferencer::SpecificField>& - field_path) override { + /*field_path*/) override { ++num_diffs_; } @@ -2076,9 +2079,9 @@ void MessageDifferencer::StreamReporter::Print(const TProtoStringType& str) { void MessageDifferencer::StreamReporter::PrintMapKey( 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."; + GOOGLE_LOG(INFO) << "PrintPath cannot log map keys; " + "use SetMessages to provide the messages " + "being compared prior to any processing."; return; } @@ -2104,7 +2107,7 @@ void MessageDifferencer::StreamReporter::PrintMapKey( } void MessageDifferencer::StreamReporter::ReportAdded( - const Message& message1, const Message& message2, + const Message& /*message1*/, const Message& message2, const std::vector<SpecificField>& field_path) { printer_->Print("added: "); PrintPath(field_path, false); @@ -2114,7 +2117,7 @@ void MessageDifferencer::StreamReporter::ReportAdded( } void MessageDifferencer::StreamReporter::ReportDeleted( - const Message& message1, const Message& message2, + const Message& message1, const Message& /*message2*/, const std::vector<SpecificField>& field_path) { printer_->Print("deleted: "); PrintPath(field_path, true); @@ -2153,7 +2156,7 @@ void MessageDifferencer::StreamReporter::ReportModified( } void MessageDifferencer::StreamReporter::ReportMoved( - const Message& message1, const Message& message2, + const Message& message1, const Message& /*message2*/, const std::vector<SpecificField>& field_path) { printer_->Print("moved: "); PrintPath(field_path, true); @@ -2165,7 +2168,7 @@ void MessageDifferencer::StreamReporter::ReportMoved( } void MessageDifferencer::StreamReporter::ReportMatched( - const Message& message1, const Message& message2, + const Message& message1, const Message& /*message2*/, const std::vector<SpecificField>& field_path) { printer_->Print("matched: "); PrintPath(field_path, true); @@ -2179,7 +2182,7 @@ void MessageDifferencer::StreamReporter::ReportMatched( } void MessageDifferencer::StreamReporter::ReportIgnored( - const Message& message1, const Message& message2, + const Message& /*message1*/, const Message& /*message2*/, const std::vector<SpecificField>& field_path) { printer_->Print("ignored: "); PrintPath(field_path, true); @@ -2197,7 +2200,7 @@ void MessageDifferencer::StreamReporter::SetMessages(const Message& message1, } void MessageDifferencer::StreamReporter::ReportUnknownFieldIgnored( - const Message& message1, const Message& message2, + const Message& /*message1*/, const Message& /*message2*/, const std::vector<SpecificField>& field_path) { printer_->Print("ignored: "); PrintPath(field_path, true); 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 b94bd0cf56..cd569075cd 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h @@ -212,20 +212,6 @@ class PROTOBUF_EXPORT MessageDifferencer { int unknown_field_index2 = -1; }; - // Class for processing Any deserialization. This logic is used by both the - // MessageDifferencer and StreamReporter classes. - class UnpackAnyField { - private: - std::unique_ptr<DynamicMessageFactory> dynamic_message_factory_; - - public: - UnpackAnyField() = default; - ~UnpackAnyField() = default; - // If "any" is of type google.protobuf.Any, extract its payload using - // DynamicMessageFactory and store in "data". - bool UnpackAny(const Message& any, std::unique_ptr<Message>* data); - }; - // Abstract base class from which all MessageDifferencer // reporters derive. The five Report* methods below will be called when // a field has been added, deleted, modified, moved, or matched. The third @@ -628,6 +614,22 @@ class PROTOBUF_EXPORT MessageDifferencer { // differences to any previously set reporters or output strings. void ReportDifferencesTo(Reporter* reporter); + private: + // Class for processing Any deserialization. This logic is used by both the + // MessageDifferencer and StreamReporter classes. + class UnpackAnyField { + private: + std::unique_ptr<DynamicMessageFactory> dynamic_message_factory_; + + public: + UnpackAnyField() = default; + ~UnpackAnyField() = default; + // If "any" is of type google.protobuf.Any, extract its payload using + // DynamicMessageFactory and store in "data". + bool UnpackAny(const Message& any, std::unique_ptr<Message>* data); + }; + + public: // An implementation of the MessageDifferencer Reporter that outputs // any differences found in human-readable form to the supplied // ZeroCopyOutputStream or Printer. If a printer is used, the delimiter diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc index db87ce3996..d7acf3da90 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc @@ -92,19 +92,19 @@ bool WireFormat::SkipField(io::CodedInputStream* input, arc_ui32 tag, case WireFormatLite::WIRETYPE_VARINT: { arc_ui64 value; if (!input->ReadVarint64(&value)) return false; - if (unknown_fields != NULL) unknown_fields->AddVarint(number, value); + if (unknown_fields != nullptr) unknown_fields->AddVarint(number, value); return true; } case WireFormatLite::WIRETYPE_FIXED64: { arc_ui64 value; if (!input->ReadLittleEndian64(&value)) return false; - if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value); + if (unknown_fields != nullptr) unknown_fields->AddFixed64(number, value); return true; } case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: { arc_ui32 length; if (!input->ReadVarint32(&length)) return false; - if (unknown_fields == NULL) { + if (unknown_fields == nullptr) { if (!input->Skip(length)) return false; } else { if (!input->ReadString(unknown_fields->AddLengthDelimited(number), @@ -116,8 +116,8 @@ bool WireFormat::SkipField(io::CodedInputStream* input, arc_ui32 tag, } case WireFormatLite::WIRETYPE_START_GROUP: { if (!input->IncrementRecursionDepth()) return false; - if (!SkipMessage(input, (unknown_fields == NULL) - ? NULL + if (!SkipMessage(input, (unknown_fields == nullptr) + ? nullptr : unknown_fields->AddGroup(number))) { return false; } @@ -136,7 +136,7 @@ bool WireFormat::SkipField(io::CodedInputStream* input, arc_ui32 tag, case WireFormatLite::WIRETYPE_FIXED32: { arc_ui32 value; if (!input->ReadLittleEndian32(&value)) return false; - if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value); + if (unknown_fields != nullptr) unknown_fields->AddFixed32(number, value); return true; } default: { @@ -179,7 +179,7 @@ bool WireFormat::ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, input, &value)) { return false; } - if (is_valid == NULL || is_valid(value)) { + if (is_valid == nullptr || is_valid(value)) { values->Add(value); } else { unknown_fields->AddVarint(field_number, value); @@ -346,15 +346,15 @@ bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, return true; } - const FieldDescriptor* field = NULL; + const FieldDescriptor* field = nullptr; - if (descriptor != NULL) { + if (descriptor != nullptr) { int field_number = WireFormatLite::GetTagFieldNumber(tag); field = descriptor->FindFieldByNumber(field_number); // If that failed, check if the field is an extension. - if (field == NULL && descriptor->IsExtensionNumber(field_number)) { - if (input->GetExtensionPool() == NULL) { + if (field == nullptr && descriptor->IsExtensionNumber(field_number)) { + if (input->GetExtensionPool() == nullptr) { field = message_reflection->FindKnownExtensionByNumber(field_number); } else { field = input->GetExtensionPool()->FindExtensionByNumber( @@ -364,7 +364,7 @@ bool WireFormat::ParseAndMergePartial(io::CodedInputStream* input, // If that failed, but we're a MessageSet, and this is the tag for a // MessageSet item, then parse that. - if (field == NULL && descriptor->options().message_set_wire_format() && + if (field == nullptr && descriptor->options().message_set_wire_format() && tag == WireFormatLite::kMessageSetItemStartTag) { if (!ParseAndMergeMessageSetItem(input, message)) { return false; @@ -393,7 +393,7 @@ bool WireFormat::ParseAndMergeMessageSetField(arc_ui32 field_number, Message* message, io::CodedInputStream* input) { const Reflection* message_reflection = message->GetReflection(); - if (field == NULL) { + if (field == nullptr) { // We store unknown MessageSet extensions as groups. return SkipMessageSetField( input, field_number, message_reflection->MutableUnknownFields(message)); @@ -416,13 +416,13 @@ static bool StrictUtf8Check(const FieldDescriptor* field) { bool WireFormat::ParseAndMergeField( arc_ui32 tag, - const FieldDescriptor* field, // May be NULL for unknown + const FieldDescriptor* field, // May be nullptr for unknown Message* message, io::CodedInputStream* input) { const Reflection* message_reflection = message->GetReflection(); enum { UNKNOWN, NORMAL_FORMAT, PACKED_FORMAT } value_format; - if (field == NULL) { + if (field == nullptr) { value_format = UNKNOWN; } else if (WireFormatLite::GetTagWireType(tag) == WireTypeForFieldType(field->type())) { @@ -489,7 +489,7 @@ bool WireFormat::ParseAndMergeField( } else { const EnumValueDescriptor* enum_value = field->enum_type()->FindValueByNumber(value); - if (enum_value != NULL) { + if (enum_value != nullptr) { message_reflection->AddEnum(message, field, enum_value); } else { // The enum value is not one of the known values. Add it to the @@ -642,7 +642,7 @@ bool WireFormat::ParseAndMergeMessageSetItem(io::CodedInputStream* input, } bool SkipField(arc_ui32 tag, io::CodedInputStream* input) { - return WireFormat::SkipField(input, tag, NULL); + return WireFormat::SkipField(input, tag, nullptr); } const Reflection* message_reflection; @@ -657,11 +657,9 @@ struct WireFormat::MessageSetParser { const char* _InternalParse(const char* ptr, internal::ParseContext* ctx) { // Parse a MessageSetItem auto metadata = reflection->MutableInternalMetadata(msg); - enum class State { kNoTag, kHasType, kHasPayload, kDone }; - State state = State::kNoTag; - TProtoStringType payload; arc_ui32 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. @@ -670,11 +668,8 @@ struct WireFormat::MessageSetParser { arc_ui64 tmp; ptr = ParseBigVarint(ptr, &tmp); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - if (state == State::kNoTag) { - type_id = tmp; - state = State::kHasType; - } else if (state == State::kHasPayload) { - type_id = tmp; + type_id = tmp; + if (payload_read) { const FieldDescriptor* field; if (ctx->data().pool == nullptr) { field = reflection->FindKnownExtensionByNumber(type_id); @@ -701,17 +696,17 @@ struct WireFormat::MessageSetParser { GOOGLE_PROTOBUF_PARSER_ASSERT(value->_InternalParse(p, &tmp_ctx) && tmp_ctx.EndedAtLimit()); } - state = State::kDone; + type_id = 0; } continue; } else if (tag == WireFormatLite::kMessageSetMessageTag) { - if (state == State::kNoTag) { + if (type_id == 0) { arc_i32 size = ReadSize(&ptr); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ptr = ctx->ReadString(ptr, size, &payload); GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - state = State::kHasPayload; - } else if (state == State::kHasType) { + payload_read = true; + } else { // We're now parsing the payload const FieldDescriptor* field = nullptr; if (descriptor->IsExtensionNumber(type_id)) { @@ -725,12 +720,7 @@ struct WireFormat::MessageSetParser { ptr = WireFormat::_InternalParseAndMergeField( msg, ptr, ctx, static_cast<arc_ui64>(type_id) * 8 + 2, reflection, field); - state = State::kDone; - } else { - arc_i32 size = ReadSize(&ptr); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); - ptr = ctx->Skip(ptr, size); - GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); + type_id = 0; } } else { // An unknown field in MessageSetItem. @@ -1002,9 +992,9 @@ const char* WireFormat::_InternalParseAndMergeField( } } if (field->is_repeated()) { - reflection->AddString(msg, field, value); + reflection->AddString(msg, field, std::move(value)); } else { - reflection->SetString(msg, field, value); + reflection->SetString(msg, field, std::move(value)); } return ptr; } diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.h b/contrib/libs/protobuf/src/google/protobuf/wire_format.h index 0b4573b4c7..2ff7eb3b45 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.h @@ -146,17 +146,17 @@ class PROTOBUF_EXPORT WireFormat { // Helpers for dealing with unknown fields // Skips a field value of the given WireType. The input should start - // positioned immediately after the tag. If unknown_fields is non-NULL, + // positioned immediately after the tag. If unknown_fields is non-nullptr, // the contents of the field will be added to it. static bool SkipField(io::CodedInputStream* input, arc_ui32 tag, UnknownFieldSet* unknown_fields); // Reads and ignores a message from the input. If unknown_fields is - // non-NULL, the contents will be added to it. + // non-nullptr, the contents will be added to it. static bool SkipMessage(io::CodedInputStream* input, UnknownFieldSet* unknown_fields); - // Read a packed enum field. If the is_valid function is not NULL, values + // Read a packed enum field. If the is_valid function is not nullptr, values // for which is_valid(value) returns false are appended to // unknown_fields_stream. static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, @@ -225,24 +225,24 @@ class PROTOBUF_EXPORT WireFormat { // after the tag. static bool ParseAndMergeField( arc_ui32 tag, - const FieldDescriptor* field, // May be NULL for unknown + const FieldDescriptor* field, // May be nullptr for unknown Message* message, io::CodedInputStream* input); // Serialize a single field. static void SerializeFieldWithCachedSizes( - const FieldDescriptor* field, // Cannot be NULL + const FieldDescriptor* field, // Cannot be nullptr const Message& message, io::CodedOutputStream* output) { output->SetCur(InternalSerializeField(field, message, output->Cur(), output->EpsCopy())); } static uint8_t* InternalSerializeField( - const FieldDescriptor* field, // Cannot be NULL + const FieldDescriptor* field, // Cannot be nullptr 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 // its size. - static size_t FieldByteSize(const FieldDescriptor* field, // Cannot be NULL + static size_t FieldByteSize(const FieldDescriptor* field, // Can't be nullptr const Message& message); // Parse/serialize a MessageSet::Item group. Used with messages that use @@ -266,7 +266,7 @@ class PROTOBUF_EXPORT WireFormat { // length, but for other length-delimited types, the size of the length is // included. static size_t FieldDataOnlyByteSize( - const FieldDescriptor* field, // Cannot be NULL + const FieldDescriptor* field, // Cannot be nullptr const Message& message); enum Operation { @@ -357,7 +357,7 @@ inline void WireFormat::VerifyUTF8String(const char* data, int size, WireFormat::Operation op) { #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED WireFormatLite::VerifyUtf8String( - data, size, static_cast<WireFormatLite::Operation>(op), NULL); + data, size, static_cast<WireFormatLite::Operation>(op), nullptr); #else // Avoid the compiler warning about unused variables. (void)data; 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 5fb731ce72..9089ff1a7e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc @@ -34,6 +34,7 @@ #include <google/protobuf/wire_format_lite.h> +#include <limits> #include <stack> #include <string> #include <vector> @@ -52,7 +53,7 @@ namespace google { namespace protobuf { namespace internal { -#if !defined(_MSC_VER) || _MSC_VER >= 1900 +#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912) // Old version of MSVC doesn't like definitions of inline constants, GCC // requires them. const int WireFormatLite::kMessageSetItemStartTag; @@ -303,7 +304,7 @@ bool WireFormatLite::ReadPackedEnumPreserveUnknowns( if (!ReadPrimitive<int, WireFormatLite::TYPE_ENUM>(input, &value)) { return false; } - if (is_valid == NULL || is_valid(value)) { + if (is_valid == nullptr || is_valid(value)) { values->Add(value); } else { arc_ui32 tag = WireFormatLite::MakeTag(field_number, @@ -475,11 +476,13 @@ void WireFormatLite::WriteEnum(int field_number, int value, WriteEnumNoTag(value, output); } +constexpr size_t kInt32MaxSize = std::numeric_limits<arc_i32>::max(); + void WireFormatLite::WriteString(int field_number, const TProtoStringType& value, io::CodedOutputStream* output) { // String is for UTF-8 text only WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max)); + GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteString(value); } @@ -488,14 +491,14 @@ void WireFormatLite::WriteStringMaybeAliased(int field_number, io::CodedOutputStream* output) { // String is for UTF-8 text only WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max)); + GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteRawMaybeAliased(value.data(), value.size()); } void WireFormatLite::WriteBytes(int field_number, const TProtoStringType& value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max)); + GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteString(value); } @@ -503,7 +506,7 @@ void WireFormatLite::WriteBytesMaybeAliased(int field_number, const TProtoStringType& value, io::CodedOutputStream* output) { WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output); - GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max)); + GOOGLE_CHECK_LE(value.size(), kInt32MaxSize); output->WriteVarint32(value.size()); output->WriteRawMaybeAliased(value.data(), value.size()); } @@ -525,7 +528,7 @@ void WireFormatLite::WriteMessage(int field_number, const MessageLite& value, } void WireFormatLite::WriteSubMessageMaybeToArray( - int size, const MessageLite& value, io::CodedOutputStream* output) { + int /*size*/, const MessageLite& value, io::CodedOutputStream* output) { output->SetCur(value._InternalSerialize(output->Cur(), output->EpsCopy())); } @@ -570,6 +573,7 @@ bool WireFormatLite::ReadBytes(io::CodedInputStream* input, TProtoStringType** p void PrintUTF8ErrorLog(const char* field_name, const char* operation_str, bool emit_stacktrace) { TProtoStringType stacktrace; + (void)emit_stacktrace; // Parameter is used by Google-internal code. TProtoStringType quoted_field_name = ""; if (field_name != nullptr) { quoted_field_name = StringPrintf(" '%s'", field_name); @@ -583,7 +587,7 @@ void PrintUTF8ErrorLog(const char* field_name, const char* operation_str, bool WireFormatLite::VerifyUtf8String(const char* data, int size, Operation op, const char* field_name) { if (!IsStructurallyValidUTF8(data, size)) { - const char* operation_str = NULL; + const char* operation_str = nullptr; switch (op) { case PARSE: operation_str = "parsing"; 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 baa9e4e8dd..42d57bbd76 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.h @@ -62,6 +62,7 @@ // #pragma pop_macro("TYPE_BOOL") #undef TYPE_BOOL + #include <google/protobuf/port_def.inc> namespace google { @@ -289,14 +290,15 @@ class PROTOBUF_EXPORT WireFormatLite { static bool ReadPackedPrimitiveNoInline(io::CodedInputStream* input, RepeatedField<CType>* value); - // Read a packed enum field. If the is_valid function is not NULL, values for - // which is_valid(value) returns false are silently dropped. + // Read a packed enum field. If the is_valid function is not nullptr, values + // for which is_valid(value) returns false are silently dropped. static bool ReadPackedEnumNoInline(io::CodedInputStream* input, bool (*is_valid)(int), RepeatedField<int>* values); - // Read a packed enum field. If the is_valid function is not NULL, values for - // which is_valid(value) returns false are appended to unknown_fields_stream. + // Read a packed enum field. If the is_valid function is not nullptr, values + // for which is_valid(value) returns false are appended to + // unknown_fields_stream. static bool ReadPackedEnumPreserveUnknowns( io::CodedInputStream* input, int field_number, bool (*is_valid)(int), io::CodedOutputStream* unknown_fields_stream, RepeatedField<int>* values); @@ -1101,7 +1103,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive( int num_read = 0; while (num_read < elements_available && (buffer = io::CodedInputStream::ExpectTagFromArray(buffer, tag)) != - NULL) { + nullptr) { buffer = ReadPrimitiveFromArray<CType, DeclaredType>(buffer, &value); values->AddAlreadyReserved(value); ++num_read; @@ -1841,9 +1843,6 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { // we can parse it later. TProtoStringType message_data; - enum class State { kNoTag, kHasType, kHasPayload, kDone }; - State state = State::kNoTag; - while (true) { const arc_ui32 tag = input->ReadTagNoLastTag(); if (tag == 0) return false; @@ -1852,34 +1851,26 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { case WireFormatLite::kMessageSetTypeIdTag: { arc_ui32 type_id; if (!input->ReadVarint32(&type_id)) return false; - if (state == State::kNoTag) { - last_type_id = type_id; - state = State::kHasType; - } else if (state == State::kHasPayload) { + last_type_id = type_id; + + if (!message_data.empty()) { // We saw some message data before the type_id. Have to parse it // now. io::CodedInputStream sub_input( reinterpret_cast<const uint8_t*>(message_data.data()), static_cast<int>(message_data.size())); sub_input.SetRecursionLimit(input->RecursionBudget()); - if (!ms.ParseField(type_id, &sub_input)) { + if (!ms.ParseField(last_type_id, &sub_input)) { return false; } message_data.clear(); - state = State::kDone; } break; } case WireFormatLite::kMessageSetMessageTag: { - if (state == State::kHasType) { - // Already saw type_id, so we can parse this directly. - if (!ms.ParseField(last_type_id, input)) { - return false; - } - state = State::kDone; - } else if (state == State::kNoTag) { + if (last_type_id == 0) { // We haven't seen a type_id yet. Append this data to message_data. arc_ui32 length; if (!input->ReadVarint32(&length)) return false; @@ -1890,9 +1881,11 @@ bool ParseMessageSetItemImpl(io::CodedInputStream* input, MS ms) { auto ptr = reinterpret_cast<uint8_t*>(&message_data[0]); ptr = io::CodedOutputStream::WriteVarint32ToArray(length, ptr); if (!input->ReadRaw(ptr, length)) return false; - state = State::kHasPayload; } else { - if (!ms.SkipField(tag, input)) return false; + // Already saw type_id, so we can parse this directly. + if (!ms.ParseField(last_type_id, input)) { + return false; + } } break; diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc index 56a4a5ac43..eee38e9b8a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.cc @@ -130,7 +130,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr; -const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { +const arc_ui32 TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DoubleValue, _internal_metadata_), ~0u, // no _extensions_ @@ -270,7 +270,7 @@ DoubleValue::DoubleValue(const DoubleValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue) } -void DoubleValue::SharedCtor() { +inline void DoubleValue::SharedCtor() { value_ = 0; } @@ -297,7 +297,7 @@ void DoubleValue::SetCachedSize(int size) const { void DoubleValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.DoubleValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -308,12 +308,12 @@ void DoubleValue::Clear() { const char* DoubleValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // double value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 9)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); } else @@ -342,14 +342,18 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* DoubleValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* DoubleValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // double value = 1; - if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) { + static_assert(sizeof(arc_ui64) == sizeof(double), "Code assumes arc_ui64 and double are the same size."); + double tmp_value = this->_internal_value(); + arc_ui64 raw_value; + memcpy(&raw_value, &tmp_value, sizeof(tmp_value)); + if (raw_value != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_value(), target); } @@ -366,12 +370,16 @@ size_t DoubleValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DoubleValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // double value = 1; - if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) { + static_assert(sizeof(arc_ui64) == sizeof(double), "Code assumes arc_ui64 and double are the same size."); + double tmp_value = this->_internal_value(); + arc_ui64 raw_value; + memcpy(&raw_value, &tmp_value, sizeof(tmp_value)); + if (raw_value != 0) { total_size += 1 + 8; } @@ -394,10 +402,14 @@ void DoubleValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void DoubleValue::MergeFrom(const DoubleValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DoubleValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; - if (!(from._internal_value() <= 0 && from._internal_value() >= 0)) { + static_assert(sizeof(arc_ui64) == sizeof(double), "Code assumes arc_ui64 and double are the same size."); + double tmp_value = from._internal_value(); + arc_ui64 raw_value; + memcpy(&raw_value, &tmp_value, sizeof(tmp_value)); + if (raw_value != 0) { _internal_set_value(from._internal_value()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -448,7 +460,7 @@ FloatValue::FloatValue(const FloatValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue) } -void FloatValue::SharedCtor() { +inline void FloatValue::SharedCtor() { value_ = 0; } @@ -475,7 +487,7 @@ void FloatValue::SetCachedSize(int size) const { void FloatValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.FloatValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -486,12 +498,12 @@ void FloatValue::Clear() { const char* FloatValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // float value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); ptr += sizeof(float); } else @@ -520,14 +532,18 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* FloatValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* FloatValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // float value = 1; - if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) { + static_assert(sizeof(arc_ui32) == sizeof(float), "Code assumes arc_ui32 and float are the same size."); + float tmp_value = this->_internal_value(); + arc_ui32 raw_value; + memcpy(&raw_value, &tmp_value, sizeof(tmp_value)); + if (raw_value != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_value(), target); } @@ -544,12 +560,16 @@ size_t FloatValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FloatValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // float value = 1; - if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) { + static_assert(sizeof(arc_ui32) == sizeof(float), "Code assumes arc_ui32 and float are the same size."); + float tmp_value = this->_internal_value(); + arc_ui32 raw_value; + memcpy(&raw_value, &tmp_value, sizeof(tmp_value)); + if (raw_value != 0) { total_size += 1 + 4; } @@ -572,10 +592,14 @@ void FloatValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void FloatValue::MergeFrom(const FloatValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FloatValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; - if (!(from._internal_value() <= 0 && from._internal_value() >= 0)) { + static_assert(sizeof(arc_ui32) == sizeof(float), "Code assumes arc_ui32 and float are the same size."); + float tmp_value = from._internal_value(); + arc_ui32 raw_value; + memcpy(&raw_value, &tmp_value, sizeof(tmp_value)); + if (raw_value != 0) { _internal_set_value(from._internal_value()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -626,7 +650,7 @@ Int64Value::Int64Value(const Int64Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value) } -void Int64Value::SharedCtor() { +inline void Int64Value::SharedCtor() { value_ = arc_i64{0}; } @@ -653,7 +677,7 @@ void Int64Value::SetCachedSize(int size) const { void Int64Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Int64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -664,12 +688,12 @@ void Int64Value::Clear() { const char* Int64Value::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // int64 value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -698,10 +722,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Int64Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Int64Value::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // int64 value = 1; @@ -722,7 +746,7 @@ size_t Int64Value::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int64Value) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -750,7 +774,7 @@ void Int64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Int64Value::MergeFrom(const Int64Value& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int64Value) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_value() != 0) { @@ -804,7 +828,7 @@ UInt64Value::UInt64Value(const UInt64Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value) } -void UInt64Value::SharedCtor() { +inline void UInt64Value::SharedCtor() { value_ = arc_ui64{0u}; } @@ -831,7 +855,7 @@ void UInt64Value::SetCachedSize(int size) const { void UInt64Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UInt64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -842,12 +866,12 @@ void UInt64Value::Clear() { const char* UInt64Value::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // uint64 value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -876,10 +900,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* UInt64Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* UInt64Value::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // uint64 value = 1; @@ -900,7 +924,7 @@ size_t UInt64Value::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt64Value) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -928,7 +952,7 @@ void UInt64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void UInt64Value::MergeFrom(const UInt64Value& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt64Value) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_value() != 0) { @@ -982,7 +1006,7 @@ Int32Value::Int32Value(const Int32Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value) } -void Int32Value::SharedCtor() { +inline void Int32Value::SharedCtor() { value_ = 0; } @@ -1009,7 +1033,7 @@ void Int32Value::SetCachedSize(int size) const { void Int32Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.Int32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1020,13 +1044,13 @@ void Int32Value::Clear() { const char* Int32Value::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // int32 value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { - value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { + value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -1054,10 +1078,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Int32Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Int32Value::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // int32 value = 1; @@ -1078,7 +1102,7 @@ size_t Int32Value::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int32Value) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1106,7 +1130,7 @@ void Int32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Int32Value::MergeFrom(const Int32Value& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int32Value) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_value() != 0) { @@ -1160,7 +1184,7 @@ UInt32Value::UInt32Value(const UInt32Value& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value) } -void UInt32Value::SharedCtor() { +inline void UInt32Value::SharedCtor() { value_ = 0u; } @@ -1187,7 +1211,7 @@ void UInt32Value::SetCachedSize(int size) const { void UInt32Value::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.UInt32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1198,12 +1222,12 @@ void UInt32Value::Clear() { const char* UInt32Value::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // uint32 value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else @@ -1232,10 +1256,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* UInt32Value::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* UInt32Value::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // uint32 value = 1; @@ -1256,7 +1280,7 @@ size_t UInt32Value::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt32Value) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1284,7 +1308,7 @@ void UInt32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void UInt32Value::MergeFrom(const UInt32Value& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt32Value) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_value() != 0) { @@ -1338,7 +1362,7 @@ BoolValue::BoolValue(const BoolValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue) } -void BoolValue::SharedCtor() { +inline void BoolValue::SharedCtor() { value_ = false; } @@ -1365,7 +1389,7 @@ void BoolValue::SetCachedSize(int size) const { void BoolValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.BoolValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1376,12 +1400,12 @@ void BoolValue::Clear() { const char* BoolValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // bool value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); } else @@ -1410,10 +1434,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* BoolValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* BoolValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // bool value = 1; @@ -1434,7 +1458,7 @@ size_t BoolValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BoolValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1462,7 +1486,7 @@ void BoolValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void BoolValue::MergeFrom(const BoolValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BoolValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_value() != 0) { @@ -1513,6 +1537,9 @@ StringValue::StringValue(const StringValue& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_value().empty()) { value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), GetArenaForAllocation()); @@ -1520,8 +1547,11 @@ StringValue::StringValue(const StringValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue) } -void StringValue::SharedCtor() { +inline void StringValue::SharedCtor() { value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } StringValue::~StringValue() { @@ -1548,7 +1578,7 @@ void StringValue::SetCachedSize(int size) const { void StringValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.StringValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1559,12 +1589,12 @@ void StringValue::Clear() { const char* StringValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.StringValue.value")); @@ -1595,10 +1625,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* StringValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* StringValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // string value = 1; @@ -1623,7 +1653,7 @@ size_t StringValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.StringValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1653,7 +1683,7 @@ void StringValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void StringValue::MergeFrom(const StringValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.StringValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_value().empty()) { @@ -1710,6 +1740,9 @@ BytesValue::BytesValue(const BytesValue& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (!from._internal_value().empty()) { value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), GetArenaForAllocation()); @@ -1717,8 +1750,11 @@ BytesValue::BytesValue(const BytesValue& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue) } -void BytesValue::SharedCtor() { +inline void BytesValue::SharedCtor() { value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } BytesValue::~BytesValue() { @@ -1745,7 +1781,7 @@ void BytesValue::SetCachedSize(int size) const { void BytesValue::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.BytesValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1756,12 +1792,12 @@ void BytesValue::Clear() { const char* BytesValue::_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; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // bytes value = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_value(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(ptr); @@ -1791,10 +1827,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* BytesValue::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* BytesValue::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // bytes value = 1; @@ -1815,7 +1851,7 @@ size_t BytesValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BytesValue) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1845,7 +1881,7 @@ void BytesValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void BytesValue::MergeFrom(const BytesValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BytesValue) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_value().empty()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h index 02d2c5e3a0..a827390303 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -50,7 +50,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fwrappers_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fwrappers_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -152,7 +152,12 @@ class PROTOBUF_EXPORT DoubleValue final : } inline void Swap(DoubleValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -166,11 +171,7 @@ class PROTOBUF_EXPORT DoubleValue final : // implements Message ---------------------------------------------- - inline DoubleValue* New() const final { - return new DoubleValue(); - } - - DoubleValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + DoubleValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<DoubleValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -185,8 +186,8 @@ class PROTOBUF_EXPORT DoubleValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -194,6 +195,8 @@ class PROTOBUF_EXPORT DoubleValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(DoubleValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.DoubleValue"; @@ -295,7 +298,12 @@ class PROTOBUF_EXPORT FloatValue final : } inline void Swap(FloatValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -309,11 +317,7 @@ class PROTOBUF_EXPORT FloatValue final : // implements Message ---------------------------------------------- - inline FloatValue* New() const final { - return new FloatValue(); - } - - FloatValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + FloatValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FloatValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -328,8 +332,8 @@ class PROTOBUF_EXPORT FloatValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -337,6 +341,8 @@ class PROTOBUF_EXPORT FloatValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FloatValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.FloatValue"; @@ -438,7 +444,12 @@ class PROTOBUF_EXPORT Int64Value final : } inline void Swap(Int64Value* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -452,11 +463,7 @@ class PROTOBUF_EXPORT Int64Value final : // implements Message ---------------------------------------------- - inline Int64Value* New() const final { - return new Int64Value(); - } - - Int64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Int64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Int64Value>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -471,8 +478,8 @@ class PROTOBUF_EXPORT Int64Value 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -480,6 +487,8 @@ class PROTOBUF_EXPORT Int64Value final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Int64Value* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Int64Value"; @@ -506,11 +515,11 @@ class PROTOBUF_EXPORT Int64Value final : }; // int64 value = 1; void clear_value(); - ::PROTOBUF_NAMESPACE_ID::int64 value() const; - void set_value(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 value() const; + void set_value(arc_i64 value); private: - ::PROTOBUF_NAMESPACE_ID::int64 _internal_value() const; - void _internal_set_value(::PROTOBUF_NAMESPACE_ID::int64 value); + arc_i64 _internal_value() const; + void _internal_set_value(arc_i64 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Int64Value) @@ -520,7 +529,7 @@ class PROTOBUF_EXPORT Int64Value final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::int64 value_; + arc_i64 value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; @@ -581,7 +590,12 @@ class PROTOBUF_EXPORT UInt64Value final : } inline void Swap(UInt64Value* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -595,11 +609,7 @@ class PROTOBUF_EXPORT UInt64Value final : // implements Message ---------------------------------------------- - inline UInt64Value* New() const final { - return new UInt64Value(); - } - - UInt64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + UInt64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<UInt64Value>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -614,8 +624,8 @@ class PROTOBUF_EXPORT UInt64Value 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -623,6 +633,8 @@ class PROTOBUF_EXPORT UInt64Value final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(UInt64Value* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.UInt64Value"; @@ -649,11 +661,11 @@ class PROTOBUF_EXPORT UInt64Value final : }; // uint64 value = 1; void clear_value(); - ::PROTOBUF_NAMESPACE_ID::uint64 value() const; - void set_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + arc_ui64 value() const; + void set_value(arc_ui64 value); private: - ::PROTOBUF_NAMESPACE_ID::uint64 _internal_value() const; - void _internal_set_value(::PROTOBUF_NAMESPACE_ID::uint64 value); + arc_ui64 _internal_value() const; + void _internal_set_value(arc_ui64 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.UInt64Value) @@ -663,7 +675,7 @@ class PROTOBUF_EXPORT UInt64Value final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::uint64 value_; + arc_ui64 value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; @@ -724,7 +736,12 @@ class PROTOBUF_EXPORT Int32Value final : } inline void Swap(Int32Value* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -738,11 +755,7 @@ class PROTOBUF_EXPORT Int32Value final : // implements Message ---------------------------------------------- - inline Int32Value* New() const final { - return new Int32Value(); - } - - Int32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Int32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Int32Value>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -757,8 +770,8 @@ class PROTOBUF_EXPORT Int32Value 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -766,6 +779,8 @@ class PROTOBUF_EXPORT Int32Value final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Int32Value* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.Int32Value"; @@ -792,11 +807,11 @@ class PROTOBUF_EXPORT Int32Value final : }; // int32 value = 1; void clear_value(); - ::PROTOBUF_NAMESPACE_ID::int32 value() const; - void set_value(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 value() const; + void set_value(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_value() const; - void _internal_set_value(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_value() const; + void _internal_set_value(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.Int32Value) @@ -806,7 +821,7 @@ class PROTOBUF_EXPORT Int32Value final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::int32 value_; + arc_i32 value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; @@ -867,7 +882,12 @@ class PROTOBUF_EXPORT UInt32Value final : } inline void Swap(UInt32Value* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -881,11 +901,7 @@ class PROTOBUF_EXPORT UInt32Value final : // implements Message ---------------------------------------------- - inline UInt32Value* New() const final { - return new UInt32Value(); - } - - UInt32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + UInt32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<UInt32Value>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -900,8 +916,8 @@ class PROTOBUF_EXPORT UInt32Value 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -909,6 +925,8 @@ class PROTOBUF_EXPORT UInt32Value final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(UInt32Value* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.UInt32Value"; @@ -935,11 +953,11 @@ class PROTOBUF_EXPORT UInt32Value final : }; // uint32 value = 1; void clear_value(); - ::PROTOBUF_NAMESPACE_ID::uint32 value() const; - void set_value(::PROTOBUF_NAMESPACE_ID::uint32 value); + arc_ui32 value() const; + void set_value(arc_ui32 value); private: - ::PROTOBUF_NAMESPACE_ID::uint32 _internal_value() const; - void _internal_set_value(::PROTOBUF_NAMESPACE_ID::uint32 value); + arc_ui32 _internal_value() const; + void _internal_set_value(arc_ui32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.UInt32Value) @@ -949,7 +967,7 @@ class PROTOBUF_EXPORT UInt32Value final : template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; - ::PROTOBUF_NAMESPACE_ID::uint32 value_; + arc_ui32 value_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto; }; @@ -1010,7 +1028,12 @@ class PROTOBUF_EXPORT BoolValue final : } inline void Swap(BoolValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1024,11 +1047,7 @@ class PROTOBUF_EXPORT BoolValue final : // implements Message ---------------------------------------------- - inline BoolValue* New() const final { - return new BoolValue(); - } - - BoolValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + BoolValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<BoolValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1043,8 +1062,8 @@ class PROTOBUF_EXPORT BoolValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1052,6 +1071,8 @@ class PROTOBUF_EXPORT BoolValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(BoolValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.BoolValue"; @@ -1153,7 +1174,12 @@ class PROTOBUF_EXPORT StringValue final : } inline void Swap(StringValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1167,11 +1193,7 @@ class PROTOBUF_EXPORT StringValue final : // implements Message ---------------------------------------------- - inline StringValue* New() const final { - return new StringValue(); - } - - StringValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + StringValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<StringValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1186,8 +1208,8 @@ class PROTOBUF_EXPORT StringValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1195,6 +1217,8 @@ class PROTOBUF_EXPORT StringValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(StringValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.StringValue"; @@ -1225,7 +1249,7 @@ class PROTOBUF_EXPORT StringValue final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_value(); + PROTOBUF_NODISCARD TProtoStringType* release_value(); void set_allocated_value(TProtoStringType* value); private: const TProtoStringType& _internal_value() const; @@ -1301,7 +1325,12 @@ class PROTOBUF_EXPORT BytesValue final : } inline void Swap(BytesValue* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -1315,11 +1344,7 @@ class PROTOBUF_EXPORT BytesValue final : // implements Message ---------------------------------------------- - inline BytesValue* New() const final { - return new BytesValue(); - } - - BytesValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + BytesValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<BytesValue>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -1334,8 +1359,8 @@ class PROTOBUF_EXPORT BytesValue 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -1343,6 +1368,8 @@ class PROTOBUF_EXPORT BytesValue final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(BytesValue* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.BytesValue"; @@ -1373,7 +1400,7 @@ class PROTOBUF_EXPORT BytesValue final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_value(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_value(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_value(); + PROTOBUF_NODISCARD TProtoStringType* release_value(); void set_allocated_value(TProtoStringType* value); private: const TProtoStringType& _internal_value() const; @@ -1455,18 +1482,18 @@ inline void FloatValue::set_value(float value) { inline void Int64Value::clear_value() { value_ = arc_i64{0}; } -inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::_internal_value() const { +inline arc_i64 Int64Value::_internal_value() const { return value_; } -inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::value() const { +inline arc_i64 Int64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) return _internal_value(); } -inline void Int64Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Int64Value::_internal_set_value(arc_i64 value) { value_ = value; } -inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { +inline void Int64Value::set_value(arc_i64 value) { _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) } @@ -1479,18 +1506,18 @@ inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) { inline void UInt64Value::clear_value() { value_ = arc_ui64{0u}; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::_internal_value() const { +inline arc_ui64 UInt64Value::_internal_value() const { return value_; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::value() const { +inline arc_ui64 UInt64Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) return _internal_value(); } -inline void UInt64Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void UInt64Value::_internal_set_value(arc_ui64 value) { value_ = value; } -inline void UInt64Value::set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void UInt64Value::set_value(arc_ui64 value) { _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) } @@ -1503,18 +1530,18 @@ inline void UInt64Value::set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) { inline void Int32Value::clear_value() { value_ = 0; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Int32Value::_internal_value() const { +inline arc_i32 Int32Value::_internal_value() const { return value_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Int32Value::value() const { +inline arc_i32 Int32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) return _internal_value(); } -inline void Int32Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Int32Value::_internal_set_value(arc_i32 value) { value_ = value; } -inline void Int32Value::set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Int32Value::set_value(arc_i32 value) { _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) } @@ -1527,18 +1554,18 @@ inline void Int32Value::set_value(::PROTOBUF_NAMESPACE_ID::int32 value) { inline void UInt32Value::clear_value() { value_ = 0u; } -inline ::PROTOBUF_NAMESPACE_ID::uint32 UInt32Value::_internal_value() const { +inline arc_ui32 UInt32Value::_internal_value() const { return value_; } -inline ::PROTOBUF_NAMESPACE_ID::uint32 UInt32Value::value() const { +inline arc_ui32 UInt32Value::value() const { // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) return _internal_value(); } -inline void UInt32Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) { +inline void UInt32Value::_internal_set_value(arc_ui32 value) { value_ = value; } -inline void UInt32Value::set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) { +inline void UInt32Value::set_value(arc_ui32 value) { _internal_set_value(value); // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) } @@ -1614,6 +1641,11 @@ inline void StringValue::set_allocated_value(TProtoStringType* value) { } value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value) } @@ -1664,6 +1696,11 @@ inline void BytesValue::set_allocated_value(TProtoStringType* value) { } value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value) } 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 7f065c8bbd..7731c611d1 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 @@ -402,8 +402,8 @@ class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { // implements GeneratorContext -------------------------------------- io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) override; io::ZeroCopyOutputStream* OpenForAppend(const TProtoStringType& filename) override; - io::ZeroCopyOutputStream* OpenForInsert(const TProtoStringType& filename, - const TProtoStringType& insertion_point) override; + io::ZeroCopyOutputStream* OpenForInsert( + const TProtoStringType& filename, const TProtoStringType& insertion_point) override; io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( const TProtoStringType& filename, const TProtoStringType& insertion_point, const google::protobuf::GeneratedCodeInfo& info) override; @@ -2487,8 +2487,8 @@ bool CommandLineInterface::WriteDescriptorSet( to_output.insert(parsed_files.begin(), parsed_files.end()); for (int i = 0; i < parsed_files.size(); i++) { const FileDescriptor* file = parsed_files[i]; - for (int i = 0; i < file->dependency_count(); i++) { - const FileDescriptor* dependency = file->dependency(i); + for (int j = 0; j < file->dependency_count(); j++) { + const FileDescriptor* dependency = file->dependency(j); // if the dependency isn't in parsed files, mark it as already seen if (to_output.find(dependency) == to_output.end()) { already_seen.insert(dependency); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc index 263dff4079..4ecd6a9cf7 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc @@ -409,10 +409,10 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { TProtoStringType parent = ClassName(descriptor_->containing_type(), false); // Before C++17, we must define the static constants which were // declared in the header, to give the linker a place to put them. - // But pre-2015 MSVC++ insists that we not. + // But MSVC++ pre-2015 and post-2017 (version 15.5+) insists that we not. format( "#if (__cplusplus < 201703) && " - "(!defined(_MSC_VER) || _MSC_VER >= 1900)\n"); + "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n"); for (int i = 0; i < descriptor_->value_count(); i++) { format("constexpr $classname$ $1$::$2$;\n", parent, @@ -428,7 +428,7 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { format( "#endif // (__cplusplus < 201703) && " - "(!defined(_MSC_VER) || _MSC_VER >= 1900)\n"); + "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n"); } } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index ce2a0e4591..79fa488b5f 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -334,106 +334,6 @@ void RepeatedEnumFieldGenerator::GenerateConstructorCode( // Not needed for repeated fields. } -void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStream( - io::Printer* printer) const { - Formatter format(printer, variables_); - // Don't use ReadRepeatedPrimitive here so that the enum can be validated. - format( - "int value = 0;\n" - "DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n" - " input, &value)));\n"); - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format("add_$name$(static_cast< $type$ >(value));\n"); - } else { - format( - "if ($type$_IsValid(value)) {\n" - " add_$name$(static_cast< $type$ >(value));\n"); - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "} else {\n" - " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<$uint64$>(value));\n"); - } else { - format( - "} else {\n" - " unknown_fields_stream.WriteVarint32(tag);\n" - " unknown_fields_stream.WriteVarint32(\n" - " static_cast<$uint32$>(value));\n"); - } - format("}\n"); - } -} - -void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking( - io::Printer* printer) const { - Formatter format(printer, variables_); - if (!descriptor_->is_packed()) { - // This path is rarely executed, so we use a non-inlined implementation. - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format( - "DO_((::$proto_ns$::internal::" - "WireFormatLite::ReadPackedEnumPreserveUnknowns(\n" - " input,\n" - " $number$,\n" - " nullptr,\n" - " nullptr,\n" - " this->_internal_mutable_$name$())));\n"); - } else if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - "DO_((::$proto_ns$::internal::WireFormat::" - "ReadPackedEnumPreserveUnknowns(\n" - " input,\n" - " $number$,\n" - " $type$_IsValid,\n" - " mutable_unknown_fields(),\n" - " this->_internal_mutable_$name$())));\n"); - } else { - format( - "DO_((::$proto_ns$::internal::" - "WireFormatLite::ReadPackedEnumPreserveUnknowns(\n" - " input,\n" - " $number$,\n" - " $type$_IsValid,\n" - " &unknown_fields_stream,\n" - " this->_internal_mutable_$name$())));\n"); - } - } else { - format( - "$uint32$ length;\n" - "DO_(input->ReadVarint32(&length));\n" - "::$proto_ns$::io::CodedInputStream::Limit limit = " - "input->PushLimit(static_cast<int>(length));\n" - "while (input->BytesUntilLimit() > 0) {\n" - " int value = 0;\n" - " DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n" - " int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n" - " input, &value)));\n"); - if (HasPreservingUnknownEnumSemantics(descriptor_)) { - format(" add_$name$(static_cast< $type$ >(value));\n"); - } else { - format( - " if ($type$_IsValid(value)) {\n" - " _internal_add_$name$(static_cast< $type$ >(value));\n" - " } else {\n"); - if (UseUnknownFieldSet(descriptor_->file(), options_)) { - format( - " mutable_unknown_fields()->AddVarint(\n" - " $number$, static_cast<$uint64$>(value));\n"); - } else { - format( - " unknown_fields_stream.WriteVarint32(tag);\n" - " unknown_fields_stream.WriteVarint32(\n" - " static_cast<$uint32$>(value));\n"); - } - format(" }\n"); - } - format( - "}\n" - "input->PopLimit(limit);\n"); - } -} - void RepeatedEnumFieldGenerator::GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const { Formatter format(printer, variables_); 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 793ab2d793..e65ec0f5c0 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 @@ -98,8 +98,6 @@ class RepeatedEnumFieldGenerator : public FieldGenerator { 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 override; void GenerateByteSize(io::Printer* printer) const override; 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 23ab1bc0bb..72893b81c9 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 @@ -44,18 +44,6 @@ namespace protobuf { namespace compiler { namespace cpp { -namespace { - -// Returns the fully-qualified class name of the message that this field -// extends. This function is used in the Google-internal code to handle some -// legacy cases. -TProtoStringType ExtendeeClassName(const FieldDescriptor* descriptor) { - const Descriptor* extendee = descriptor->containing_type(); - return ClassName(extendee, true); -} - -} // anonymous namespace - ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer) @@ -88,7 +76,8 @@ ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor, break; } SetCommonVars(options, &variables_); - variables_["extendee"] = ExtendeeClassName(descriptor_); + variables_["extendee"] = + QualifiedClassName(descriptor_->containing_type(), options_); variables_["type_traits"] = type_traits_; TProtoStringType name = descriptor_->name(); variables_["name"] = ResolveKeyword(name); @@ -169,7 +158,7 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) { // Likewise, class members need to declare the field constant variable. if (IsScoped()) { format( - "#if !defined(_MSC_VER) || _MSC_VER >= 1900\n" + "#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)\n" "const int $scope$$constant_name$;\n" "#endif\n"); } 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 0a5d2cd772..5f167a4d01 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 @@ -340,7 +340,7 @@ FieldGenerator* FieldGeneratorMap::MakeGenerator( switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_MESSAGE: if (field->is_map()) { - return new MapFieldGenerator(field, options); + return new MapFieldGenerator(field, options, scc_analyzer); } else { return new RepeatedMessageFieldGenerator(field, options, scc_analyzer); 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 8d50f88f12..e3386f446a 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,6 +181,10 @@ class FieldGenerator { // are placed in the message's ByteSize() method. virtual void GenerateByteSize(io::Printer* printer) const = 0; + // Generates lines to call IsInitialized() for eligible message fields. Non + // message fields won't need to override this function. + virtual void GenerateIsInitialized(io::Printer* printer) const {} + virtual bool IsInlined() const { return false; } void SetHasBitIndex(arc_i32 has_bit_index); 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 6e3f174c5b..681e16a947 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 @@ -155,8 +155,8 @@ void FileGenerator::GenerateMacroUndefs(io::Printer* printer) { for (int i = 0; i < fields.size(); i++) { const TProtoStringType& name = fields[i]->name(); static const char* kMacroNames[] = {"major", "minor"}; - for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) { - if (name == kMacroNames[i]) { + for (int j = 0; j < GOOGLE_ARRAYSIZE(kMacroNames); ++j) { + if (name == kMacroNames[j]) { names_to_undef.push_back(name); break; } @@ -1211,7 +1211,8 @@ 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) { + if ((options_.force_inline_string || options_.profile_driven_inline_string) && + !options_.opensource_runtime) { IncludeFile("net/proto2/public/inlined_string_field.h", printer); } if (HasSimpleBaseClasses(file_, options_)) { 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 c5aa700c24..5191a7e730 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 @@ -58,6 +58,7 @@ #include <google/protobuf/stubs/substitute.h> #include <google/protobuf/stubs/hash.h> +// Must be last. #include <google/protobuf/port_def.inc> namespace google { @@ -174,11 +175,7 @@ static std::unordered_set<TProtoStringType>* MakeKeywordsMap() { static std::unordered_set<TProtoStringType>& kKeywords = *MakeKeywordsMap(); TProtoStringType IntTypeName(const Options& options, const TProtoStringType& type) { - if (options.opensource_runtime) { - return "::PROTOBUF_NAMESPACE_ID::" + type; - } else { - return "::" + type; - } + return "::NProtoBuf::" + type; } void SetIntVar(const Options& options, const TProtoStringType& type, @@ -460,6 +457,19 @@ TProtoStringType FieldName(const FieldDescriptor* field) { return result; } +TProtoStringType OneofCaseConstantName(const FieldDescriptor* field) { + GOOGLE_DCHECK(field->containing_oneof()); + TProtoStringType field_name = UnderscoresToCamelCase(field->name(), true); + return "k" + field_name; +} + +TProtoStringType QualifiedOneofCaseConstantName(const FieldDescriptor* field) { + GOOGLE_DCHECK(field->containing_oneof()); + const TProtoStringType qualification = + QualifiedClassName(field->containing_type()); + return StrCat(qualification, "::", OneofCaseConstantName(field)); +} + TProtoStringType EnumValueName(const EnumValueDescriptor* enum_value) { TProtoStringType result = enum_value->name(); if (kKeywords.count(result) > 0) { @@ -526,13 +536,13 @@ TProtoStringType StripProto(const TProtoStringType& filename) { const char* PrimitiveTypeName(FieldDescriptor::CppType type) { switch (type) { case FieldDescriptor::CPPTYPE_INT32: - return "::google::protobuf::int32"; + return "arc_i32"; case FieldDescriptor::CPPTYPE_INT64: - return "::google::protobuf::int64"; + return "arc_i64"; case FieldDescriptor::CPPTYPE_UINT32: - return "::google::protobuf::uint32"; + return "arc_ui32"; case FieldDescriptor::CPPTYPE_UINT64: - return "::google::protobuf::uint64"; + return "arc_ui64"; case FieldDescriptor::CPPTYPE_DOUBLE: return "double"; case FieldDescriptor::CPPTYPE_FLOAT: @@ -781,8 +791,10 @@ TProtoStringType SafeFunctionName(const Descriptor* descriptor, return function_name; } -bool IsStringInlined(const FieldDescriptor* /* descriptor */, - const Options& /* options */) { +bool IsStringInlined(const FieldDescriptor* descriptor, + const Options& options) { + (void)descriptor; + (void)options; return false; } @@ -943,15 +955,19 @@ bool HasEnumDefinitions(const FileDescriptor* file) { return false; } -bool ShouldVerify(const Descriptor* /* descriptor */, - const Options& /* options */, - MessageSCCAnalyzer* /* scc_analyzer */) { +bool ShouldVerify(const Descriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + (void)descriptor; + (void)options; + (void)scc_analyzer; return false; } -bool ShouldVerify(const FileDescriptor* /* file */, - const Options& /* options */, - MessageSCCAnalyzer* /* scc_analyzer */) { +bool ShouldVerify(const FileDescriptor* file, const Options& options, + MessageSCCAnalyzer* scc_analyzer) { + (void)file; + (void)options; + (void)scc_analyzer; return false; } @@ -1156,8 +1172,8 @@ MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) { if (descriptor->extension_range_count() > 0) { result.contains_extension = true; } - for (int i = 0; i < descriptor->field_count(); i++) { - const FieldDescriptor* field = descriptor->field(i); + for (int j = 0; j < descriptor->field_count(); j++) { + const FieldDescriptor* field = descriptor->field(j); if (field->is_required()) { result.contains_required = true; } @@ -1474,7 +1490,8 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file, return FileOptions::SPEED; } -bool EnableMessageOwnedArena(const Descriptor* /* desc */) { +bool EnableMessageOwnedArena(const Descriptor* desc) { + (void)desc; return false; } 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 8923903452..12c8cdbde1 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 @@ -63,8 +63,8 @@ inline TProtoStringType ProtobufNamespace(const Options& /* options */) { return "PROTOBUF_NAMESPACE_ID"; } -inline TProtoStringType MacroPrefix(const Options& options) { - return options.opensource_runtime ? "GOOGLE_PROTOBUF" : "GOOGLE_PROTOBUF"; +inline TProtoStringType MacroPrefix(const Options& /* options */) { + return "GOOGLE_PROTOBUF"; } inline TProtoStringType DeprecatedAttribute(const Options& /* options */, @@ -743,6 +743,27 @@ class PROTOC_EXPORT Formatter { void Outdent() const { printer_->Outdent(); } io::Printer* printer() const { return printer_; } + class PROTOC_EXPORT ScopedIndenter { + public: + explicit ScopedIndenter(Formatter* format) : format_(format) { + format_->Indent(); + } + ~ScopedIndenter() { format_->Outdent(); } + + private: + Formatter* format_; + }; + + PROTOBUF_NODISCARD ScopedIndenter ScopedIndent() { + return ScopedIndenter(this); + } + template <typename... Args> + PROTOBUF_NODISCARD ScopedIndenter ScopedIndent(const char* format, + const Args&&... args) { + (*this)(format, static_cast<Args&&>(args)...); + return ScopedIndenter(this); + } + class PROTOC_EXPORT SaveState { public: explicit SaveState(Formatter* format) diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.cc index f8e1c380cc..c5028fdb1d 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.cc @@ -84,8 +84,11 @@ void SetMessageVariables(const FieldDescriptor* descriptor, } MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor, - const Options& options) - : FieldGenerator(descriptor, options) { + const Options& options, + MessageSCCAnalyzer* scc_analyzer) + : FieldGenerator(descriptor, options), + has_required_fields_( + scc_analyzer->HasRequiredFields(descriptor->message_type())) { SetMessageVariables(descriptor, &variables_, options); } @@ -293,6 +296,15 @@ void MapFieldGenerator::GenerateByteSize(io::Printer* printer) const { "}\n"); } +void MapFieldGenerator::GenerateIsInitialized(io::Printer* printer) const { + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + format( + "if (!::$proto_ns$::internal::AllAreInitialized($name$_)) return " + "false;\n"); +} + void MapFieldGenerator::GenerateConstinitInitializer( io::Printer* printer) const { Formatter format(printer, variables_); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.h index 5ea04290e6..c01ae498b1 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_map_field.h @@ -34,6 +34,7 @@ #include <map> #include <string> +#include <google/protobuf/compiler/cpp/cpp_helpers.h> #include <google/protobuf/compiler/cpp/cpp_message_field.h> namespace google { @@ -43,8 +44,9 @@ namespace cpp { class MapFieldGenerator : public FieldGenerator { public: - MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options); - ~MapFieldGenerator(); + MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options, + MessageSCCAnalyzer* scc_analyzer); + ~MapFieldGenerator() override; // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const override; @@ -58,10 +60,13 @@ class MapFieldGenerator : public FieldGenerator { void GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const override; void GenerateByteSize(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; void GenerateConstinitInitializer(io::Printer* printer) const override; bool GenerateArenaDestructorCode(io::Printer* printer) const override; private: + const bool has_required_fields_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); }; 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 062b2bb754..4b5e0f2e95 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 @@ -230,12 +230,22 @@ bool EmitFieldNonDefaultCondition(io::Printer* printer, } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { // Message fields still have has_$name$() methods. format("if ($prefix$_internal_has_$name$()) {\n"); - } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_DOUBLE || - field->cpp_type() == FieldDescriptor::CPPTYPE_FLOAT) { - // Handle float comparison to prevent -Wfloat-equal warnings + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_FLOAT) { format( - "if (!($prefix$_internal_$name$() <= 0 && $prefix$_internal_$name$() " - ">= 0)) {\n"); + "static_assert(sizeof(arc_ui32) == sizeof(float), \"Code assumes " + "arc_ui32 and float are the same size.\");\n" + "float tmp_$name$ = $prefix$_internal_$name$();\n" + "arc_ui32 raw_$name$;\n" + "memcpy(&raw_$name$, &tmp_$name$, sizeof(tmp_$name$));\n" + "if (raw_$name$ != 0) {\n"); + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_DOUBLE) { + format( + "static_assert(sizeof(arc_ui64) == sizeof(double), \"Code assumes " + "arc_ui64 and double are the same size.\");\n" + "double tmp_$name$ = $prefix$_internal_$name$();\n" + "arc_ui64 raw_$name$;\n" + "memcpy(&raw_$name$, &tmp_$name$, sizeof(tmp_$name$));\n" + "if (raw_$name$ != 0) {\n"); } else { format("if ($prefix$_internal_$name$() != 0) {\n"); } @@ -974,7 +984,7 @@ $annotate_extension_set$ template <typename _proto_TypeTraits, ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, bool _is_packed> -inline PROTOBUF_MUST_USE_RESULT +PROTOBUF_NODISCARD inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< @@ -1437,7 +1447,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { if (EnableMessageOwnedArena(descriptor_)) { format( "inline $classname$() : $classname$(" - "new ::$proto_ns$::Arena(), true) {}\n"); + "::$proto_ns$::Arena::InternalHelper<$classname$>::\n" + " CreateMessageOwnedArena(), true) {}\n"); } else { format("inline $classname$() : $classname$(nullptr) {}\n"); } @@ -1530,10 +1541,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { format("enum $1$Case {\n", UnderscoresToCamelCase(oneof->name(), true)); format.Indent(); for (auto field : FieldRange(oneof)) { - TProtoStringType oneof_enum_case_field_name = - UnderscoresToCamelCase(field->name(), true); - format("k$1$ = $2$,\n", oneof_enum_case_field_name, // 1 - field->number()); // 2 + format("$1$ = $2$,\n", OneofCaseConstantName(field), // 1 + field->number()); // 2 } format("$1$_NOT_SET = 0,\n", ToUpper(oneof->name())); format.Outdent(); @@ -1565,7 +1574,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "bool PackFrom(const ::$proto_ns$::Message& message,\n" " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " "type_url_prefix) {\n" - " return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);\n" + " return _any_metadata_.PackFrom(GetArena(), message, " + "type_url_prefix);\n" "}\n" "bool UnpackTo(::$proto_ns$::Message* message) const {\n" " return _any_metadata_.UnpackTo(message);\n" @@ -1586,7 +1596,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "bool PackFrom(const T& message,\n" " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " "type_url_prefix) {\n" - " return _any_metadata_.PackFrom<T>(GetArena(), message, type_url_prefix);" + " return _any_metadata_.PackFrom<T>(GetArena(), message, " + "type_url_prefix);" "}\n" "template <typename T, class = typename std::enable_if<" "!std::is_convertible<T, const ::$proto_ns$::Message&>" @@ -1598,13 +1609,14 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { format( "template <typename T>\n" "bool PackFrom(const T& message) {\n" - " return _any_metadata_.PackFrom(message);\n" + " return _any_metadata_.PackFrom(GetArena(), message);\n" "}\n" "template <typename T>\n" "bool PackFrom(const T& message,\n" " ::PROTOBUF_NAMESPACE_ID::ConstStringParam " "type_url_prefix) {\n" - " return _any_metadata_.PackFrom(message, type_url_prefix);\n" + " return _any_metadata_.PackFrom(GetArena(), message, " + "type_url_prefix);\n" "}\n" "template <typename T>\n" "bool UnpackTo(T* message) const {\n" @@ -1626,12 +1638,12 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "}\n" "inline void Swap($classname$* other) {\n" " if (other == this) return;\n" -#ifdef PROTOBUF_FORCE_COPY_IN_SWAP + "#ifdef PROTOBUF_FORCE_COPY_IN_SWAP\n" " if (GetOwningArena() != nullptr &&\n" - " GetOwningArena() == other->GetOwningArena()) {\n" -#else // PROTOBUF_FORCE_COPY_IN_SWAP + " GetOwningArena() == other->GetOwningArena()) {\n " + "#else // PROTOBUF_FORCE_COPY_IN_SWAP\n" " if (GetOwningArena() == other->GetOwningArena()) {\n" -#endif // !PROTOBUF_FORCE_COPY_IN_SWAP + "#endif // !PROTOBUF_FORCE_COPY_IN_SWAP\n" " InternalSwap(other);\n" " } else {\n" " ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);\n" @@ -1647,11 +1659,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "\n" "// implements Message ----------------------------------------------\n" "\n" - "inline $classname$* New() const final {\n" - " return new $classname$();\n" - "}\n" - "\n" - "$classname$* New(::$proto_ns$::Arena* arena) const final {\n" + "$classname$* New(::$proto_ns$::Arena* arena = nullptr) const final {\n" " return CreateMaybeMessage<$classname$>(arena);\n" "}\n"); @@ -1714,12 +1722,6 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { "$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"); - } } } @@ -1740,6 +1742,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) { format( // Friend AnyMetadata so that it can call this FullMessageName() method. + "\nprivate:\n" "friend class ::$proto_ns$::internal::AnyMetadata;\n" "static $1$ FullMessageName() {\n" " return \"$full_name$\";\n" @@ -2744,19 +2747,22 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets( // 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. + // offset of the field, so that the information is available when + // reflectively 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"); + format(" | 0x80000000u // unused\n"); + } + + // Embed whether the field is eagerly verified lazy or inlined string to the + // LSB of the offset. + if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) { + format(" | 0x1u // eagerly verified lazy\n"); } else if (IsStringInlined(field, options_)) { - format(" | 0x1u, // inlined\n"); - } else { - format(",\n"); + format(" | 0x1u // inlined\n"); } + format(",\n"); } int count = 0; @@ -2796,7 +2802,7 @@ void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) { if (HasSimpleBaseClass(descriptor_, options_)) return; Formatter format(printer, variables_); - format("void $classname$::SharedCtor() {\n"); + format("inline void $classname$::SharedCtor() {\n"); std::vector<bool> processed(optimized_order_.size(), false); GenerateConstructorBody(printer, processed, false); @@ -3119,7 +3125,9 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) { "metadata_);\n"); if (descriptor_->extension_range_count() > 0) { - format("_extensions_.MergeFrom(from._extensions_);\n"); + format( + "_extensions_.MergeFrom(internal_default_instance(), " + "from._extensions_);\n"); } GenerateConstructorBody(printer, processed, true); @@ -3714,7 +3722,9 @@ void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) { // Merging of extensions and unknown fields is done last, to maximize // the opportunity for tail calls. if (descriptor_->extension_range_count() > 0) { - format("_extensions_.MergeFrom(from._extensions_);\n"); + format( + "_extensions_.MergeFrom(internal_default_instance(), " + "from._extensions_);\n"); } format( @@ -4516,42 +4526,7 @@ void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { // Now check that all non-oneof embedded messages are initialized. for (auto field : optimized_order_) { - // TODO(ckennelly): Push this down into a generator? - if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !ShouldIgnoreRequiredFieldCheck(field, options_) && - scc_analyzer_->HasRequiredFields(field->message_type())) { - if (field->is_repeated()) { - if (IsImplicitWeakField(field, options_, scc_analyzer_)) { - format( - "if " - "(!::$proto_ns$::internal::AllAreInitializedWeak($1$_.weak)" - ")" - " return false;\n", - FieldName(field)); - } else { - format( - "if (!::$proto_ns$::internal::AllAreInitialized($1$_))" - " return false;\n", - FieldName(field)); - } - } else if (field->options().weak()) { - continue; - } else if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) { - GOOGLE_CHECK(!field->real_containing_oneof()); - format( - "if (_internal_has_$1$()) {\n" - " if (!$1$().IsInitialized()) return false;\n" - "}\n", - FieldName(field)); - } else { - GOOGLE_CHECK(!field->real_containing_oneof()); - format( - "if (_internal_has_$1$()) {\n" - " if (!$1$_->IsInitialized()) return false;\n" - "}\n", - FieldName(field)); - } - } + field_generators_.get(field).GenerateIsInitialized(printer); } if (num_weak_fields_) { // For Weak fields. @@ -4579,23 +4554,9 @@ void MessageGenerator::GenerateIsInitialized(io::Printer* printer) { for (auto field : FieldRange(oneof)) { format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true)); format.Indent(); - - if (!IsFieldStripped(field, options_) && - field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - !ShouldIgnoreRequiredFieldCheck(field, options_) && - scc_analyzer_->HasRequiredFields(field->message_type())) { - GOOGLE_CHECK(!(field->options().weak() || !field->real_containing_oneof())); - if (field->options().weak()) { - // Just skip. - } else { - format( - "if (has_$1$()) {\n" - " if (!this->$1$().IsInitialized()) return false;\n" - "}\n", - FieldName(field)); - } + if (!IsFieldStripped(field, options_)) { + field_generators_.get(field).GenerateIsInitialized(printer); } - format("break;\n"); format.Outdent(); format("}\n"); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.cc index 720ce273bd..04f45492c3 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -87,7 +87,9 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, MessageSCCAnalyzer* scc_analyzer) : FieldGenerator(descriptor, options), implicit_weak_field_( - IsImplicitWeakField(descriptor, options, scc_analyzer)) { + IsImplicitWeakField(descriptor, options, scc_analyzer)), + has_required_fields_( + scc_analyzer->HasRequiredFields(descriptor->message_type())) { SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_); } @@ -109,7 +111,7 @@ void MessageFieldGenerator::GenerateAccessorDeclarations( format( "$deprecated_attr$const $type$& ${1$$name$$}$() const { " "__builtin_trap(); }\n" - "PROTOBUF_MUST_USE_RESULT $deprecated_attr$$type$* " + "PROTOBUF_NODISCARD $deprecated_attr$$type$* " "${1$$release_name$$}$() { " "__builtin_trap(); }\n" "$deprecated_attr$$type$* ${1$mutable_$name$$}$() { " @@ -126,7 +128,7 @@ void MessageFieldGenerator::GenerateAccessorDeclarations( } format( "$deprecated_attr$const $type$& ${1$$name$$}$() const;\n" - "PROTOBUF_MUST_USE_RESULT $deprecated_attr$$type$* " + "PROTOBUF_NODISCARD $deprecated_attr$$type$* " "${1$$release_name$$}$();\n" "$deprecated_attr$$type$* ${1$mutable_$name$$}$();\n" "$deprecated_attr$void ${1$set_allocated_$name$$}$" @@ -480,6 +482,18 @@ void MessageFieldGenerator::GenerateByteSize(io::Printer* printer) const { " *$field_member$);\n"); } +void MessageFieldGenerator::GenerateIsInitialized(io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + format( + "if (_internal_has_$name$()) {\n" + " if (!$name$_->IsInitialized()) return false;\n" + "}\n"); +} + void MessageFieldGenerator::GenerateConstinitInitializer( io::Printer* printer) const { Formatter format(printer, variables_); @@ -641,6 +655,17 @@ void MessageOneofFieldGenerator::GenerateConstructorCode( // space only when this field is used. } +void MessageOneofFieldGenerator::GenerateIsInitialized( + io::Printer* printer) const { + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + format( + "if (_internal_has_$name$()) {\n" + " if (!$field_member$->IsInitialized()) return false;\n" + "}\n"); +} + // =================================================================== RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( @@ -648,7 +673,9 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( MessageSCCAnalyzer* scc_analyzer) : FieldGenerator(descriptor, options), implicit_weak_field_( - IsImplicitWeakField(descriptor, options, scc_analyzer)) { + IsImplicitWeakField(descriptor, options, scc_analyzer)), + has_required_fields_( + scc_analyzer->HasRequiredFields(descriptor->message_type())) { SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_); } @@ -835,6 +862,24 @@ void RepeatedMessageFieldGenerator::GenerateByteSize( "}\n"); } +void RepeatedMessageFieldGenerator::GenerateIsInitialized( + io::Printer* printer) const { + GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_)); + + if (!has_required_fields_) return; + + Formatter format(printer, variables_); + if (implicit_weak_field_) { + format( + "if (!::$proto_ns$::internal::AllAreInitializedWeak($name$_.weak))\n" + " return false;\n"); + } else { + format( + "if (!::$proto_ns$::internal::AllAreInitialized($name$_))\n" + " return false;\n"); + } +} + void RepeatedMessageFieldGenerator::GenerateConstinitInitializer( io::Printer* printer) const { Formatter format(printer, variables_); 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 712ddbfea1..2beac6253b 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 @@ -50,7 +50,7 @@ class MessageFieldGenerator : public FieldGenerator { MessageFieldGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer); - ~MessageFieldGenerator(); + ~MessageFieldGenerator() override; // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const override; @@ -71,10 +71,12 @@ class MessageFieldGenerator : public FieldGenerator { void GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const override; void GenerateByteSize(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; void GenerateConstinitInitializer(io::Printer* printer) const override; protected: const bool implicit_weak_field_; + const bool has_required_fields_; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); @@ -85,7 +87,7 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { MessageOneofFieldGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer); - ~MessageOneofFieldGenerator(); + ~MessageOneofFieldGenerator() override; // implements FieldGenerator --------------------------------------- void GenerateInlineAccessorDefinitions(io::Printer* printer) const override; @@ -99,6 +101,7 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator { void GenerateSwappingCode(io::Printer* printer) const override; void GenerateDestructorCode(io::Printer* printer) const override; void GenerateConstructorCode(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator); @@ -109,7 +112,7 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, const Options& options, MessageSCCAnalyzer* scc_analyzer); - ~RepeatedMessageFieldGenerator(); + ~RepeatedMessageFieldGenerator() override; // implements FieldGenerator --------------------------------------- void GeneratePrivateMembers(io::Printer* printer) const override; @@ -123,10 +126,12 @@ class RepeatedMessageFieldGenerator : public FieldGenerator { void GenerateSerializeWithCachedSizesToArray( io::Printer* printer) const override; void GenerateByteSize(io::Printer* printer) const override; + void GenerateIsInitialized(io::Printer* printer) const override; void GenerateConstinitInitializer(io::Printer* printer) const override; private: const bool implicit_weak_field_; + const bool has_required_fields_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); }; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_names.h b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_names.h index 877908f7ad..8b745ff21c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_names.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_names.h @@ -73,6 +73,12 @@ TProtoStringType QualifiedExtensionName(const FieldDescriptor* d); // anyway, so normally this just returns field->name(). TProtoStringType FieldName(const FieldDescriptor* field); +// Requires that this field is in a oneof. Returns the (unqualified) case +// constant for this field. +TProtoStringType OneofCaseConstantName(const FieldDescriptor* field); +// Returns the quafilied case constant for this field. +TProtoStringType QualifiedOneofCaseConstantName(const FieldDescriptor* field); + // Get the (unqualified) name that should be used for this enum value in C++ // code. TProtoStringType EnumValueName(const EnumValueDescriptor* enum_value); 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 bc174c3d6e..23adb91430 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 @@ -71,7 +71,7 @@ struct Options { bool opensource_runtime = false; bool annotate_accessor = false; bool unused_field_stripping = false; - bool profile_driven_inline_string = false; + bool profile_driven_inline_string = true; bool force_inline_string = false; TProtoStringType runtime_include_base; int num_cc_files = 0; 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 ac3e57cda8..282d70e391 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 @@ -81,9 +81,9 @@ const char* TagType(const FieldDescriptor* field) { return CodedTagType(TagSize(field->number())); } -TProtoStringType TcParserBaseName(const Options& options) { +TProtoStringType TcParserName(const Options& options) { return StrCat("::", ProtobufNamespace(options), - "::internal::TcParserBase::"); + "::internal::TcParser::"); } TProtoStringType MessageTcParseFunctionName(const FieldDescriptor* field, @@ -93,8 +93,8 @@ TProtoStringType MessageTcParseFunctionName(const FieldDescriptor* field, // 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), + // done by helpers in TcParser. + return StrCat(TcParserName(options), (field->is_repeated() ? "Repeated" : "Singular"), "ParseMessage<", QualifiedClassName(field->message_type()), // @@ -108,8 +108,7 @@ TProtoStringType MessageTcParseFunctionName(const FieldDescriptor* field, } TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, - const Options& options, - arc_ui32 table_size_log2); + const Options& options); } // namespace @@ -209,14 +208,14 @@ TailCallTableInfo::TailCallTableInfo(const Descriptor* descriptor, case FieldDescriptor::TYPE_SINT64: case FieldDescriptor::TYPE_SINT32: case FieldDescriptor::TYPE_BOOL: - name = FieldParseFunctionName(field, options, table_size_log2); + name = FieldParseFunctionName(field, options); break; case FieldDescriptor::TYPE_BYTES: if (field->options().ctype() == FieldOptions::STRING && field->default_value_string().empty() && !IsStringInlined(field, options)) { - name = FieldParseFunctionName(field, options, table_size_log2); + name = FieldParseFunctionName(field, options); } break; @@ -365,9 +364,8 @@ void ParseFunctionGenerator::GenerateTailcallParseFunction(Formatter& format) { "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); + " ptr = ::$proto_ns$::internal::TcParser::ParseLoop(\n" + " this, ptr, ctx, &_table_.header);\n"); format( " return ptr;\n" "}\n\n"); @@ -426,9 +424,9 @@ void ParseFunctionGenerator::GenerateTailcallFieldParseFunctions( "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n" " ptr += $1$;\n" " hasbits |= (arc_ui64{1} << data.hasbit_idx());\n" - " ::$proto_ns$::internal::TcParserBase::SyncHasbits" + " ::$proto_ns$::internal::TcParser::SyncHasbits" "(msg, hasbits, table);\n" - " auto& field = ::$proto_ns$::internal::TcParserBase::" + " auto& field = ::$proto_ns$::internal::TcParser::" "RefAt<$classtype$*>(msg, data.offset());\n" " if (field == nullptr)\n" " field = CreateMaybeMessage<$classtype$>(ctx->data().arena);\n" @@ -448,9 +446,9 @@ void ParseFunctionGenerator::GenerateTailcallFieldParseFunctions( "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n" " }\n" " ptr += $1$;\n" - " auto& field = ::$proto_ns$::internal::TcParserBase::RefAt<" + " auto& field = ::$proto_ns$::internal::TcParser::RefAt<" "::$proto_ns$::RepeatedPtrField<$classname$>>(msg, data.offset());\n" - " ::$proto_ns$::internal::TcParserBase::SyncHasbits" + " ::$proto_ns$::internal::TcParser::SyncHasbits" "(msg, hasbits, table);\n" " ptr = ctx->ParseMessage(field.Add(), ptr);\n" " return ptr;\n" @@ -471,7 +469,7 @@ void ParseFunctionGenerator::GenerateDataDecls(io::Printer* printer) { format.Indent(); } format( - "static const ::$proto_ns$::internal::TailCallParseTable<$1$>\n" + "static const ::$proto_ns$::internal::TcParseTable<$1$>\n" " _table_;\n", tc_table_info_->table_size_log2); if (should_generate_guarded_tctable()) { @@ -546,7 +544,7 @@ void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) { if (tc_table_info_->use_generated_fallback) { fallback = ClassName(descriptor_) + "::Tct_ParseFallback"; } else { - fallback = TcParserBaseName(options_) + "GenericFallback"; + fallback = TcParserName(options_) + "GenericFallback"; if (GetOptimizeFor(descriptor_->file(), options_) == FileOptions::LITE_RUNTIME) { fallback += "Lite"; @@ -561,33 +559,48 @@ void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) { // the table is sufficient we can use a generic routine, that just handles // unknown fields and potentially an extension range. format( - "const ::$proto_ns$::internal::TailCallParseTable<$1$>\n" + "const ::$proto_ns$::internal::TcParseTable<$1$>\n" " $classname$::_table_ = {\n", tc_table_info_->table_size_log2); - format.Indent(); - format("{\n"); - format.Indent(); - if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { - format("PROTOBUF_FIELD_OFFSET($classname$, _has_bits_),\n"); - } else { - format("0, // no _has_bits_\n"); - } - if (descriptor_->extension_range_count() == 1) { - format( - "PROTOBUF_FIELD_OFFSET($classname$, _extensions_),\n" - "$1$, $2$, // extension_range_{low,high}\n", - descriptor_->extension_range(0)->start, - descriptor_->extension_range(0)->end); - } else { - format("0, 0, 0, // no _extensions_\n"); + { + auto table_scope = format.ScopedIndent(); + format("{\n"); + { + auto header_scope = format.ScopedIndent(); + if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) { + format("PROTOBUF_FIELD_OFFSET($classname$, _has_bits_),\n"); + } else { + format("0, // no _has_bits_\n"); + } + if (descriptor_->extension_range_count() == 1) { + format( + "PROTOBUF_FIELD_OFFSET($classname$, _extensions_),\n" + "$1$, $2$, // extension_range_{low,high}\n", + descriptor_->extension_range(0)->start, + descriptor_->extension_range(0)->end); + } else { + format("0, 0, 0, // no _extensions_\n"); + } + format( + "$1$, 0, $2$, // fast_idx_mask, reserved, num_fields\n" + "&$3$._instance,\n" + "$4$ // fallback\n", + (((1 << tc_table_info_->table_size_log2) - 1) << 3), + descriptor_->field_count(), + DefaultInstanceName(descriptor_, options_), fallback); + } + format("}, {\n"); + { + auto fast_scope = format.ScopedIndent(); + GenerateFastFieldEntries(format, fallback); + } + format("},\n"); // entries[] } - format( - "&$1$._instance,\n" - "$2$ // fallback\n", - DefaultInstanceName(descriptor_, options_), fallback); - format.Outdent(); - format("}, {\n"); - format.Indent(); + format("};\n\n"); // _table_ +} + +void ParseFunctionGenerator::GenerateFastFieldEntries( + Formatter& format, const TProtoStringType& fallback) { for (const auto& info : tc_table_info_->fast_path_fields) { if (info.field != nullptr) { PrintFieldComment(format, info.field); @@ -604,10 +617,6 @@ void ParseFunctionGenerator::GenerateTailCallTable(Formatter& format) { } format("},\n"); } - format.Outdent(); - format("},\n"); // entries[] - format.Outdent(); - format("};\n\n"); // _table_ } void ParseFunctionGenerator::GenerateArenaString(Formatter& format, @@ -634,6 +643,8 @@ void ParseFunctionGenerator::GenerateArenaString(Formatter& format, ", ~0x$2$u", inlined_string_index / 32, strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8)); + } else { + GOOGLE_DCHECK(field->default_value_string().empty()); } format( ");\n" @@ -766,15 +777,22 @@ void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format, "$msg$GetArenaForAllocation());\n" " $msg$set_has_$name$();\n" "}\n" - "ptr = ctx->ParseMessage($msg$$1$_.$name$_, ptr);\n", + "auto* lazy_field = $msg$$1$_.$name$_;\n", field->containing_oneof()->name()); } else if (HasHasbit(field)) { format( "_Internal::set_has_$name$(&$has_bits$);\n" - "ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n"); + "auto* lazy_field = &$msg$$name$_;\n"); } else { - format("ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n"); + format("auto* lazy_field = &$msg$$name$_;\n"); } + format( + "::$proto_ns$::internal::LazyFieldParseHelper<\n" + " ::$proto_ns$::internal::LazyField> parse_helper(\n" + " $1$::default_instance(),\n" + " $msg$GetArenaForAllocation(), lazy_field);\n" + "ptr = ctx->ParseMessage(&parse_helper, ptr);\n", + FieldMessageTypeName(field, options_)); } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) { if (!field->is_repeated()) { format( @@ -859,7 +877,8 @@ void ParseFunctionGenerator::GenerateFieldBody( field->number()); } } else { - TProtoStringType size = (field->type() == FieldDescriptor::TYPE_SINT32 || + TProtoStringType size = (field->type() == FieldDescriptor::TYPE_INT32 || + field->type() == FieldDescriptor::TYPE_SINT32 || field->type() == FieldDescriptor::TYPE_UINT32) ? "32" : "64"; @@ -1086,8 +1105,7 @@ void ParseFunctionGenerator::GenerateFieldSwitch( namespace { TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, - const Options& options, - arc_ui32 table_size_log2) { + const Options& options) { ParseCardinality card = // field->is_packed() ? ParseCardinality::kPacked : field->is_repeated() ? ParseCardinality::kRepeated @@ -1146,9 +1164,8 @@ TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, type_format = TypeFormat::kStringValidateOnly; break; default: - GOOGLE_LOG(DFATAL) - << "Mode not handled: " - << static_cast<int>(GetUtf8CheckMode(field, options)); + GOOGLE_LOG(DFATAL) << "Mode not handled: " + << static_cast<int>(GetUtf8CheckMode(field, options)); return ""; } break; @@ -1158,8 +1175,8 @@ TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, return ""; } - return "::" + ProtobufNamespace(options) + "::internal::" + - GetTailCallFieldHandlerName(card, type_format, table_size_log2, + return "::" + ProtobufNamespace(options) + "::internal::TcParser::" + + GetTailCallFieldHandlerName(card, type_format, TagSize(field->number()), options); } @@ -1167,32 +1184,10 @@ TProtoStringType FieldParseFunctionName(const FieldDescriptor* field, TProtoStringType GetTailCallFieldHandlerName(ParseCardinality card, TypeFormat type_format, - int table_size_log2, int tag_length_bytes, const Options& options) { TProtoStringType name; - switch (card) { - case ParseCardinality::kPacked: - case ParseCardinality::kRepeated: - name = "TcParserBase::"; - break; - - case ParseCardinality::kSingular: - case ParseCardinality::kOneof: - switch (type_format) { - case TypeFormat::kBytes: - case TypeFormat::kString: - case TypeFormat::kStringValidateOnly: - name = "TcParserBase::"; - break; - - default: - name = StrCat("TcParser<", table_size_log2, ">::"); - break; - } - } - // The field implementation functions are prefixed by cardinality: // `Singular` for optional or implicit fields. // `Repeated` for non-packed repeated. @@ -1274,26 +1269,24 @@ TProtoStringType GetTailCallFieldHandlerName(ParseCardinality card, case TypeFormat::kVar64: case TypeFormat::kVar32: case TypeFormat::kBool: - name.append( - StrCat(", ", TcParserBaseName(options), "kNoConversion")); + StrAppend(&name, ", ", TcParserName(options), "kNoConversion"); break; case TypeFormat::kSInt64: case TypeFormat::kSInt32: - name.append(StrCat(", ", TcParserBaseName(options), "kZigZag")); + StrAppend(&name, ", ", TcParserName(options), "kZigZag"); break; case TypeFormat::kBytes: - name.append(StrCat(", ", TcParserBaseName(options), "kNoUtf8")); + StrAppend(&name, ", ", TcParserName(options), "kNoUtf8"); break; case TypeFormat::kString: - name.append(StrCat(", ", TcParserBaseName(options), "kUtf8")); + StrAppend(&name, ", ", TcParserName(options), "kUtf8"); break; case TypeFormat::kStringValidateOnly: - name.append( - StrCat(", ", TcParserBaseName(options), "kUtf8ValidateOnly")); + StrAppend(&name, ", ", TcParserName(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 820f7b3089..0246079146 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 @@ -118,6 +118,7 @@ class ParseFunctionGenerator { // Generates the tail-call table definition. void GenerateTailCallTable(Formatter& format); + void GenerateFastFieldEntries(Formatter& format, const TProtoStringType& fallback); // Generates parsing code for an `ArenaString` field. void GenerateArenaString(Formatter& format, const FieldDescriptor* field); @@ -187,7 +188,6 @@ enum class TypeFormat { // parse_function_inc_generator_main. TProtoStringType GetTailCallFieldHandlerName(ParseCardinality card, TypeFormat type_format, - int table_size_log2, int tag_length_bytes, const Options& options); 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 ce0f97d930..ff7c208ff2 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 @@ -59,7 +59,8 @@ class PrimitiveFieldGenerator : public FieldGenerator { 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 GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; void GenerateByteSize(io::Printer* printer) const override; void GenerateConstinitInitializer(io::Printer* printer) const override; @@ -98,7 +99,8 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator { 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 GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; void GenerateByteSize(io::Printer* printer) const override; void GenerateConstinitInitializer(io::Printer* printer) const override; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_service.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_service.cc index 0a30646fd0..944b41ba90 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_service.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_service.cc @@ -241,12 +241,12 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) { for (int i = 0; i < descriptor_->method_count(); i++) { const MethodDescriptor* method = descriptor_->method(i); - Formatter format(printer, vars_); - InitMethodVariables(method, options_, &format); + Formatter format_method(printer, vars_); + InitMethodVariables(method, options_, &format_method); // Note: down_cast does not work here because it only works on pointers, // not references. - format( + format_method( " case $1$:\n" " $name$(controller,\n" " ::$proto_ns$::internal::DownCast<const $input_type$*>(\n" 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 0adde4e777..c736ce9527 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 @@ -170,7 +170,7 @@ void StringFieldGenerator::GenerateAccessorDeclarations( descriptor_); format( "$deprecated_attr$TProtoStringType* ${1$mutable_$name$$}$();\n" - "PROTOBUF_MUST_USE_RESULT $deprecated_attr$TProtoStringType* " + "PROTOBUF_NODISCARD $deprecated_attr$TProtoStringType* " "${1$$release_name$$}$();\n" "$deprecated_attr$void ${1$set_allocated_$name$$}$(TProtoStringType* " "$name$);\n", @@ -290,8 +290,17 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions( " $clear_hasbit$\n"); if (!inlined_) { format( - " return $name$_.ReleaseNonDefault($init_value$, " + " auto* p = $name$_.ReleaseNonDefault($init_value$, " "GetArenaForAllocation());\n"); + if (descriptor_->default_value_string().empty()) { + format( + "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" + " if ($name$_.IsDefault($init_value$)) {\n" + " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n" + " }\n" + "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); + } + format(" return p;\n"); } else { format( " return $name$_.Release(nullptr, GetArenaForAllocation(), " @@ -314,6 +323,14 @@ void StringFieldGenerator::GenerateInlineAccessorDefinitions( format( " $name$_.SetAllocated($init_value$, $name$,\n" " GetArenaForAllocation());\n"); + if (descriptor_->default_value_string().empty()) { + format( + "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" + " if ($name$_.IsDefault($init_value$)) {\n" + " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n" + " }\n" + "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); + } } else { // Currently, string fields with default value can't be inlined. format( @@ -422,6 +439,13 @@ void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const { } GOOGLE_DCHECK(!inlined_); format("$name$_.UnsafeSetDefault($init_value$);\n"); + if (IsString(descriptor_, options_) && + descriptor_->default_value_string().empty()) { + format( + "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n" + " $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n" + "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"); + } } void StringFieldGenerator::GenerateCopyConstructorCode( 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 85689bbec8..3f05443f58 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 @@ -55,7 +55,8 @@ class StringFieldGenerator : public FieldGenerator { 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 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; @@ -63,7 +64,8 @@ class StringFieldGenerator : public FieldGenerator { 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 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_; } @@ -108,7 +110,8 @@ class RepeatedStringFieldGenerator : public FieldGenerator { 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 GenerateSerializeWithCachedSizesToArray( + io::Printer* printer) const override; void GenerateByteSize(io::Printer* printer) const override; void GenerateConstinitInitializer(io::Printer* printer) const override; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc b/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc index fd6d5eb766..7032f2a747 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/importer.cc @@ -467,7 +467,7 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile( for (const auto& mapping : mappings_) { TProtoStringType temp_disk_file; if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path, - &temp_disk_file)) { + &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_doc_comment.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_doc_comment.cc index 51a85cdc7c..2d30eabce9 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_doc_comment.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_doc_comment.cc @@ -36,6 +36,7 @@ #include <vector> +#include <google/protobuf/descriptor.pb.h> #include <google/protobuf/io/printer.h> #include <google/protobuf/stubs/strutil.h> @@ -186,6 +187,21 @@ void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field) { printer->Print(" */\n"); } +void WriteDeprecatedJavadoc(io::Printer* printer, const FieldDescriptor* field, + const FieldAccessorType type) { + if (!field->options().deprecated()) { + return; + } + + // Lite codegen does not annotate set & clear methods with @Deprecated. + if (field->file()->options().optimize_for() == FileOptions::LITE_RUNTIME && + (type == SETTER || type == CLEARER)) { + return; + } + + printer->Print(" * @deprecated\n"); +} + void WriteFieldAccessorDocComment(io::Printer* printer, const FieldDescriptor* field, const FieldAccessorType type, @@ -194,6 +210,7 @@ void WriteFieldAccessorDocComment(io::Printer* printer, WriteDocCommentBody(printer, field); printer->Print(" * <code>$def$</code>\n", "def", EscapeJavadoc(FirstLineOf(field->DebugString()))); + WriteDeprecatedJavadoc(printer, field, type); switch (type) { case HAZZER: printer->Print(" * @return Whether the $name$ field is set.\n", "name", @@ -252,6 +269,7 @@ void WriteFieldEnumValueAccessorDocComment(io::Printer* printer, WriteDocCommentBody(printer, field); printer->Print(" * <code>$def$</code>\n", "def", EscapeJavadoc(FirstLineOf(field->DebugString()))); + WriteDeprecatedJavadoc(printer, field, type); switch (type) { case HAZZER: // Should never happen @@ -321,6 +339,7 @@ void WriteFieldStringBytesAccessorDocComment(io::Printer* printer, WriteDocCommentBody(printer, field); printer->Print(" * <code>$def$</code>\n", "def", EscapeJavadoc(FirstLineOf(field->DebugString()))); + WriteDeprecatedJavadoc(printer, field, type); switch (type) { case HAZZER: // Should never happen diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc index a037f6289c..8c658eef9b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_field.cc @@ -280,7 +280,7 @@ void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: $kt_type$\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -291,16 +291,17 @@ void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } } @@ -1081,12 +1082,12 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -1099,7 +1100,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "add(value: $kt_type$) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -1110,7 +1111,8 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: $kt_type$) {\n" " add(value)\n" @@ -1121,7 +1123,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -1133,7 +1135,8 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" " addAll(values)\n" @@ -1145,7 +1148,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: $kt_type$) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -1156,7 +1159,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 300da77b9c..f7e7b2dab7 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 @@ -285,7 +285,7 @@ void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: $kt_type$\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -296,16 +296,17 @@ void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } } @@ -823,12 +824,12 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -841,7 +842,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "add(value: $kt_type$) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -852,7 +853,8 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: $kt_type$) {\n" " add(value)\n" @@ -863,7 +865,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -875,7 +877,8 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" " addAll(values)\n" @@ -887,7 +890,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: $kt_type$) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -898,7 +901,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 c08f12f75c..d796c56c76 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) override; - virtual int GenerateNonNestedInitializationCode(io::Printer* printer) override; - virtual int GenerateRegistrationCode(io::Printer* printer) override; + void Generate(io::Printer* printer) override; + int GenerateNonNestedInitializationCode(io::Printer* printer) override; + 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 af835946b9..117b87f7a8 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,14 +51,13 @@ class ImmutableExtensionLiteGenerator : public ExtensionGenerator { Context* context); virtual ~ImmutableExtensionLiteGenerator(); - virtual void Generate(io::Printer* printer) override; + 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) override; + 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) override; + 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 e64a45dd49..831d9dd857 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 @@ -80,13 +80,13 @@ class ImmutableGeneratorFactory : public GeneratorFactory { ImmutableGeneratorFactory(Context* context); virtual ~ImmutableGeneratorFactory(); - virtual MessageGenerator* NewMessageGenerator( + MessageGenerator* NewMessageGenerator( const Descriptor* descriptor) const override; - virtual ExtensionGenerator* NewExtensionGenerator( + ExtensionGenerator* NewExtensionGenerator( const FieldDescriptor* descriptor) const override; - virtual ServiceGenerator* NewServiceGenerator( + ServiceGenerator* NewServiceGenerator( const ServiceDescriptor* descriptor) const override; private: diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h index dd80e23d3f..b0cce4949b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.h @@ -155,7 +155,7 @@ TProtoStringType GetOneofStoredType(const FieldDescriptor* field); // Whether we should generate multiple java files for messages. inline bool MultipleJavaFiles(const FileDescriptor* descriptor, bool immutable) { - (void) immutable; + (void)immutable; return descriptor->options().java_multiple_files(); } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.cc index 353bff46db..a35bd42ebe 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field.cc @@ -111,11 +111,13 @@ void SetMessageVariables(const FieldDescriptor* descriptor, int messageBitIndex, (*variables)["key_default_value"] = DefaultValue(key, true, name_resolver); (*variables)["key_null_check"] = IsReferenceType(keyJavaType) - ? "if (key == null) { throw new java.lang.NullPointerException(); }" + ? "if (key == null) { throw new NullPointerException(\"map key\"); }" : ""; (*variables)["value_null_check"] = - IsReferenceType(valueJavaType) - ? "if (value == null) { throw new java.lang.NullPointerException(); }" + valueJavaType != JAVATYPE_ENUM && IsReferenceType(valueJavaType) + ? "if (value == null) {\n" + " throw new NullPointerException(\"map value\");\n" + "}\n" : ""; if (valueJavaType == JAVATYPE_ENUM) { // We store enums as Integers internally. @@ -435,6 +437,7 @@ void ImmutableMapFieldGenerator::GenerateBuilderMembers( " $key_type$ key,\n" " $value_type$ value) {\n" " $key_null_check$\n" + " $value_null_check$\n" " internalGetMutable$capitalized_name$().getMutableMap()\n" " .put(key, value);\n" " return this;\n" @@ -679,13 +682,13 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -698,7 +701,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( printer->Print( variables_, "@JvmName(\"put$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .put(key: $kt_key_type$, value: $kt_value_type$) {\n" " $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n" @@ -709,7 +712,8 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"set$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslMap" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .set(key: $kt_key_type$, value: $kt_value_type$) {\n" " put(key, value)\n" @@ -720,7 +724,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"remove$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .remove(key: $kt_key_type$) {\n" " $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n" @@ -731,7 +735,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"putAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) " "{\n" @@ -743,7 +747,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field_lite.cc index 79bd924701..2c52ccaea7 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_map_field_lite.cc @@ -822,13 +822,13 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print( variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -841,7 +841,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print( variables_, "@JvmName(\"put$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .put(key: $kt_key_type$, value: $kt_value_type$) {\n" " $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n" @@ -852,7 +852,8 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"set$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslMap" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .set(key: $kt_key_type$, value: $kt_value_type$) {\n" " put(key, value)\n" @@ -863,7 +864,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"remove$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .remove(key: $kt_key_type$) {\n" " $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n" @@ -874,7 +875,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"putAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) " "{\n" @@ -886,7 +887,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslMap" + "public fun com.google.protobuf.kotlin.DslMap" "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " .clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 83c5fb5dd6..e5343d6762 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 @@ -1407,10 +1407,10 @@ void ImmutableMessageGenerator::GenerateKotlinDsl(io::Printer* printer) const { "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "@com.google.protobuf.kotlin.ProtoDslMarker\n"); printer->Print( - "class Dsl private constructor(\n" + "public class Dsl private constructor(\n" " private val _builder: $message$.Builder\n" ") {\n" - " companion object {\n" + " public companion object {\n" " @kotlin.jvm.JvmSynthetic\n" " @kotlin.PublishedApi\n" " internal fun _create(builder: $message$.Builder): Dsl = " @@ -1432,10 +1432,10 @@ void ImmutableMessageGenerator::GenerateKotlinDsl(io::Printer* printer) const { for (auto oneof : oneofs_) { printer->Print( - "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n" + "public val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n" " @JvmName(\"get$oneof_capitalized_name$Case\")\n" " get() = _builder.get$oneof_capitalized_name$Case()\n\n" - "fun clear$oneof_capitalized_name$() {\n" + "public fun clear$oneof_capitalized_name$() {\n" " _builder.clear$oneof_capitalized_name$()\n" "}\n", "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name, @@ -1456,7 +1456,8 @@ void ImmutableMessageGenerator::GenerateKotlinMembers( io::Printer* printer) const { printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> kotlin.Unit): " + "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " "$message$ " "=\n" " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() " @@ -1465,7 +1466,7 @@ void ImmutableMessageGenerator::GenerateKotlinMembers( "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_), "message", name_resolver_->GetClassName(descriptor_, true)); - printer->Print("object $name$Kt {\n", "name", descriptor_->name()); + printer->Print("public object $name$Kt {\n", "name", descriptor_->name()); printer->Indent(); GenerateKotlinDsl(printer); for (int i = 0; i < descriptor_->nested_type_count(); i++) { @@ -1481,7 +1482,8 @@ void ImmutableMessageGenerator::GenerateTopLevelKotlinMembers( io::Printer* printer) const { printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun $message$.copy(block: $message_kt$.Dsl.() -> kotlin.Unit): " + "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " "$message$ =\n" " $message_kt$.Dsl._create(this.toBuilder()).apply { block() " "}._build()\n", @@ -1502,7 +1504,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@Suppress(\"UNCHECKED_CAST\")\n" "@kotlin.jvm.JvmSynthetic\n" - "operator fun <T> get(extension: " + "public operator fun <T> get(extension: " "com.google.protobuf.ExtensionLite<$message$, T>): T {\n" " return if (extension.isRepeated) {\n" " get(extension as com.google.protobuf.ExtensionLite<$message$, " @@ -1518,7 +1520,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" - "operator fun <E> get(\n" + "public operator fun <E> get(\n" " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n" "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n" " return com.google.protobuf.kotlin.ExtensionList(extension, " @@ -1528,7 +1530,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "operator fun contains(extension: " + "public operator fun contains(extension: " "com.google.protobuf.ExtensionLite<$message$, *>): " "Boolean {\n" " return _builder.hasExtension(extension)\n" @@ -1537,7 +1539,8 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "fun clear(extension: com.google.protobuf.ExtensionLite<$message$, *>) " + "public fun clear(extension: " + "com.google.protobuf.ExtensionLite<$message$, *>) " "{\n" " _builder.clearExtension(extension)\n" "}\n\n", @@ -1555,7 +1558,8 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <T : Comparable<T>> set(\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <T : Comparable<T>> set(\n" " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" " value: T\n" ") {\n" @@ -1565,7 +1569,8 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun set(\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun set(\n" " extension: com.google.protobuf.ExtensionLite<$message$, " "com.google.protobuf.ByteString>,\n" " value: com.google.protobuf.ByteString\n" @@ -1576,7 +1581,8 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <T : com.google.protobuf.MessageLite> set(\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <T : com.google.protobuf.MessageLite> set(\n" " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" " value: T\n" ") {\n" @@ -1586,7 +1592,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.add(value: E) {\n" " _builder.addExtension(this.extension, value)\n" "}\n\n", @@ -1594,7 +1600,9 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <E> " + "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign" "(value: E) {\n" " add(value)\n" @@ -1603,7 +1611,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.addAll(values: Iterable<E>) {\n" " for (value in values) {\n" " add(value)\n" @@ -1613,7 +1621,9 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <E> " + "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign(values: " "Iterable<E>) {\n" " addAll(values)\n" @@ -1622,7 +1632,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "public operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.set(index: Int, value: " "E) {\n" " _builder.setExtension(this.extension, index, value)\n" @@ -1631,7 +1641,8 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun com.google.protobuf.kotlin.ExtensionList<*, " + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline fun com.google.protobuf.kotlin.ExtensionList<*, " "$message$>.clear() {\n" " clear(extension)\n" "}\n\n", diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.cc index 6e2f181387..bdd80a811f 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field.cc @@ -417,7 +417,7 @@ void ImmutableMessageFieldGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: $kt_type$\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -428,15 +428,16 @@ void ImmutableMessageFieldGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } void ImmutableMessageFieldGenerator::GenerateFieldBuilderInitializationCode( @@ -1403,12 +1404,12 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -1421,7 +1422,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "add(value: $kt_type$) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -1432,7 +1433,8 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: $kt_type$) {\n" " add(value)\n" @@ -1443,7 +1445,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -1455,7 +1457,8 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" " addAll(values)\n" @@ -1467,7 +1470,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: $kt_type$) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -1478,7 +1481,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\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 9674ab425e..a0c24ae7b7 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 @@ -78,7 +78,8 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator { 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 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; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.cc index f36555f00c..100726856c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_field_lite.cc @@ -287,7 +287,7 @@ void ImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: $kt_type$\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -298,15 +298,16 @@ void ImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } void ImmutableMessageFieldLiteGenerator::GenerateFieldInfo( @@ -793,12 +794,12 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -811,7 +812,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "add(value: $kt_type$) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -822,7 +823,8 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: $kt_type$) {\n" " add(value)\n" @@ -833,7 +835,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -845,7 +847,8 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" " addAll(values)\n" @@ -857,7 +860,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: $kt_type$) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -868,7 +871,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 bb8bcf7a95..f5d7c9362a 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 @@ -731,10 +731,10 @@ void ImmutableMessageLiteGenerator::GenerateKotlinDsl( "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "@com.google.protobuf.kotlin.ProtoDslMarker\n"); printer->Print( - "class Dsl private constructor(\n" + "public class Dsl private constructor(\n" " private val _builder: $message$.Builder\n" ") {\n" - " companion object {\n" + " public companion object {\n" " @kotlin.jvm.JvmSynthetic\n" " @kotlin.PublishedApi\n" " internal fun _create(builder: $message$.Builder): Dsl = " @@ -756,10 +756,10 @@ void ImmutableMessageLiteGenerator::GenerateKotlinDsl( for (auto oneof : oneofs_) { printer->Print( - "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n" + "public val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n" " @JvmName(\"get$oneof_capitalized_name$Case\")\n" " get() = _builder.get$oneof_capitalized_name$Case()\n\n" - "fun clear$oneof_capitalized_name$() {\n" + "public fun clear$oneof_capitalized_name$() {\n" " _builder.clear$oneof_capitalized_name$()\n" "}\n", "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name, @@ -780,7 +780,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( io::Printer* printer) const { printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> kotlin.Unit): " + "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " "$message$ =\n" " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() " "}._build()\n", @@ -788,7 +789,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_), "message", name_resolver_->GetClassName(descriptor_, true)); - printer->Print("object $name$Kt {\n", "name", descriptor_->name()); + printer->Print("public object $name$Kt {\n", "name", descriptor_->name()); printer->Indent(); GenerateKotlinDsl(printer); for (int i = 0; i < descriptor_->nested_type_count(); i++) { @@ -803,7 +804,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( void ImmutableMessageLiteGenerator::GenerateTopLevelKotlinMembers( io::Printer* printer) const { printer->Print( - "inline fun $message$.copy(block: $message_kt$.Dsl.() -> kotlin.Unit): " + "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> " + "kotlin.Unit): " "$message$ =\n" " $message_kt$.Dsl._create(this.toBuilder()).apply { block() " "}._build()\n", @@ -824,7 +826,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@Suppress(\"UNCHECKED_CAST\")\n" "@kotlin.jvm.JvmSynthetic\n" - "operator fun <T> get(extension: " + "public operator fun <T> get(extension: " "com.google.protobuf.ExtensionLite<$message$, T>): T {\n" " return if (extension.isRepeated) {\n" " get(extension as com.google.protobuf.ExtensionLite<$message$, " @@ -840,7 +842,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n" - "operator fun <E> get(\n" + "public operator fun <E> get(\n" " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n" "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n" " return com.google.protobuf.kotlin.ExtensionList(extension, " @@ -850,7 +852,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "operator fun contains(extension: " + "public operator fun contains(extension: " "com.google.protobuf.ExtensionLite<$message$, *>): " "Boolean {\n" " return _builder.hasExtension(extension)\n" @@ -859,7 +861,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "fun clear(extension: com.google.protobuf.ExtensionLite<$message$, *>) " + "public fun clear(extension: " + "com.google.protobuf.ExtensionLite<$message$, *>) " "{\n" " _builder.clearExtension(extension)\n" "}\n\n", @@ -877,7 +880,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <T : Comparable<T>> set(\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <T : Comparable<T>> set(\n" " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" " value: T\n" ") {\n" @@ -887,7 +891,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun set(\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun set(\n" " extension: com.google.protobuf.ExtensionLite<$message$, " "com.google.protobuf.ByteString>,\n" " value: com.google.protobuf.ByteString\n" @@ -898,7 +903,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <T : com.google.protobuf.MessageLite> set(\n" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <T : com.google.protobuf.MessageLite> set(\n" " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n" " value: T\n" ") {\n" @@ -908,7 +914,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun<E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.add(value: E) {\n" " _builder.addExtension(this.extension, value)\n" "}\n\n", @@ -916,7 +922,9 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <E> " + "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign" "(value: E) {\n" " add(value)\n" @@ -925,7 +933,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "public fun<E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.addAll(values: Iterable<E>) {\n" " for (value in values) {\n" " add(value)\n" @@ -935,7 +943,9 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun <E> " + "com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.plusAssign(values: " "Iterable<E>) {\n" " addAll(values)\n" @@ -944,7 +954,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " + "public operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, " "$message$>.set(index: Int, value: " "E) {\n" " _builder.setExtension(this.extension, index, value)\n" @@ -953,7 +963,8 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions( printer->Print( "@kotlin.jvm.JvmSynthetic\n" - "inline fun com.google.protobuf.kotlin.ExtensionList<*, " + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline fun com.google.protobuf.kotlin.ExtensionList<*, " "$message$>.clear() {\n" " clear(extension)\n" "}\n\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 0af0cb8ad2..adb0df7cc7 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) override; - virtual void GenerateInterface(io::Printer* printer) override; - virtual void GenerateExtensionRegistrationCode(io::Printer* printer) override; - virtual void GenerateStaticVariables(io::Printer* printer, - int* bytecode_estimate) override; - virtual int GenerateStaticVariableInitializers(io::Printer* printer) override; + void Generate(io::Printer* printer) override; + void GenerateInterface(io::Printer* printer) override; + void GenerateExtensionRegistrationCode(io::Printer* printer) override; + void GenerateStaticVariables(io::Printer* printer, + int* bytecode_estimate) override; + 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.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc index 51e91affd8..8b3d234469 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field.cc @@ -159,12 +159,25 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["set_has_field_bit_builder"] = ""; (*variables)["clear_has_field_bit_builder"] = ""; - if (descriptor->type() == FieldDescriptor::TYPE_BYTES) { - (*variables)["is_field_present_message"] = - "!" + (*variables)["name"] + "_.isEmpty()"; - } else { - (*variables)["is_field_present_message"] = - (*variables)["name"] + "_ != " + (*variables)["default"]; + switch (descriptor->type()) { + case FieldDescriptor::TYPE_BYTES: + (*variables)["is_field_present_message"] = + "!" + (*variables)["name"] + "_.isEmpty()"; + break; + case FieldDescriptor::TYPE_FLOAT: + (*variables)["is_field_present_message"] = + "java.lang.Float.floatToRawIntBits(" + (*variables)["name"] + + "_) != 0"; + break; + case FieldDescriptor::TYPE_DOUBLE: + (*variables)["is_field_present_message"] = + "java.lang.Double.doubleToRawLongBits(" + (*variables)["name"] + + "_) != 0"; + break; + default: + (*variables)["is_field_present_message"] = + (*variables)["name"] + "_ != " + (*variables)["default"]; + break; } } @@ -307,7 +320,7 @@ void ImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: $kt_type$\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -318,16 +331,17 @@ void ImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } } @@ -617,8 +631,8 @@ void ImmutablePrimitiveOneofFieldGenerator::GenerateMergingCode( void ImmutablePrimitiveOneofFieldGenerator::GenerateParsingCode( io::Printer* printer) const { printer->Print(variables_, - "$set_oneof_case_message$;\n" - "$oneof_name$_ = input.read$capitalized_type$();\n"); + "$oneof_name$_ = input.read$capitalized_type$();\n" + "$set_oneof_case_message$;\n"); } void ImmutablePrimitiveOneofFieldGenerator::GenerateSerializationCode( @@ -835,12 +849,12 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -853,7 +867,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "add(value: $kt_type$) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -864,7 +878,8 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: $kt_type$) {\n" " add(value)\n" @@ -875,7 +890,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -887,7 +902,8 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" " addAll(values)\n" @@ -899,7 +915,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: $kt_type$) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -910,7 +926,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc index 24fef33624..6ab207e7af 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_primitive_field_lite.cc @@ -164,12 +164,25 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["set_has_field_bit_message"] = ""; (*variables)["clear_has_field_bit_message"] = ""; - if (descriptor->type() == FieldDescriptor::TYPE_BYTES) { - (*variables)["is_field_present_message"] = - "!" + (*variables)["name"] + "_.isEmpty()"; - } else { - (*variables)["is_field_present_message"] = - (*variables)["name"] + "_ != " + (*variables)["default"]; + switch (descriptor->type()) { + case FieldDescriptor::TYPE_BYTES: + (*variables)["is_field_present_message"] = + "!" + (*variables)["name"] + "_.isEmpty()"; + break; + case FieldDescriptor::TYPE_FLOAT: + (*variables)["is_field_present_message"] = + "java.lang.Float.floatToRawIntBits(" + (*variables)["name"] + + "_) != 0"; + break; + case FieldDescriptor::TYPE_DOUBLE: + (*variables)["is_field_present_message"] = + "java.lang.Double.doubleToRawLongBits(" + (*variables)["name"] + + "_) != 0"; + break; + default: + (*variables)["is_field_present_message"] = + (*variables)["name"] + "_ != " + (*variables)["default"]; + break; } } @@ -313,7 +326,7 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: $kt_type$\n" + "$kt_deprecation$public var $kt_name$: $kt_type$\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -324,16 +337,17 @@ void ImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } } @@ -658,12 +672,12 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$ val $kt_name$: " + "$kt_deprecation$ public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.jvm.JvmSynthetic\n" @@ -676,7 +690,7 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "add(value: $kt_type$) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -687,7 +701,8 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: $kt_type$) {\n" " add(value)\n" @@ -698,7 +713,7 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -710,7 +725,8 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n" " addAll(values)\n" @@ -722,7 +738,7 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: $kt_type$) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -733,7 +749,7 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 7314f340d9..58d2c8d750 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) override; + 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 2d0eb752a8..0c9ba04e56 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 @@ -81,7 +81,8 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, " throw new NullPointerException();\n" " }\n"; (*variables)["isStringEmpty"] = "com.google.protobuf.GeneratedMessage" + - GeneratedCodeVersionSuffix() + ".isStringEmpty"; + GeneratedCodeVersionSuffix() + + ".isStringEmpty"; (*variables)["writeString"] = "com.google.protobuf.GeneratedMessage" + GeneratedCodeVersionSuffix() + ".writeString"; (*variables)["computeStringSize"] = "com.google.protobuf.GeneratedMessage" + @@ -119,7 +120,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor, (*variables)["clear_has_field_bit_builder"] = ""; (*variables)["is_field_present_message"] = - "!" + (*variables)["isStringEmpty"] + "(" + (*variables)["name"] + "_)"; + "!" + (*variables)["isStringEmpty"] + "(" + (*variables)["name"] + "_)"; } // For repeated builders, one bit is used for whether the array is immutable. @@ -378,7 +379,7 @@ void ImmutableStringFieldGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: kotlin.String\n" + "$kt_deprecation$public var $kt_name$: kotlin.String\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -389,16 +390,17 @@ void ImmutableStringFieldGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } } @@ -961,21 +963,19 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); // property for List<String> WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); - printer->Print( - variables_, - "val $kt_name$: " - "com.google.protobuf.kotlin.DslList" - "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n" - " @kotlin.OptIn" - "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - " get() = com.google.protobuf.kotlin.DslList(\n" - " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" - " )\n"); + printer->Print(variables_, + "$kt_deprecation$public val $kt_name$: " + "com.google.protobuf.kotlin.DslList" + "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n" + " @kotlin.jvm.JvmSynthetic\n" + " get() = com.google.protobuf.kotlin.DslList(\n" + " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n" + " )\n"); // List<String>.add(String) WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, @@ -983,7 +983,7 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "add(value: kotlin.String) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -992,13 +992,14 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( // List<String> += String WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER, /* builder */ false); - printer->Print(variables_, + printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: kotlin.String) {\n" - " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" + " add(value)\n" "}\n"); // List<String>.addAll(Iterable<String>) @@ -1008,7 +1009,7 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<kotlin.String>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -1021,10 +1022,11 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n" - " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" + " addAll(values)\n" "}\n"); // List<String>[Int] = String @@ -1034,7 +1036,7 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: kotlin.String) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -1045,7 +1047,7 @@ void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 680e77252c..02f0734aea 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 @@ -78,7 +78,8 @@ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator { 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 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; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc index 42198cc266..3150c766ce 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_string_field_lite.cc @@ -313,7 +313,7 @@ void ImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( io::Printer* printer) const { WriteFieldDocComment(printer, descriptor_); printer->Print(variables_, - "$kt_deprecation$var $kt_name$: kotlin.String\n" + "$kt_deprecation$public var $kt_name$: kotlin.String\n" " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n" " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n" " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n" @@ -324,16 +324,17 @@ void ImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( WriteFieldAccessorDocComment(printer, descriptor_, CLEARER, /* builder */ false); printer->Print(variables_, - "fun ${$clear$kt_capitalized_name$$}$() {\n" + "public fun ${$clear$kt_capitalized_name$$}$() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" "}\n"); if (HasHazzer(descriptor_)) { WriteFieldAccessorDocComment(printer, descriptor_, HAZZER); - printer->Print(variables_, - "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" - " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" - "}\n"); + printer->Print( + variables_, + "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n" + " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n" + "}\n"); } } @@ -747,14 +748,14 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( " */\n" "@kotlin.OptIn" "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n" - "class ${$$kt_capitalized_name$Proxy$}$ private constructor()" + "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()" " : com.google.protobuf.kotlin.DslProxy()\n"); // property for List<String> WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER); printer->Print( variables_, - "val $kt_name$: " + "$kt_deprecation$public val $kt_name$: " "com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n" " @kotlin.OptIn" @@ -769,7 +770,7 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "add(value: kotlin.String) {\n" " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n" @@ -781,7 +782,8 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(value: kotlin.String) {\n" " add(value)\n" @@ -794,7 +796,7 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "addAll(values: kotlin.collections.Iterable<kotlin.String>) {\n" " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n" @@ -807,7 +809,8 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n" - "inline operator fun com.google.protobuf.kotlin.DslList" + "@Suppress(\"NOTHING_TO_INLINE\")\n" + "public inline operator fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n" " addAll(values)\n" @@ -820,7 +823,7 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n" - "operator fun com.google.protobuf.kotlin.DslList" + "public operator fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "set(index: kotlin.Int, value: kotlin.String) {\n" " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n" @@ -831,7 +834,7 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers( printer->Print(variables_, "@kotlin.jvm.JvmSynthetic\n" "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n" - "fun com.google.protobuf.kotlin.DslList" + "public fun com.google.protobuf.kotlin.DslList" "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>." "clear() {\n" " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n" 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 ac334018df..019ef3a5b5 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 @@ -3625,7 +3625,16 @@ void Generator::GenerateFile(const GeneratorOptions& options, if (options.import_style == GeneratorOptions::kImportCommonJsStrict) { printer->Print("var proto = {};\n\n"); } else { - printer->Print("var global = Function('return this')();\n\n"); + // To get the global object we call a function with .call(null), this will set "this" inside the + // function to the global object. + // This does not work if we are running in strict mode ("use strict"), + // so we fallback to the following things (in order from first to last): + // - window: defined in browsers + // - global: defined in most server side environments like NodeJS + // - self: defined inside Web Workers (WorkerGlobalScope) + // - Function('return this')(): this will work on most platforms, but it may be blocked by things like CSP. + // Function('') is almost the same as eval('') + printer->Print("var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);\n\n"); } for (int i = 0; i < file->dependency_count(); i++) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum.cc index c3836faa2a..39c7829576 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_enum.cc @@ -127,7 +127,6 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) { if (alias_values_to_skip_.find(all_values_[i]) != alias_values_to_skip_.end()) { continue; } - SourceLocation location; if (all_values_[i]->GetSourceLocation(&location)) { TProtoStringType comments = BuildCommentsString(location, true).c_str(); if (comments.length() > 0) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.cc index 63b543bfb4..abb8bb7811 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.cc @@ -52,7 +52,7 @@ namespace objectivec { namespace { // This is also found in GPBBootstrap.h, and needs to be kept in sync. -const int32 GOOGLE_PROTOBUF_OBJC_VERSION = 30004; +const arc_i32 GOOGLE_PROTOBUF_OBJC_VERSION = 30004; const char* kHeaderExtension = ".pbobjc.h"; 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 371234aafe..160af71080 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 @@ -44,6 +44,28 @@ namespace protobuf { namespace compiler { namespace objectivec { +namespace { + +// Convert a string with "yes"/"no" (case insensitive) to a boolean, returning +// true/false for if the input string was a valid value. If the input string is +// invalid, `result` is unchanged. +bool StringToBool(const TProtoStringType& value, bool* result) { + TProtoStringType upper_value(value); + UpperString(&upper_value); + if (upper_value == "NO") { + *result = false; + return true; + } + if (upper_value == "YES") { + *result = true; + return true; + } + + return false; +} + +} // namespace + ObjectiveCGenerator::ObjectiveCGenerator() {} ObjectiveCGenerator::~ObjectiveCGenerator() {} @@ -101,6 +123,31 @@ bool ObjectiveCGenerator::GenerateAll( generation_options.expected_prefixes_suppressions.push_back( TProtoStringType(split_piece)); } + } else if (options[i].first == "prefixes_must_be_registered") { + // If objc prefix file option value must be registered to be used. This + // option has no meaning if an "expected_prefixes_path" isn't set. The + // available options are: + // "no": They don't have to be registered. + // "yes": They must be registered and an error will be raised if a files + // tried to use a prefix that isn't registered. + // Default is "no". + if (!StringToBool(options[i].second, + &generation_options.prefixes_must_be_registered)) { + *error = "error: Unknown value for prefixes_must_be_registered: " + options[i].second; + return false; + } + } else if (options[i].first == "require_prefixes") { + // If every file must have an objc prefix file option to be used. The + // available options are: + // "no": Files can be generated without the prefix option. + // "yes": Files must have the objc prefix option, and an error will be + // raised if a files doesn't have one. + // Default is "no". + if (!StringToBool(options[i].second, + &generation_options.require_prefixes)) { + *error = "error: Unknown value for require_prefixes: " + options[i].second; + return false; + } } else if (options[i].first == "generate_for_named_framework") { // The name of the framework that protos are being generated for. This // will cause the #import statements to be framework based using this @@ -146,12 +193,9 @@ bool ObjectiveCGenerator::GenerateAll( // 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); + bool value = false; + if (StringToBool(options[i].second, &value)) { + SetUseProtoPackageAsDefaultPrefix(value); } else { *error = "error: Unknown use_package_as_prefix: " + options[i].second; return false; 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 bbcfbdd2bc..cbe70bac36 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 @@ -179,6 +179,8 @@ Options::Options() { expected_prefixes_suppressions = Split(suppressions, ";", true); } + prefixes_must_be_registered = false; + require_prefixes = false; } namespace { @@ -993,7 +995,7 @@ TProtoStringType DefaultValue(const FieldDescriptor* field) { // Must convert to a standard byte order for packing length into // a cstring. - uint32 length = ghtonl(default_string.length()); + arc_ui32 length = ghtonl(default_string.length()); TProtoStringType bytes((const char*)&length, sizeof(length)); bytes.append(default_string); return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\""; @@ -1228,6 +1230,7 @@ bool LoadExpectedPackagePrefixes(const Options& generation_options, bool ValidateObjCClassPrefix( const FileDescriptor* file, const TProtoStringType& expected_prefixes_path, const std::map<TProtoStringType, TProtoStringType>& expected_package_prefixes, + bool prefixes_must_be_registered, bool require_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 @@ -1266,6 +1269,12 @@ bool ValidateObjCClassPrefix( // If there was no prefix option, we're done at this point. if (!has_prefix) { + if (require_prefixes) { + *out_error = + "error: '" + file->name() + "' does not have a required 'option" + + " objc_class_prefix'."; + return false; + } return true; } @@ -1345,9 +1354,18 @@ bool ValidateObjCClassPrefix( std::cerr.flush(); } - // Check: Warning - If the given package/prefix pair wasn't expected, issue a - // warning suggesting it gets added to the file. + // Check: Error/Warning - If the given package/prefix pair wasn't expected, + // issue a error/warning to added to the file. if (have_expected_prefix_file) { + if (prefixes_must_be_registered) { + *out_error = + "error: '" + file->name() + "' has 'option objc_class_prefix = \"" + + prefix + "\";', but it is not registered; add it to the expected " + + "prefixes file (" + expected_prefixes_path + ") for the package '" + + package + "'."; + return false; + } + std::cerr << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \"" << prefix << "\";' in '" << file->name() << "';" @@ -1392,6 +1410,8 @@ bool ValidateObjCClassPrefixes(const std::vector<const FileDescriptor*>& files, ValidateObjCClassPrefix(files[i], generation_options.expected_prefixes_path, expected_package_prefixes, + generation_options.prefixes_must_be_registered, + generation_options.require_prefixes, out_error); if (!is_valid) { return false; @@ -1404,7 +1424,7 @@ TextFormatDecodeData::TextFormatDecodeData() { } TextFormatDecodeData::~TextFormatDecodeData() { } -void TextFormatDecodeData::AddString(int32 key, +void TextFormatDecodeData::AddString(arc_i32 key, const TProtoStringType& input_for_decode, const TProtoStringType& desired_output) { for (std::vector<DataEntry>::const_iterator i = entries_.begin(); @@ -1460,12 +1480,12 @@ class DecodeDataBuilder { } private: - static constexpr uint8 kAddUnderscore = 0x80; + static constexpr uint8_t kAddUnderscore = 0x80; - static constexpr uint8 kOpAsIs = 0x00; - static constexpr uint8 kOpFirstUpper = 0x40; - static constexpr uint8 kOpFirstLower = 0x20; - static constexpr uint8 kOpAllUpper = 0x60; + static constexpr uint8_t kOpAsIs = 0x00; + static constexpr uint8_t kOpFirstUpper = 0x40; + static constexpr uint8_t kOpFirstLower = 0x20; + static constexpr uint8_t kOpAllUpper = 0x60; static constexpr int kMaxSegmentLen = 0x1f; @@ -1475,7 +1495,7 @@ class DecodeDataBuilder { } void Push() { - uint8 op = (op_ | segment_len_); + uint8_t op = (op_ | segment_len_); if (need_underscore_) op |= kAddUnderscore; if (op != 0) { decode_data_ += (char)op; @@ -1507,7 +1527,7 @@ class DecodeDataBuilder { bool need_underscore_; bool is_all_upper_; - uint8 op_; + uint8_t op_; int segment_len_; TProtoStringType decode_data_; @@ -1619,69 +1639,69 @@ class Parser { Parser(LineConsumer* line_consumer) : line_consumer_(line_consumer), line_(0) {} - // Parses a check of input, returning success/failure. - bool ParseChunk(StringPiece chunk); + // Feeds in some input, parse what it can, returning success/failure. Calling + // again after an error is undefined. + bool ParseChunk(StringPiece chunk, TProtoStringType* out_error); // Should be called to finish parsing (after all input has been provided via - // ParseChunk()). Returns success/failure. - bool Finish(); + // successful calls to ParseChunk(), calling after a ParseChunk() failure is + // undefined). Returns success/failure. + bool Finish(TProtoStringType* out_error); int last_line() const { return line_; } - TProtoStringType error_str() const { return error_str_; } private: - bool ParseLoop(); - LineConsumer* line_consumer_; int line_; - TProtoStringType error_str_; - StringPiece p_; TProtoStringType leftover_; }; -bool Parser::ParseChunk(StringPiece chunk) { +bool Parser::ParseChunk(StringPiece chunk, TProtoStringType* out_error) { + StringPiece full_chunk; if (!leftover_.empty()) { leftover_ += TProtoStringType(chunk); - p_ = StringPiece(leftover_); + full_chunk = StringPiece(leftover_); } else { - p_ = chunk; + full_chunk = chunk; + } + + StringPiece line; + while (ReadLine(&full_chunk, &line)) { + ++line_; + RemoveComment(&line); + TrimWhitespace(&line); + if (!line.empty() && !line_consumer_->ConsumeLine(line, out_error)) { + if (out_error->empty()) { + *out_error = "ConsumeLine failed without setting an error."; + } + leftover_.clear(); + return false; + } } - bool result = ParseLoop(); - if (p_.empty()) { + + if (full_chunk.empty()) { leftover_.clear(); } else { - leftover_ = TProtoStringType(p_); + leftover_ = TProtoStringType(full_chunk); } - return result; + return true; } -bool Parser::Finish() { - if (leftover_.empty()) { - return true; +bool Parser::Finish(TProtoStringType* out_error) { + // If there is still something to go, flush it with a newline. + if (!leftover_.empty() && !ParseChunk("\n", out_error)) { + return false; } - // Force a newline onto the end to finish parsing. - leftover_ += "\n"; - p_ = StringPiece(leftover_); - if (!ParseLoop()) { + // This really should never fail if ParseChunk succeeded, but check to be sure. + if (!leftover_.empty()) { + *out_error = "ParseSimple Internal error: finished with pending data."; return false; } - return p_.empty(); // Everything used? + return true; } -bool Parser::ParseLoop() { - StringPiece line; - while (ReadLine(&p_, &line)) { - ++line_; - RemoveComment(&line); - TrimWhitespace(&line); - if (line.empty()) { - continue; // Blank line. - } - if (!line_consumer_->ConsumeLine(line, &error_str_)) { - return false; - } - } - return true; +TProtoStringType FullErrorString(const TProtoStringType& name, int line_num, const TProtoStringType& msg) { + return TProtoStringType("error: ") + name + " Line " + StrCat(line_num) + ", " + msg; } } // namespace @@ -1704,22 +1724,33 @@ bool ParseSimpleFile(const TProtoStringType& path, LineConsumer* line_consumer, io::FileInputStream file_stream(fd); file_stream.SetCloseOnDelete(true); + return ParseSimpleStream(file_stream, path, line_consumer, out_error); +} + +bool ParseSimpleStream(io::ZeroCopyInputStream& input_stream, + const TProtoStringType& stream_name, + LineConsumer* line_consumer, + TProtoStringType* out_error) { + TProtoStringType local_error; Parser parser(line_consumer); const void* buf; int buf_len; - while (file_stream.Next(&buf, &buf_len)) { + while (input_stream.Next(&buf, &buf_len)) { if (buf_len == 0) { continue; } - if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len))) { - *out_error = - TProtoStringType("error: ") + path + - " Line " + StrCat(parser.last_line()) + ", " + parser.error_str(); + if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len), + &local_error)) { + *out_error = FullErrorString(stream_name, parser.last_line(), local_error); return false; } } - return parser.Finish(); + if (!parser.Finish(&local_error)) { + *out_error = FullErrorString(stream_name, parser.last_line(), local_error); + return false; + } + return true; } ImportWriter::ImportWriter( 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 2e291dbd6b..28acf4affd 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 @@ -38,6 +38,7 @@ #include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/zero_copy_stream.h> #include <google/protobuf/port_def.inc> @@ -67,6 +68,8 @@ struct Options { TProtoStringType generate_for_named_framework; TProtoStringType named_framework_to_proto_path_mappings_path; TProtoStringType runtime_import_prefix; + bool prefixes_must_be_registered; + bool require_prefixes; }; // Escape C++ trigraphs by escaping question marks to "\?". @@ -260,7 +263,7 @@ class PROTOC_EXPORT TextFormatDecodeData { TextFormatDecodeData(const TextFormatDecodeData&) = delete; TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete; - void AddString(int32 key, const TProtoStringType& input_for_decode, + void AddString(arc_i32 key, const TProtoStringType& input_for_decode, const TProtoStringType& desired_output); size_t num_entries() const { return entries_.size(); } TProtoStringType Data() const; @@ -269,7 +272,7 @@ class PROTOC_EXPORT TextFormatDecodeData { const TProtoStringType& desired_output); private: - typedef std::pair<int32, TProtoStringType> DataEntry; + typedef std::pair<arc_i32, TProtoStringType> DataEntry; std::vector<DataEntry> entries_; }; @@ -285,6 +288,11 @@ bool PROTOC_EXPORT ParseSimpleFile(const TProtoStringType& path, LineConsumer* line_consumer, TProtoStringType* out_error); +bool PROTOC_EXPORT ParseSimpleStream(io::ZeroCopyInputStream& input_stream, + const TProtoStringType& stream_name, + LineConsumer* line_consumer, + TProtoStringType* out_error); + // Helper class for parsing framework import mappings and generating // import statements. class PROTOC_EXPORT ImportWriter { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc index 03b00dd0e8..335edcf30c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc @@ -1514,6 +1514,13 @@ bool Parser::ParseOption(Message* options, AddError("Unexpected end of stream while parsing option value."); return false; + case io::Tokenizer::TYPE_WHITESPACE: + case io::Tokenizer::TYPE_NEWLINE: + GOOGLE_CHECK(!input_->report_whitespace() && !input_->report_newlines()) + << "Whitespace tokens were not requested."; + GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace."; + return false; + case io::Tokenizer::TYPE_IDENTIFIER: { value_location.AddPath( UninterpretedOption::kIdentifierValueFieldNumber); @@ -1538,7 +1545,7 @@ bool Parser::ParseOption(Message* options, value_location.AddPath( UninterpretedOption::kNegativeIntValueFieldNumber); uninterpreted_option->set_negative_int_value( - static_cast<arc_i64>(-value)); + static_cast<arc_i64>(0 - value)); } else { value_location.AddPath( UninterpretedOption::kPositiveIntValueFieldNumber); 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 56c7d10338..03aca43b04 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 @@ -1121,9 +1121,9 @@ void GenerateAddFilesToPool(const FileDescriptor* file, const Options& options, file, &nodes_without_dependency, &deps, &dependency_count); while (!nodes_without_dependency.empty()) { - auto file = *nodes_without_dependency.begin(); - nodes_without_dependency.erase(file); - for (auto dependent : deps[file]) { + auto file_node = *nodes_without_dependency.begin(); + nodes_without_dependency.erase(file_node); + for (auto dependent : deps[file_node]) { if (dependency_count[dependent] == 1) { dependency_count.erase(dependent); nodes_without_dependency.insert(dependent); @@ -1132,11 +1132,11 @@ void GenerateAddFilesToPool(const FileDescriptor* file, const Options& options, } } - bool needs_aggregate = NeedsUnwrapping(file, options); + bool needs_aggregate = NeedsUnwrapping(file_node, options); if (needs_aggregate) { auto file_proto = sorted_file_set.add_file(); - file->CopyTo(file_proto); + file_node->CopyTo(file_proto); // Filter out descriptor.proto as it cannot be depended on for now. RepeatedPtrField<TProtoStringType>* dependency = @@ -1158,7 +1158,7 @@ void GenerateAddFilesToPool(const FileDescriptor* file, const Options& options, it->clear_extension(); } } else { - TProtoStringType dependency_filename = GeneratedMetadataFileName(file, false); + TProtoStringType dependency_filename = GeneratedMetadataFileName(file_node, false); printer->Print( "\\^name^::initOnce();\n", "name", FilenameToClassname(dependency_filename)); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc index 6ddcb86202..3d51e1e1cd 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc @@ -72,21 +72,22 @@ class GeneratorResponseContext : public GeneratorContext { // implements GeneratorContext -------------------------------------- - virtual io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) override { + 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) override { + io::ZeroCopyOutputStream* OpenForInsert( + const TProtoStringType& filename, + const TProtoStringType& insertion_point) override { CodeGeneratorResponse::File* file = response_->add_file(); file->set_name(filename); file->set_insertion_point(insertion_point); return new io::StringOutputStream(file->mutable_content()); } - virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( + io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( const TProtoStringType& filename, const TProtoStringType& insertion_point, const google::protobuf::GeneratedCodeInfo& info) override { CodeGeneratorResponse::File* file = response_->add_file(); 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 092d2ba17f..6370bf1fb1 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.cc @@ -83,7 +83,7 @@ static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1]; 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) = { +const arc_ui32 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_), ~0u, // no _extensions_ @@ -207,13 +207,13 @@ bool CodeGeneratorResponse_Feature_IsValid(int value) { } } -#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_NONE; constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_PROTO3_OPTIONAL; constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MIN; constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MAX; constexpr int CodeGeneratorResponse::Feature_ARRAYSIZE; -#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) // =================================================================== @@ -248,6 +248,9 @@ Version::Version(const Version& from) _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_suffix()) { suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(), GetArenaForAllocation()); @@ -258,8 +261,11 @@ Version::Version(const Version& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version) } -void Version::SharedCtor() { +inline void Version::SharedCtor() { suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&major_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&patch_) - @@ -290,7 +296,7 @@ void Version::SetCachedSize(int size) const { void Version::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -311,39 +317,39 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional int32 major = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) { _Internal::set_has_major(&has_bits); - major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 minor = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_minor(&has_bits); - minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 patch = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) { _Internal::set_has_patch(&has_bits); - patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional string suffix = 4; case 4: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) { auto str = _internal_mutable_suffix(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -377,10 +383,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* Version::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* Version::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -424,7 +430,7 @@ size_t Version::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -472,7 +478,7 @@ void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void Version::MergeFrom(const Version& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -569,6 +575,9 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) proto_file_(from.proto_file_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_parameter()) { parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(), GetArenaForAllocation()); @@ -581,8 +590,11 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest) } -void CodeGeneratorRequest::SharedCtor() { +inline void CodeGeneratorRequest::SharedCtor() { parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING compiler_version_ = nullptr; } @@ -611,7 +623,7 @@ void CodeGeneratorRequest::SetCachedSize(int size) const { void CodeGeneratorRequest::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -635,12 +647,12 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated string file_to_generate = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { ptr -= 1; do { ptr += 1; @@ -657,7 +669,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional string parameter = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_parameter(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -669,7 +681,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // optional .google.protobuf.compiler.Version compiler_version = 3; case 3: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) { ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr); CHK_(ptr); } else @@ -677,7 +689,7 @@ const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAM continue; // repeated .google.protobuf.FileDescriptorProto proto_file = 15; case 15: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) { ptr -= 1; do { ptr += 1; @@ -712,10 +724,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorRequest::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* CodeGeneratorRequest::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; // repeated string file_to_generate = 1; @@ -767,7 +779,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -822,7 +834,7 @@ void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; file_to_generate_.MergeFrom(from.file_to_generate_); @@ -847,7 +859,8 @@ void CodeGeneratorRequest::CopyFrom(const CodeGeneratorRequest& from) { } bool CodeGeneratorRequest::IsInitialized() const { - if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(proto_file_)) return false; + if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(proto_file_)) + return false; return true; } @@ -915,16 +928,25 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_name()) { name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), GetArenaForAllocation()); } insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_insertion_point()) { insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(), GetArenaForAllocation()); } content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_content()) { content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(), GetArenaForAllocation()); @@ -937,10 +959,19 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File) } -void CodeGeneratorResponse_File::SharedCtor() { +inline void CodeGeneratorResponse_File::SharedCtor() { name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING generated_code_info_ = nullptr; } @@ -971,7 +1002,7 @@ void CodeGeneratorResponse_File::SetCachedSize(int size) const { void CodeGeneratorResponse_File::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -999,12 +1030,12 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string name = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_name(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1016,7 +1047,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB continue; // optional string insertion_point = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) { auto str = _internal_mutable_insertion_point(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1028,7 +1059,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB continue; // optional string content = 15; case 15: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) { auto str = _internal_mutable_content(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1040,7 +1071,7 @@ const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOB continue; // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; case 16: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 130)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 130)) { ptr = ctx->ParseMessage(_internal_mutable_generated_code_info(), ptr); CHK_(ptr); } else @@ -1070,10 +1101,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse_File::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* CodeGeneratorResponse_File::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -1127,7 +1158,7 @@ size_t CodeGeneratorResponse_File::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1181,7 +1212,7 @@ void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; @@ -1272,6 +1303,9 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) file_(from.file_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING if (from._internal_has_error()) { error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(), GetArenaForAllocation()); @@ -1280,8 +1314,11 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from) // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse) } -void CodeGeneratorResponse::SharedCtor() { +inline void CodeGeneratorResponse::SharedCtor() { error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING supported_features_ = arc_ui64{0u}; } @@ -1309,7 +1346,7 @@ void CodeGeneratorResponse::SetCachedSize(int size) const { void CodeGeneratorResponse::Clear() { // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1327,12 +1364,12 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { - ::PROTOBUF_NAMESPACE_ID::uint32 tag; + arc_ui32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional string error = 1; case 1: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) { auto str = _internal_mutable_error(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG @@ -1344,7 +1381,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // optional uint64 supported_features = 2; case 2: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) { _Internal::set_has_supported_features(&has_bits); supported_features_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); @@ -1353,7 +1390,7 @@ const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NA continue; // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; case 15: - if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) { + if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) { ptr -= 1; do { ptr += 1; @@ -1388,10 +1425,10 @@ failure: #undef CHK_ } -::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse::_InternalSerialize( - ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { +uint8_t* CodeGeneratorResponse::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse) - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; @@ -1431,7 +1468,7 @@ size_t CodeGeneratorResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse) size_t total_size = 0; - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; @@ -1476,7 +1513,7 @@ void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse) GOOGLE_DCHECK_NE(&from, this); - ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + arc_ui32 cached_has_bits = 0; (void) cached_has_bits; file_.MergeFrom(from.file_); 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 1b75172781..2edc4f2ce4 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 < 3018000 +#if PROTOBUF_VERSION < 3019000 #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 3018003 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019000 < 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. @@ -58,7 +58,7 @@ struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; - static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; + static const arc_ui32 offsets[]; }; PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto; PROTOBUF_NAMESPACE_OPEN @@ -173,7 +173,12 @@ class PROTOC_EXPORT Version final : } inline void Swap(Version* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -187,11 +192,7 @@ class PROTOC_EXPORT Version final : // implements Message ---------------------------------------------- - inline Version* New() const final { - return new Version(); - } - - Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<Version>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -206,8 +207,8 @@ class PROTOC_EXPORT Version 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -215,6 +216,8 @@ class PROTOC_EXPORT Version final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(Version* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.Version"; @@ -252,7 +255,7 @@ class PROTOC_EXPORT Version final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_suffix(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_suffix(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_suffix(); + PROTOBUF_NODISCARD TProtoStringType* release_suffix(); void set_allocated_suffix(TProtoStringType* suffix); private: const TProtoStringType& _internal_suffix() const; @@ -266,11 +269,11 @@ class PROTOC_EXPORT Version final : bool _internal_has_major() const; public: void clear_major(); - ::PROTOBUF_NAMESPACE_ID::int32 major() const; - void set_major(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 major() const; + void set_major(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_major() const; - void _internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_major() const; + void _internal_set_major(arc_i32 value); public: // optional int32 minor = 2; @@ -279,11 +282,11 @@ class PROTOC_EXPORT Version final : bool _internal_has_minor() const; public: void clear_minor(); - ::PROTOBUF_NAMESPACE_ID::int32 minor() const; - void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 minor() const; + void set_minor(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_minor() const; - void _internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_minor() const; + void _internal_set_minor(arc_i32 value); public: // optional int32 patch = 3; @@ -292,11 +295,11 @@ class PROTOC_EXPORT Version final : bool _internal_has_patch() const; public: void clear_patch(); - ::PROTOBUF_NAMESPACE_ID::int32 patch() const; - void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 patch() const; + void set_patch(arc_i32 value); private: - ::PROTOBUF_NAMESPACE_ID::int32 _internal_patch() const; - void _internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value); + arc_i32 _internal_patch() const; + void _internal_set_patch(arc_i32 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version) @@ -309,9 +312,9 @@ class PROTOC_EXPORT Version final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr suffix_; - ::PROTOBUF_NAMESPACE_ID::int32 major_; - ::PROTOBUF_NAMESPACE_ID::int32 minor_; - ::PROTOBUF_NAMESPACE_ID::int32 patch_; + arc_i32 major_; + arc_i32 minor_; + arc_i32 patch_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // ------------------------------------------------------------------- @@ -378,7 +381,12 @@ class PROTOC_EXPORT CodeGeneratorRequest final : } inline void Swap(CodeGeneratorRequest* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -392,11 +400,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : // implements Message ---------------------------------------------- - inline CodeGeneratorRequest* New() const final { - return new CodeGeneratorRequest(); - } - - CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<CodeGeneratorRequest>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -411,8 +415,8 @@ class PROTOC_EXPORT CodeGeneratorRequest 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -420,6 +424,8 @@ class PROTOC_EXPORT CodeGeneratorRequest final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CodeGeneratorRequest* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.CodeGeneratorRequest"; @@ -499,7 +505,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_parameter(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_parameter(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_parameter(); + PROTOBUF_NODISCARD TProtoStringType* release_parameter(); void set_allocated_parameter(TProtoStringType* parameter); private: const TProtoStringType& _internal_parameter() const; @@ -514,7 +520,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : 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_NODISCARD ::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: @@ -604,7 +610,12 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : } inline void Swap(CodeGeneratorResponse_File* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -618,11 +629,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : // implements Message ---------------------------------------------- - inline CodeGeneratorResponse_File* New() const final { - return new CodeGeneratorResponse_File(); - } - - CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<CodeGeneratorResponse_File>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -637,8 +644,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -646,6 +653,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CodeGeneratorResponse_File* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.CodeGeneratorResponse.File"; @@ -683,7 +692,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_name(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); + PROTOBUF_NODISCARD TProtoStringType* release_name(); void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; @@ -701,7 +710,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_insertion_point(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_insertion_point(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_insertion_point(); + PROTOBUF_NODISCARD TProtoStringType* release_insertion_point(); void set_allocated_insertion_point(TProtoStringType* insertion_point); private: const TProtoStringType& _internal_insertion_point() const; @@ -719,7 +728,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_content(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_content(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_content(); + PROTOBUF_NODISCARD TProtoStringType* release_content(); void set_allocated_content(TProtoStringType* content); private: const TProtoStringType& _internal_content() const; @@ -734,7 +743,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : 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_NODISCARD ::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: @@ -824,7 +833,12 @@ class PROTOC_EXPORT CodeGeneratorResponse final : } inline void Swap(CodeGeneratorResponse* other) { if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); @@ -838,11 +852,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : // implements Message ---------------------------------------------- - inline CodeGeneratorResponse* New() const final { - return new CodeGeneratorResponse(); - } - - CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<CodeGeneratorResponse>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; @@ -857,8 +867,8 @@ class PROTOC_EXPORT CodeGeneratorResponse 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _cached_size_.Get(); } private: @@ -866,6 +876,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final : void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CodeGeneratorResponse* other); + + private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "google.protobuf.compiler.CodeGeneratorResponse"; @@ -952,7 +964,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_error(ArgT0&& arg0, ArgT... args); TProtoStringType* mutable_error(); - PROTOBUF_MUST_USE_RESULT TProtoStringType* release_error(); + PROTOBUF_NODISCARD TProtoStringType* release_error(); void set_allocated_error(TProtoStringType* error); private: const TProtoStringType& _internal_error() const; @@ -966,11 +978,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final : bool _internal_has_supported_features() const; public: void clear_supported_features(); - ::PROTOBUF_NAMESPACE_ID::uint64 supported_features() const; - void set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value); + arc_ui64 supported_features() const; + void set_supported_features(arc_ui64 value); private: - ::PROTOBUF_NAMESPACE_ID::uint64 _internal_supported_features() const; - void _internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value); + arc_ui64 _internal_supported_features() const; + void _internal_set_supported_features(arc_ui64 value); public: // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse) @@ -984,7 +996,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_; - ::PROTOBUF_NAMESPACE_ID::uint64 supported_features_; + arc_ui64 supported_features_; friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto; }; // =================================================================== @@ -1010,18 +1022,18 @@ inline void Version::clear_major() { major_ = 0; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_major() const { +inline arc_i32 Version::_internal_major() const { return major_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::major() const { +inline arc_i32 Version::major() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major) return _internal_major(); } -inline void Version::_internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_major(arc_i32 value) { _has_bits_[0] |= 0x00000002u; major_ = value; } -inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::set_major(arc_i32 value) { _internal_set_major(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major) } @@ -1038,18 +1050,18 @@ inline void Version::clear_minor() { minor_ = 0; _has_bits_[0] &= ~0x00000004u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_minor() const { +inline arc_i32 Version::_internal_minor() const { return minor_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::minor() const { +inline arc_i32 Version::minor() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor) return _internal_minor(); } -inline void Version::_internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_minor(arc_i32 value) { _has_bits_[0] |= 0x00000004u; minor_ = value; } -inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::set_minor(arc_i32 value) { _internal_set_minor(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor) } @@ -1066,18 +1078,18 @@ inline void Version::clear_patch() { patch_ = 0; _has_bits_[0] &= ~0x00000008u; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_patch() const { +inline arc_i32 Version::_internal_patch() const { return patch_; } -inline ::PROTOBUF_NAMESPACE_ID::int32 Version::patch() const { +inline arc_i32 Version::patch() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch) return _internal_patch(); } -inline void Version::_internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::_internal_set_patch(arc_i32 value) { _has_bits_[0] |= 0x00000008u; patch_ = value; } -inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) { +inline void Version::set_patch(arc_i32 value) { _internal_set_patch(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch) } @@ -1127,7 +1139,13 @@ inline TProtoStringType* Version::release_suffix() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void Version::set_allocated_suffix(TProtoStringType* suffix) { if (suffix != nullptr) { @@ -1137,6 +1155,11 @@ inline void Version::set_allocated_suffix(TProtoStringType* suffix) { } suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix) } @@ -1264,7 +1287,13 @@ inline TProtoStringType* CodeGeneratorRequest::release_parameter() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorRequest::set_allocated_parameter(TProtoStringType* parameter) { if (parameter != nullptr) { @@ -1274,6 +1303,11 @@ inline void CodeGeneratorRequest::set_allocated_parameter(TProtoStringType* para } parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter) } @@ -1453,7 +1487,13 @@ inline TProtoStringType* CodeGeneratorResponse_File::release_name() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse_File::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { @@ -1463,6 +1503,11 @@ inline void CodeGeneratorResponse_File::set_allocated_name(TProtoStringType* nam } name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name) } @@ -1511,7 +1556,13 @@ inline TProtoStringType* CodeGeneratorResponse_File::release_insertion_point() { return nullptr; } _has_bits_[0] &= ~0x00000002u; - return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse_File::set_allocated_insertion_point(TProtoStringType* insertion_point) { if (insertion_point != nullptr) { @@ -1521,6 +1572,11 @@ inline void CodeGeneratorResponse_File::set_allocated_insertion_point(TProtoStri } insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) } @@ -1569,7 +1625,13 @@ inline TProtoStringType* CodeGeneratorResponse_File::release_content() { return nullptr; } _has_bits_[0] &= ~0x00000004u; - return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse_File::set_allocated_content(TProtoStringType* content) { if (content != nullptr) { @@ -1579,6 +1641,11 @@ inline void CodeGeneratorResponse_File::set_allocated_content(TProtoStringType* } content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content) } @@ -1719,7 +1786,13 @@ inline TProtoStringType* CodeGeneratorResponse::release_error() { return nullptr; } _has_bits_[0] &= ~0x00000001u; - return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); + auto* p = error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; } inline void CodeGeneratorResponse::set_allocated_error(TProtoStringType* error) { if (error != nullptr) { @@ -1729,6 +1802,11 @@ inline void CodeGeneratorResponse::set_allocated_error(TProtoStringType* error) } error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error) } @@ -1744,18 +1822,18 @@ inline void CodeGeneratorResponse::clear_supported_features() { supported_features_ = arc_ui64{0u}; _has_bits_[0] &= ~0x00000002u; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::_internal_supported_features() const { +inline arc_ui64 CodeGeneratorResponse::_internal_supported_features() const { return supported_features_; } -inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::supported_features() const { +inline arc_ui64 CodeGeneratorResponse::supported_features() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.supported_features) return _internal_supported_features(); } -inline void CodeGeneratorResponse::_internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void CodeGeneratorResponse::_internal_set_supported_features(arc_ui64 value) { _has_bits_[0] |= 0x00000002u; supported_features_ = value; } -inline void CodeGeneratorResponse::set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) { +inline void CodeGeneratorResponse::set_supported_features(arc_ui64 value) { _internal_set_supported_features(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.supported_features) } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc index 471cc46ef6..ba79c25908 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc @@ -186,6 +186,8 @@ void PrintTopBoilerplate(io::Printer* printer, const FileDescriptor* file, } printer->Print( "from google.protobuf import descriptor as _descriptor\n" + "from google.protobuf import descriptor_pool as " + "_descriptor_pool\n" "from google.protobuf import message as _message\n" "from google.protobuf import reflection as _reflection\n" "from google.protobuf import symbol_database as " @@ -356,12 +358,32 @@ bool Generator::Generate(const FileDescriptor* file, PrintTopLevelEnums(); PrintTopLevelExtensions(); if (pure_python_workable_) { - PrintAllNestedEnumsInFile(); - PrintMessageDescriptors(); - FixForeignFieldsInDescriptors(); + if (GeneratingDescriptorProto()) { + printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Indent(); + // Create enums before message descriptors + PrintAllNestedEnumsInFile(StripPrintDescriptor::kCreate); + PrintMessageDescriptors(StripPrintDescriptor::kCreate); + FixForeignFieldsInDescriptors(); + printer_->Outdent(); + printer_->Print("else:\n"); + printer_->Indent(); + } + // Find the message descriptors first and then use the message + // descriptor to find enums. + PrintMessageDescriptors(StripPrintDescriptor::kFind); + PrintAllNestedEnumsInFile(StripPrintDescriptor::kFind); + if (GeneratingDescriptorProto()) { + printer_->Outdent(); + } } PrintMessages(); if (pure_python_workable_) { + PrintServiceDescriptors(); + + printer.Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Indent(); + // We have to fix up the extensions after the message classes themselves, // since they need to call static RegisterExtension() methods on these // classes. @@ -372,7 +394,11 @@ bool Generator::Generate(const FileDescriptor* file, // custom options that may be unknown when we define the descriptors. // This does not apply to services because they are not used by extensions. FixAllDescriptorOptions(); - PrintServiceDescriptors(); + + // Set serialized_start and serialized_end. + SetSerializedPbInterval(); + + printer_->Outdent(); } if (HasGenericServices(file)) { PrintServices(); @@ -434,46 +460,65 @@ void Generator::PrintFileDescriptor() const { m["package"] = file_->package(); m["syntax"] = StringifySyntax(file_->syntax()); m["options"] = OptionsValue(file_->options().SerializeAsString()); - const char file_descriptor_template[] = - "$descriptor_name$ = _descriptor.FileDescriptor(\n" - " name='$name$',\n" - " package='$package$',\n" - " syntax='$syntax$',\n" - " serialized_options=$options$,\n" - " create_key=_descriptor._internal_create_key,\n"; - printer_->Print(m, file_descriptor_template); - printer_->Indent(); - if (pure_python_workable_) { - printer_->Print("serialized_pb=b'$value$'\n", "value", - strings::CHexEscape(file_descriptor_serialized_)); - if (file_->dependency_count() != 0) { - printer_->Print(",\ndependencies=["); - for (int i = 0; i < file_->dependency_count(); ++i) { - TProtoStringType module_alias = ModuleAlias(file_->dependency(i)->name()); - printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", - module_alias); + m["serialized_descriptor"] = strings::CHexEscape(file_descriptor_serialized_); + if (GeneratingDescriptorProto()) { + printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Indent(); + // Pure python's AddSerializedFile() depend on the generated + // descriptor_pb2.py thus we can not use AddSerializedFile() when + // generated descriptor.proto for pure python. + const char file_descriptor_template[] = + "$descriptor_name$ = _descriptor.FileDescriptor(\n" + " name='$name$',\n" + " package='$package$',\n" + " syntax='$syntax$',\n" + " serialized_options=$options$,\n" + " create_key=_descriptor._internal_create_key,\n"; + printer_->Print(m, file_descriptor_template); + printer_->Indent(); + if (pure_python_workable_) { + printer_->Print("serialized_pb=b'$value$'\n", "value", + strings::CHexEscape(file_descriptor_serialized_)); + if (file_->dependency_count() != 0) { + printer_->Print(",\ndependencies=["); + for (int i = 0; i < file_->dependency_count(); ++i) { + TProtoStringType module_alias = ModuleAlias(file_->dependency(i)->name()); + printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", + module_alias); + } + printer_->Print("]"); } - printer_->Print("]"); - } - if (file_->public_dependency_count() > 0) { - printer_->Print(",\npublic_dependencies=["); - for (int i = 0; i < file_->public_dependency_count(); ++i) { - TProtoStringType module_alias = - ModuleAlias(file_->public_dependency(i)->name()); - printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", - module_alias); + if (file_->public_dependency_count() > 0) { + printer_->Print(",\npublic_dependencies=["); + for (int i = 0; i < file_->public_dependency_count(); ++i) { + TProtoStringType module_alias = + ModuleAlias(file_->public_dependency(i)->name()); + printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias", + module_alias); + } + printer_->Print("]"); } - printer_->Print("]"); + } else { + printer_->Print("serialized_pb=''\n"); } - } else { - printer_->Print("serialized_pb=''\n"); - } - // TODO(falk): Also print options and fix the message_type, enum_type, - // service and extension later in the generation. + // TODO(falk): Also print options and fix the message_type, enum_type, + // service and extension later in the generation. - printer_->Outdent(); - printer_->Print(")\n"); + printer_->Outdent(); + printer_->Print(")\n"); + + printer_->Outdent(); + printer_->Print("else:\n"); + printer_->Indent(); + } + printer_->Print(m, + "$descriptor_name$ = " + "_descriptor_pool.Default().AddSerializedFile(b'$serialized_" + "descriptor$')\n"); + if (GeneratingDescriptorProto()) { + printer_->Outdent(); + } printer_->Print("\n"); } @@ -483,7 +528,7 @@ void Generator::PrintTopLevelEnums() const { std::vector<std::pair<TProtoStringType, int> > top_level_enum_values; for (int i = 0; i < file_->enum_type_count(); ++i) { const EnumDescriptor& enum_descriptor = *file_->enum_type(i); - PrintEnum(enum_descriptor); + PrintFindEnum(enum_descriptor); printer_->Print( "$name$ = " "enum_type_wrapper.EnumTypeWrapper($descriptor_name$)", @@ -507,16 +552,17 @@ void Generator::PrintTopLevelEnums() const { } // Prints all enums contained in all message types in |file|. -void Generator::PrintAllNestedEnumsInFile() const { +void Generator::PrintAllNestedEnumsInFile( + StripPrintDescriptor print_mode) const { for (int i = 0; i < file_->message_type_count(); ++i) { - PrintNestedEnums(*file_->message_type(i)); + PrintNestedEnums(*file_->message_type(i), print_mode); } } // Prints a Python statement assigning the appropriate module-level // enum name to a Python EnumDescriptor object equivalent to // enum_descriptor. -void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { +void Generator::PrintCreateEnum(const EnumDescriptor& enum_descriptor) const { std::map<TProtoStringType, TProtoStringType> m; TProtoStringType module_level_descriptor_name = ModuleLevelDescriptorName(enum_descriptor); @@ -551,7 +597,6 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { printer_->Print("serialized_options=$options_value$,\n", "options_value", OptionsValue(options_string)); EnumDescriptorProto edp; - PrintSerializedPbInterval(enum_descriptor, edp); printer_->Outdent(); printer_->Print(")\n"); if (pure_python_workable_) { @@ -561,20 +606,41 @@ void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const { printer_->Print("\n"); } +void Generator::PrintFindEnum(const EnumDescriptor& enum_descriptor) const { + std::map<TProtoStringType, TProtoStringType> m; + m["descriptor_name"] = ModuleLevelDescriptorName(enum_descriptor); + m["name"] = enum_descriptor.name(); + m["file"] = kDescriptorKey; + if (enum_descriptor.containing_type()) { + m["containing_type"] = + ModuleLevelDescriptorName(*enum_descriptor.containing_type()); + printer_->Print(m, + "$descriptor_name$ = " + "$containing_type$.enum_types_by_name['$name$']\n"); + } else { + printer_->Print( + m, "$descriptor_name$ = $file$.enum_types_by_name['$name$']\n"); + } +} + // Recursively prints enums in nested types within descriptor, then // prints enums contained at the top level in descriptor. -void Generator::PrintNestedEnums(const Descriptor& descriptor) const { +void Generator::PrintNestedEnums(const Descriptor& descriptor, + StripPrintDescriptor print_mode) const { for (int i = 0; i < descriptor.nested_type_count(); ++i) { - PrintNestedEnums(*descriptor.nested_type(i)); + PrintNestedEnums(*descriptor.nested_type(i), print_mode); } for (int i = 0; i < descriptor.enum_type_count(); ++i) { - PrintEnum(*descriptor.enum_type(i)); + if (print_mode == StripPrintDescriptor::kCreate) { + PrintCreateEnum(*descriptor.enum_type(i)); + } else { + PrintFindEnum(*descriptor.enum_type(i)); + } } } void Generator::PrintTopLevelExtensions() const { - const bool is_extension = true; for (int i = 0; i < file_->extension_count(); ++i) { const FieldDescriptor& extension_field = *file_->extension(i); TProtoStringType constant_name = extension_field.name() + "_FIELD_NUMBER"; @@ -582,27 +648,32 @@ void Generator::PrintTopLevelExtensions() const { printer_->Print("$constant_name$ = $number$\n", "constant_name", constant_name, "number", StrCat(extension_field.number())); - printer_->Print("$name$ = ", "name", - ResolveKeyword(extension_field.name())); - PrintFieldDescriptor(extension_field, is_extension); - printer_->Print("\n"); + printer_->Print( + "$resolved_name$ = " + "$file$.extensions_by_name['$name$']\n", + "resolved_name", ResolveKeyword(extension_field.name()), "file", + kDescriptorKey, "name", extension_field.name()); } printer_->Print("\n"); } // Prints Python equivalents of all Descriptors in |file|. -void Generator::PrintMessageDescriptors() const { - for (int i = 0; i < file_->message_type_count(); ++i) { - PrintDescriptor(*file_->message_type(i)); - printer_->Print("\n"); +void Generator::PrintMessageDescriptors(StripPrintDescriptor print_mode) const { + if (print_mode == StripPrintDescriptor::kCreate) { + for (int i = 0; i < file_->message_type_count(); ++i) { + PrintCreateDescriptor(*file_->message_type(i)); + printer_->Print("\n"); + } + } else { + for (int i = 0; i < file_->message_type_count(); ++i) { + PrintFindDescriptor(*file_->message_type(i)); + } } } void Generator::PrintServiceDescriptors() const { for (int i = 0; i < file_->service_count(); ++i) { PrintServiceDescriptor(*file_->service(i)); - AddServiceToFileDescriptor(*file_->service(i)); - printer_->Print("\n"); } } @@ -616,65 +687,11 @@ void Generator::PrintServices() const { void Generator::PrintServiceDescriptor( const ServiceDescriptor& descriptor) const { - printer_->Print("\n"); - TProtoStringType service_name = ModuleLevelServiceDescriptorName(descriptor); - TProtoStringType options_string; - descriptor.options().SerializeToString(&options_string); - - printer_->Print("$service_name$ = _descriptor.ServiceDescriptor(\n", - "service_name", service_name); - printer_->Indent(); std::map<TProtoStringType, TProtoStringType> m; + m["service_name"] = ModuleLevelServiceDescriptorName(descriptor); m["name"] = descriptor.name(); - m["full_name"] = descriptor.full_name(); m["file"] = kDescriptorKey; - m["index"] = StrCat(descriptor.index()); - m["options_value"] = OptionsValue(options_string); - const char required_function_arguments[] = - "name='$name$',\n" - "full_name='$full_name$',\n" - "file=$file$,\n" - "index=$index$,\n" - "serialized_options=$options_value$,\n" - "create_key=_descriptor._internal_create_key,\n"; - printer_->Print(m, required_function_arguments); - - ServiceDescriptorProto sdp; - PrintSerializedPbInterval(descriptor, sdp); - - printer_->Print("methods=[\n"); - for (int i = 0; i < descriptor.method_count(); ++i) { - const MethodDescriptor* method = descriptor.method(i); - method->options().SerializeToString(&options_string); - - m.clear(); - m["name"] = method->name(); - m["full_name"] = method->full_name(); - m["index"] = StrCat(method->index()); - m["serialized_options"] = CEscape(options_string); - m["input_type"] = ModuleLevelDescriptorName(*(method->input_type())); - m["output_type"] = ModuleLevelDescriptorName(*(method->output_type())); - m["options_value"] = OptionsValue(options_string); - printer_->Print("_descriptor.MethodDescriptor(\n"); - printer_->Indent(); - printer_->Print(m, - "name='$name$',\n" - "full_name='$full_name$',\n" - "index=$index$,\n" - "containing_service=None,\n" - "input_type=$input_type$,\n" - "output_type=$output_type$,\n" - "serialized_options=$options_value$,\n" - "create_key=_descriptor._internal_create_key,\n"); - printer_->Outdent(); - printer_->Print("),\n"); - } - - printer_->Outdent(); - printer_->Print("])\n"); - printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name", - service_name); - printer_->Print("\n"); + printer_->Print(m, "$service_name$ = $file$.services_by_name['$name$']\n"); } void Generator::PrintDescriptorKeyAndModuleName( @@ -719,18 +736,20 @@ void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const { // to a Python Descriptor object for message_descriptor. // // Mutually recursive with PrintNestedDescriptors(). -void Generator::PrintDescriptor(const Descriptor& message_descriptor) const { - PrintNestedDescriptors(message_descriptor); +void Generator::PrintCreateDescriptor( + const Descriptor& message_descriptor) const { + std::map<TProtoStringType, TProtoStringType> m; + m["name"] = message_descriptor.name(); + m["full_name"] = message_descriptor.full_name(); + m["file"] = kDescriptorKey; + + PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kCreate); printer_->Print("\n"); printer_->Print("$descriptor_name$ = _descriptor.Descriptor(\n", "descriptor_name", ModuleLevelDescriptorName(message_descriptor)); printer_->Indent(); - std::map<TProtoStringType, TProtoStringType> m; - m["name"] = message_descriptor.name(); - m["full_name"] = message_descriptor.full_name(); - m["file"] = kDescriptorKey; const char required_function_arguments[] = "name='$name$',\n" "full_name='$full_name$',\n" @@ -786,12 +805,11 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const { printer_->Indent(); for (int i = 0; i < message_descriptor.oneof_decl_count(); ++i) { const OneofDescriptor* desc = message_descriptor.oneof_decl(i); - std::map<TProtoStringType, TProtoStringType> m; + m.clear(); m["name"] = desc->name(); m["full_name"] = desc->full_name(); m["index"] = StrCat(desc->index()); - TProtoStringType options_string = - OptionsValue(desc->options().SerializeAsString()); + options_string = OptionsValue(desc->options().SerializeAsString()); if (options_string == "None") { m["serialized_options"] = ""; } else { @@ -806,22 +824,46 @@ void Generator::PrintDescriptor(const Descriptor& message_descriptor) const { } printer_->Outdent(); printer_->Print("],\n"); - // Serialization of proto - DescriptorProto edp; - PrintSerializedPbInterval(message_descriptor, edp); printer_->Outdent(); printer_->Print(")\n"); } +void Generator::PrintFindDescriptor( + const Descriptor& message_descriptor) const { + std::map<TProtoStringType, TProtoStringType> m; + m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor); + m["name"] = message_descriptor.name(); + + if (message_descriptor.containing_type()) { + m["containing_type"] = + ModuleLevelDescriptorName(*message_descriptor.containing_type()); + printer_->Print(m, + "$descriptor_name$ = " + "$containing_type$.nested_types_by_name['$name$']\n"); + } else { + m["file"] = kDescriptorKey; + printer_->Print( + m, "$descriptor_name$ = $file$.message_types_by_name['$name$']\n"); + } + + PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kFind); +} + // Prints Python Descriptor objects for all nested types contained in // message_descriptor. // // Mutually recursive with PrintDescriptor(). -void Generator::PrintNestedDescriptors( - const Descriptor& containing_descriptor) const { - for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { - PrintDescriptor(*containing_descriptor.nested_type(i)); +void Generator::PrintNestedDescriptors(const Descriptor& containing_descriptor, + StripPrintDescriptor print_mode) const { + if (print_mode == StripPrintDescriptor::kCreate) { + for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { + PrintCreateDescriptor(*containing_descriptor.nested_type(i)); + } + } else { + for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) { + PrintFindDescriptor(*containing_descriptor.nested_type(i)); + } } } @@ -1104,10 +1146,6 @@ void Generator::FixForeignFieldsInExtensions() const { void Generator::FixForeignFieldsInExtension( const FieldDescriptor& extension_field) const { GOOGLE_CHECK(extension_field.is_extension()); - // extension_scope() will be NULL for top-level extensions, which is - // exactly what FixForeignFieldsInField() wants. - FixForeignFieldsInField(extension_field.extension_scope(), extension_field, - "extensions_by_name"); std::map<TProtoStringType, TProtoStringType> m; // Confusingly, for FieldDescriptors that happen to be extensions, @@ -1306,7 +1344,8 @@ TProtoStringType Generator::ModuleLevelServiceDescriptorName( // template <typename DescriptorT, typename DescriptorProtoT> void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, - DescriptorProtoT& proto) const { + DescriptorProtoT& proto, + const TProtoStringType& name) const { descriptor.CopyTo(&proto); TProtoStringType sp; proto.SerializeToString(&sp); @@ -1314,9 +1353,9 @@ void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor, GOOGLE_CHECK_GE(offset, 0); printer_->Print( - "serialized_start=$serialized_start$,\n" - "serialized_end=$serialized_end$,\n", - "serialized_start", StrCat(offset), "serialized_end", + "$name$._serialized_start=$serialized_start$\n" + "$name$._serialized_end=$serialized_end$\n", + "name", name, "serialized_start", StrCat(offset), "serialized_end", StrCat(offset + sp.size())); } @@ -1326,16 +1365,62 @@ void PrintDescriptorOptionsFixingCode(const TProtoStringType& descriptor, io::Printer* printer) { // Reset the _options to None thus DescriptorBase.GetOptions() can // parse _options again after extensions are registered. - printer->Print("$descriptor$._options = None\n", "descriptor", descriptor); + printer->Print( + "$descriptor$._options = None\n" + "$descriptor$._serialized_options = $serialized_value$\n", + "descriptor", descriptor, "serialized_value", options); } } // namespace +void Generator::SetSerializedPbInterval() const { + // Top level enums. + for (int i = 0; i < file_->enum_type_count(); ++i) { + EnumDescriptorProto proto; + const EnumDescriptor& descriptor = *file_->enum_type(i); + PrintSerializedPbInterval(descriptor, proto, + ModuleLevelDescriptorName(descriptor)); + } + + // Messages. + for (int i = 0; i < file_->message_type_count(); ++i) { + SetMessagePbInterval(*file_->message_type(i)); + } + + // Services. + for (int i = 0; i < file_->service_count(); ++i) { + ServiceDescriptorProto proto; + const ServiceDescriptor& service = *file_->service(i); + PrintSerializedPbInterval(service, proto, + ModuleLevelServiceDescriptorName(service)); + } +} + +void Generator::SetMessagePbInterval(const Descriptor& descriptor) const { + DescriptorProto message_proto; + PrintSerializedPbInterval(descriptor, message_proto, + ModuleLevelDescriptorName(descriptor)); + + // Nested messages. + for (int i = 0; i < descriptor.nested_type_count(); ++i) { + SetMessagePbInterval(*descriptor.nested_type(i)); + } + + for (int i = 0; i < descriptor.enum_type_count(); ++i) { + EnumDescriptorProto proto; + const EnumDescriptor& enum_des = *descriptor.enum_type(i); + PrintSerializedPbInterval(enum_des, proto, + ModuleLevelDescriptorName(enum_des)); + } +} + // Prints expressions that set the options field of all descriptors. void Generator::FixAllDescriptorOptions() const { // Prints an expression that sets the file descriptor's options. TProtoStringType file_options = OptionsValue(file_->options().SerializeAsString()); if (file_options != "None") { PrintDescriptorOptionsFixingCode(kDescriptorKey, file_options, printer_); + } else { + printer_->Print("DESCRIPTOR._options = None\n"); } // Prints expressions that set the options for all top level enums. for (int i = 0; i < file_->enum_type_count(); ++i) { @@ -1352,6 +1437,10 @@ void Generator::FixAllDescriptorOptions() const { for (int i = 0; i < file_->message_type_count(); ++i) { FixOptionsForMessage(*file_->message_type(i)); } + + for (int i = 0; i < file_->service_count(); ++i) { + FixOptionsForService(*file_->service(i)); + } } void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const { @@ -1386,6 +1475,31 @@ void Generator::FixOptionsForEnum(const EnumDescriptor& enum_descriptor) const { } } +// Prints expressions that set the options for an service descriptor and its +// value descriptors. +void Generator::FixOptionsForService( + const ServiceDescriptor& service_descriptor) const { + TProtoStringType descriptor_name = + ModuleLevelServiceDescriptorName(service_descriptor); + TProtoStringType service_options = + OptionsValue(service_descriptor.options().SerializeAsString()); + if (service_options != "None") { + PrintDescriptorOptionsFixingCode(descriptor_name, service_options, + printer_); + } + + for (int i = 0; i < service_descriptor.method_count(); ++i) { + const MethodDescriptor* method = service_descriptor.method(i); + TProtoStringType method_options = + OptionsValue(method->options().SerializeAsString()); + if (method_options != "None") { + TProtoStringType method_name = + descriptor_name + ".methods_by_name['" + method->name() + "']"; + PrintDescriptorOptionsFixingCode(method_name, method_options, printer_); + } + } +} + // Prints expressions that set the options for field descriptors (including // extensions). void Generator::FixOptionsForField(const FieldDescriptor& field) const { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h index 83dbce951a..d5af959fce 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h @@ -59,6 +59,8 @@ class Printer; namespace compiler { namespace python { +enum class StripPrintDescriptor { kCreate, kFind }; + // CodeGenerator implementation for generated Python protocol buffer classes. // If you create your own protocol compiler binary and you want it to support // Python output, you can do so by registering an instance of this @@ -79,9 +81,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator { void PrintImports() const; void PrintFileDescriptor() const; void PrintTopLevelEnums() const; - void PrintAllNestedEnumsInFile() const; - void PrintNestedEnums(const Descriptor& descriptor) const; - void PrintEnum(const EnumDescriptor& enum_descriptor) const; + void PrintAllNestedEnumsInFile(StripPrintDescriptor print_mode) const; + void PrintNestedEnums(const Descriptor& descriptor, + StripPrintDescriptor print_mode) const; + void PrintCreateEnum(const EnumDescriptor& enum_descriptor) const; + void PrintFindEnum(const EnumDescriptor& enum_descriptor) const; void PrintTopLevelExtensions() const; @@ -93,9 +97,11 @@ class PROTOC_EXPORT Generator : public CodeGenerator { const FieldDescriptor* (Descriptor::*GetterFn)(int)const) const; void PrintFieldsInDescriptor(const Descriptor& message_descriptor) const; void PrintExtensionsInDescriptor(const Descriptor& message_descriptor) const; - void PrintMessageDescriptors() const; - void PrintDescriptor(const Descriptor& message_descriptor) const; - void PrintNestedDescriptors(const Descriptor& containing_descriptor) const; + void PrintMessageDescriptors(StripPrintDescriptor print_mode) const; + void PrintCreateDescriptor(const Descriptor& message_descriptor) const; + void PrintFindDescriptor(const Descriptor& message_descriptor) const; + void PrintNestedDescriptors(const Descriptor& containing_descriptor, + StripPrintDescriptor print_mode) const; void PrintMessages() const; void PrintMessage(const Descriptor& message_descriptor, @@ -150,14 +156,19 @@ class PROTOC_EXPORT Generator : public CodeGenerator { template <typename DescriptorT, typename DescriptorProtoT> void PrintSerializedPbInterval(const DescriptorT& descriptor, - DescriptorProtoT& proto) const; + DescriptorProtoT& proto, + const TProtoStringType& name) const; void FixAllDescriptorOptions() const; void FixOptionsForField(const FieldDescriptor& field) const; void FixOptionsForOneof(const OneofDescriptor& oneof) const; void FixOptionsForEnum(const EnumDescriptor& descriptor) const; + void FixOptionsForService(const ServiceDescriptor& descriptor) const; void FixOptionsForMessage(const Descriptor& descriptor) const; + void SetSerializedPbInterval() const; + void SetMessagePbInterval(const Descriptor& descriptor) const; + void CopyPublicDependenciesAliases(const TProtoStringType& copy_from, const FileDescriptor* file) const; 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 acf806a7e6..d4b4b482d6 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 @@ -465,35 +465,8 @@ void EndPackageModules(int levels, io::Printer* printer) { } } -bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file, - TProtoStringType* error) { - for (int i = 0; i < message->field_count(); i++) { - const FieldDescriptor* field = message->field(i); - if ((field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && - field->message_type()->file() == file) || - (field->type() == FieldDescriptor::TYPE_ENUM && - field->enum_type()->file() == file)) { - *error = "proto3 message field " + field->full_name() + " in file " + - file->name() + " has a dependency on a type from proto2 file " + - file->name() + - ". Ruby doesn't support proto2 yet, so we must fail."; - return true; - } - } - - for (int i = 0; i < message->nested_type_count(); i++) { - if (UsesTypeFromFile(message->nested_type(i), file, error)) { - return true; - } - } - - 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", @@ -534,8 +507,13 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer, "\n", "filename", file->name()); - for (int i = 0; i < file->dependency_count(); i++) { - printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name())); + printer->Print("require 'google/protobuf'\n\n"); + + if (file->dependency_count() != 0) { + for (int i = 0; i < file->dependency_count(); i++) { + printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name())); + } + printer->Print("\n"); } // TODO: Remove this when ruby supports extensions for proto2 syntax. diff --git a/tools/enum_parser/parse_enum/parse_enum.cpp b/tools/enum_parser/parse_enum/parse_enum.cpp index 80c5498ab7..07712411ae 100644 --- a/tools/enum_parser/parse_enum/parse_enum.cpp +++ b/tools/enum_parser/parse_enum/parse_enum.cpp @@ -374,7 +374,6 @@ private: TEnum CurrentEnum; }; - TEnumParser::TEnumParser(const TString& fileName) { THolder<IInputStream> hIn; IInputStream* in = nullptr; @@ -385,6 +384,7 @@ TEnumParser::TEnumParser(const TString& fileName) { } else { in = &Cin; } + TString contents = in->ReadAll(); Parse(contents.data(), contents.size()); } @@ -398,7 +398,22 @@ TEnumParser::TEnumParser(IInputStream& in) { Parse(contents.data(), contents.size()); } -void TEnumParser::Parse(const char* data, size_t length) { +void TEnumParser::Parse(const char* dataIn, size_t lengthIn) { + TMemoryInput mi(dataIn, lengthIn); + + TString line; + TString result; + + while (mi.ReadLine(line)) { + if (line.find("if (GetOwningArena() == other->GetOwningArena()) {") == TString::npos) { + result += line; + result += "\n"; + } + } + + const char* data = result.c_str(); + size_t length = result.length(); + const TStringBuf span(data, length); const bool hasPragmaOnce = span.Contains("#pragma once"); const bool isProtobufHeader = span.Contains("// Generated by the protocol buffer compiler"); @@ -414,10 +429,10 @@ void TEnumParser::Parse(const char* data, size_t length) { TCppSaxParser parser(&cppContext); TransferData(&in, &parser); parser.Finish(); - //cppContext.PrintEnums(); // obtain result Enums = cppContext.Enums; if (cppContext.Scope) { + cppContext.PrintEnums(); cppContext.PrintScope(); ythrow yexception() << "Unbalanced scope, something is wrong with enum parser. "; } |